Skip to main content
Glama
kapilduraphe

Okta MCP Server

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

Implementation Reference

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

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