Skip to main content
Glama
kapilduraphe

Okta MCP Server

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

Implementation Reference

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

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