delete_user
Remove a user account from the Kapiti platform by specifying the user ID and optional deletion reason to maintain system integrity.
Instructions
Delete a user from the system
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | User ID | |
| reason | No | Reason for deletion |
Implementation Reference
- src/index.ts:444-470 (handler)The handler function for the 'delete_user' tool. It sends a DELETE request to the Headlesshost API endpoint `/tools/membership/users/${id}` with an optional 'reason' in the payload and returns the API response or error.async ({ id, reason }) => { try { const payload = { reason }; const response: AxiosResponse<ApiResponse> = await apiClient.delete(`/tools/membership/users/${id}`, { data: payload, }); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } }
- src/index.ts:440-442 (schema)Input schema for the 'delete_user' tool using Zod validation: requires 'id' (string) and optional 'reason' (string).id: z.string().describe("User ID"), reason: z.string().optional().describe("Reason for deletion"), },
- src/index.ts:434-471 (registration)Registers the 'delete_user' tool with the MCP server, including title, description, input schema, and handler function.server.registerTool( "delete_user", { title: "Delete User", description: "Delete a user from the system", inputSchema: { id: z.string().describe("User ID"), reason: z.string().optional().describe("Reason for deletion"), }, }, async ({ id, reason }) => { try { const payload = { reason }; const response: AxiosResponse<ApiResponse> = await apiClient.delete(`/tools/membership/users/${id}`, { data: payload, }); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } } );