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
| Name | Required | Description | Default |
|---|---|---|---|
| groupId | Yes | ID of the group | |
| userId | Yes | ID of the user to remove from the group |
Implementation Reference
- src/tools/groups.ts:505-538 (handler)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, }; } },
- src/tools/groups.ts:34-37 (schema)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"), }),
- src/tools/groups.ts:194-211 (registration)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"], }, },