list-realms
Retrieve all available realms in Keycloak MCP Server to manage user access, roles, and groups efficiently.
Instructions
List all available realms
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/services/keycloak.ts:48-54 (handler)The core handler function that executes the tool logic by fetching all realms from Keycloak admin client and formatting them into a list.
public async listRealms(): Promise<string> { const realms: RealmRepresentation[] = await this.kcAdminClient.realms.find(); return `Available realms:\n${realms .map((r) => `- ${r.realm} (${r.id})`) .join("\n")}`; } - src/schemas/index.ts:66-70 (schema)Input schema definition for the list-realms tool, specifying no required properties.
"list-realms": { type: "object", properties: {}, required: [], }, - src/server.ts:47-50 (registration)Registers the list-realms tool in the ListTools response, providing name, description, and input schema reference.
name: "list-realms", description: "List all available realms", inputSchema: InputSchema["list-realms"], }, - src/server.ts:107-112 (handler)Server-side handler case that dispatches the list-realms tool call to the KeycloakService.
case "list-realms": return { content: [ { type: "text", text: await keycloakService.listRealms() }, ], };