delete_user
Remove a user from Okta by specifying the user ID. The user must be deactivated before deletion. Part of the Okta MCP Server for user management.
Instructions
Delete a user from Okta (must be deactivated first)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | The unique identifier of the Okta user |
Implementation Reference
- src/tools/users.ts:701-731 (handler)The main handler function for the 'delete_user' tool. It parses the input using the Zod schema, calls the Okta API to delete the user by ID, and returns a success or error message.delete_user: async (request: { parameters: unknown }) => { const { userId } = userSchemas.deleteUser.parse(request.parameters); try { const oktaClient = getOktaClient(); await oktaClient.userApi.deleteUser({ userId, }); return { content: [ { type: "text", text: `User with ID ${userId} has been permanently deleted.`, }, ], }; } catch (error) { console.error("Error deleting user:", error); return { content: [ { type: "text", text: `Failed to delete user: ${error instanceof Error ? error.message : String(error)}. Note: Users must be deactivated before they can be deleted.`, }, ], isError: true, }; } },
- src/tools/users.ts:310-323 (registration)Tool registration entry in the userTools array, defining the name, description, and input schema for the 'delete_user' tool.{ name: "delete_user", description: "Delete a user from Okta (must be deactivated first)", inputSchema: { type: "object", properties: { userId: { type: "string", description: "The unique identifier of the Okta user", }, }, required: ["userId"], }, },
- src/tools/users.ts:53-55 (schema)Zod schema definition for validating 'delete_user' input parameters, used in the handler for parsing.deleteUser: z.object({ userId: z.string().min(1, "User ID is required"), }),