suspend_user
Suspend a user in Okta by providing their unique user ID. This tool integrates with the Okta MCP Server to manage user access effectively.
Instructions
Suspend 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:605-635 (handler)The main handler function for the 'suspend_user' tool. It validates the input using Zod schema, retrieves the Okta client, calls the Okta API to suspend the user by ID, and returns a success or error message.suspend_user: async (request: { parameters: unknown }) => { const { userId } = userSchemas.suspendUser.parse(request.parameters); try { const oktaClient = getOktaClient(); await oktaClient.userApi.suspendUser({ userId, }); return { content: [ { type: "text", text: `User with ID ${userId} has been suspended.`, }, ], }; } catch (error) { console.error("Error suspending user:", error); return { content: [ { type: "text", text: `Failed to suspend user: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } },
- src/tools/users.ts:268-281 (registration)The tool registration object in the userTools array, defining the name, description, and input schema for the 'suspend_user' tool.{ name: "suspend_user", description: "Suspend 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:41-43 (schema)Zod schema definition for 'suspendUser' input validation, used within the handler to parse and validate the request parameters.suspendUser: z.object({ userId: z.string().min(1, "User ID is required"), }),