delete_user
Permanently delete a user from the org by ID, removing all memberships, revoking API keys, and ending active sessions.
Instructions
Delete a user from the org by id. This is permanent, removes org and workspace memberships, revokes API keys, and ends active sessions; use delete_user_invite for pending invites instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes | The user ID to delete |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether the tool call succeeded and returned structured data | |
| data | No | Structured success payload when ok is true | |
| error | No | Structured error payload when ok is false |
Implementation Reference
- src/tools/users.tools.ts:308-331 (registration)Registration of the 'delete_user' tool on the MCP server with schema reference and handler callback.
// Phase 1: Delete user tool server.tool( "delete_user", "Delete a user from the org by id. This is permanent, removes org and workspace memberships, revokes API keys, and ends active sessions; use delete_user_invite for pending invites instead.", USERS_TOOL_SCHEMAS.deleteUser, async (params) => { await service.users.deleteUser(params.user_id); return { content: [ { type: "text", text: JSON.stringify( { message: `Successfully deleted user ${params.user_id}`, success: true, }, null, 2, ), }, ], }; }, ); - src/tools/users.tools.ts:313-330 (handler)Handler function for delete_user that calls service.users.deleteUser() and returns a success message.
async (params) => { await service.users.deleteUser(params.user_id); return { content: [ { type: "text", text: JSON.stringify( { message: `Successfully deleted user ${params.user_id}`, success: true, }, null, 2, ), }, ], }; }, - src/tools/users.tools.ts:117-119 (schema)Input schema for delete_user: expects a user_id string.
deleteUser: { user_id: z.string().describe("The user ID to delete"), }, - Service layer deleteUser method that sends a DELETE request to /admin/users/{userId} and returns success.
async deleteUser(userId: string): Promise<{ success: boolean }> { await this.delete(`/admin/users/${this.encodePathSegment(userId)}`); return { success: true }; }