deactivate_user
Deactivate a user in Okta by providing their unique identifier, enabling efficient user management through the Okta MCP Server.
Instructions
Deactivate a user in Okta
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | The unique identifier of the Okta user |
Implementation Reference
- src/tools/users.ts:669-698 (handler)The main handler function for the 'deactivate_user' tool. It validates the input using the Zod schema, retrieves the Okta client, and calls deactivateUser API to deactivate the specified user ID.deactivate_user: async (request: { parameters: unknown }) => { const { userId } = userSchemas.deactivateUser.parse(request.parameters); try { const oktaClient = getOktaClient(); await oktaClient.userApi.deactivateUser({ userId, }); return { content: [ { type: "text", text: `User with ID ${userId} has been deactivated.`, }, ], }; } catch (error) { console.error("Error deactivating user:", error); return { content: [ { type: "text", text: `Failed to deactivate user: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; }
- src/tools/users.ts:296-308 (registration)Tool registration entry in the userTools array that defines the name, description, and input schema for the 'deactivate_user' tool.{ name: "deactivate_user", description: "Deactivate a user in Okta", inputSchema: { type: "object", properties: { userId: { type: "string", description: "The unique identifier of the Okta user", }, }, required: ["userId"], },
- src/tools/users.ts:49-51 (schema)Zod input validation schema for the deactivate_user tool, ensuring userId is a non-empty string.deactivateUser: z.object({ userId: z.string().min(1, "User ID is required"), }),