Skip to main content
Glama
kapilduraphe

Okta MCP Server

remove_user_from_group

Remove a user from a specific group in Okta by providing the user ID and group ID through the Okta MCP Server.

Instructions

Remove a user from a group in Okta

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupIdYesID of the group
userIdYesID of the user to remove from the group

Implementation Reference

  • The main handler function for the 'remove_user_from_group' tool. It validates input using Zod schema, retrieves Okta client, calls the Okta API to unassign user from group, and returns a formatted success or error response.
    remove_user_from_group: async (request: { parameters: unknown }) => {
      const { groupId, userId } = groupSchemas.removeUserFromGroup.parse(
        request.parameters
      );
    
      try {
        const oktaClient = getOktaClient();
    
        await oktaClient.groupApi.unassignUserFromGroup({
          groupId,
          userId,
        });
    
        return {
          content: [
            {
              type: "text",
              text: `User with ID ${userId} has been successfully removed from group with ID ${groupId}.`,
            },
          ],
        };
      } catch (error) {
        console.error("Error removing user from group:", error);
        return {
          content: [
            {
              type: "text",
              text: `Failed to remove user from group: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    },
  • Zod schema definition for validating the input parameters: groupId and userId, both required strings.
    removeUserFromGroup: z.object({
      groupId: z.string().min(1, "Group ID is required"),
      userId: z.string().min(1, "User ID is required"),
    }),
  • Tool registration entry in the groupTools array, defining the tool name, description, and JSON input schema for MCP protocol.
    {
      name: "remove_user_from_group",
      description: "Remove a user from a group in Okta",
      inputSchema: {
        type: "object",
        properties: {
          groupId: {
            type: "string",
            description: "ID of the group",
          },
          userId: {
            type: "string",
            description: "ID of the user to remove from the group",
          },
        },
        required: ["groupId", "userId"],
      },
    },

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