Skip to content

Commit 2b835cc

Browse files
Add delete_user tool (#1461)
1 parent 127311a commit 2b835cc

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

apps/core/lib/core/mcp/server.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ defmodule Core.MCP.Server do
1111
SetupTrial,
1212
ListPlans,
1313
ModifyProPlan,
14-
AddDomainMapping
14+
AddDomainMapping,
15+
DeleteUser
1516
}
1617

1718
@tools [
@@ -25,7 +26,8 @@ defmodule Core.MCP.Server do
2526
SetupTrial,
2627
ListPlans,
2728
ModifyProPlan,
28-
AddDomainMapping
29+
AddDomainMapping,
30+
DeleteUser
2931
]
3032
@by_name Map.new(@tools, & {&1.name(), &1})
3133

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
defmodule Core.MCP.Tools.DeleteUser do
2+
@behaviour Core.MCP.Tool
3+
import Core.MCP.Tools.Utils
4+
alias Core.Services.Accounts
5+
6+
def name(), do: "delete_user"
7+
8+
def description(), do: "Deletes a user from Plural and leaves other account details intact"
9+
10+
def schema(), do: %{
11+
type: "object",
12+
required: ["email"],
13+
properties: %{
14+
account_id: %{
15+
type: "string",
16+
description: "The email of the user you want to delete"
17+
}
18+
}
19+
}
20+
21+
def invoke(%{"email" => email}) do
22+
case Accounts.delete_user(email) do
23+
{:ok, _} -> {:ok, "user deleted"}
24+
{:error, _} -> {:error, "failed to delete user"}
25+
end
26+
end
27+
def invoke(_), do: {:error, "email is required"}
28+
end

0 commit comments

Comments
 (0)