Skip to main content
Glama
kapilduraphe

Okta MCP Server

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
NameRequiredDescriptionDefault
userIdYesThe unique identifier of the Okta user

Implementation Reference

  • 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,
        };
      }
  • 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"],
      },
  • 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"),
    }),

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kapilduraphe/okta-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server