Skip to main content
Glama

delete-user

Remove a user from a Keycloak realm by specifying the realm name and user ID to manage user access and permissions.

Instructions

Delete a user from a specific realm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
realmYes
userIdYes

Implementation Reference

  • Handler for the 'delete-user' tool: parses arguments with DeleteUserSchema, sets Keycloak realm config, deletes user by ID, returns success response.
    case "delete-user": {
      const { realm, userId } = DeleteUserSchema.parse(args);
      
      kcAdminClient.setConfig({
        realmName: realm
      });
    
      await kcAdminClient.users.del({
        id: userId,
        realm
      });
    
      return {
        content: [{
          type: "text",
          text: `User ${userId} deleted successfully from realm ${realm}`
        }]
      };
    }
  • Zod schema defining input validation for 'delete-user' tool: requires 'realm' and 'userId' strings.
    const DeleteUserSchema = z.object({
      realm: z.string(),
      userId: z.string()
    });
  • src/index.ts:62-73 (registration)
    Tool registration in ListTools handler: defines name, description, and inputSchema for 'delete-user'.
    {
      name: "delete-user",
      description: "Delete a user from a specific realm",
      inputSchema: {
        type: "object",
        properties: {
          realm: { type: "string" },
          userId: { type: "string" }
        },
        required: ["realm", "userId"]
      }
    },
Install Server

Other Tools

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/ChristophEnglisch/keycloak-model-context-protocol'

If you have feedback or need assistance with the MCP directory API, please join our Discord server