Skip to main content
Glama
kapilduraphe

Okta MCP Server

assign_user_to_group

Assign a specific user to a designated group within Okta’s user management system to streamline access and permissions.

Instructions

Assign a user to a group in Okta

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupIdYesID of the group
userIdYesID of the user to assign to the group

Implementation Reference

  • The handler function for the 'assign_user_to_group' tool. It validates input parameters using Zod schema, retrieves Okta client, calls the Okta API to assign the user to the group, and returns a success or error response.
    assign_user_to_group: async (request: { parameters: unknown }) => {
      const { groupId, userId } = groupSchemas.assignUserToGroup.parse(
        request.parameters
      );
    
      try {
        const oktaClient = getOktaClient();
    
        await oktaClient.groupApi.assignUserToGroup({
          groupId,
          userId,
        });
    
        return {
          content: [
            {
              type: "text",
              text: `User with ID ${userId} has been successfully assigned to group with ID ${groupId}.`,
            },
          ],
        };
      } catch (error) {
        console.error("Error assigning user to group:", error);
        return {
          content: [
            {
              type: "text",
              text: `Failed to assign user to group: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    },
  • The tool registration object defining the name, description, and input schema, included in the exported groupTools array which is spread into the main TOOLS export in index.ts.
    {
      name: "assign_user_to_group",
      description: "Assign a user to 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 assign to the group",
          },
        },
        required: ["groupId", "userId"],
      },
    },
  • Zod schema for validating the input parameters (groupId and userId) used in the handler function.
    assignUserToGroup: z.object({
      groupId: z.string().min(1, "Group ID is required"),
      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