Skip to main content
Glama
HaithamOumerzoug

Keycloak MCP Server

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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")}`;
    }
  • 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"],
    },
  • 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() },
        ],
      };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions listing realms but doesn't specify whether this is a read-only operation, if it requires authentication, what format the output takes, or any pagination/rate limiting considerations. This leaves significant gaps for an agent to understand how to use it effectively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero wasted words. It's front-loaded with the core action and resource, making it immediately understandable without any unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for a tool that presumably returns a list of realms. It doesn't explain what a 'realm' is in this context, what data is returned, or any behavioral aspects like error handling. For a tool with zero structured metadata, this minimal description leaves too many questions unanswered.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the absence of inputs. The description adds no parameter information, which is appropriate here since there are no parameters to explain. A baseline of 4 is justified as the description doesn't need to compensate for any parameter gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('realms'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'list-users' or 'list-groups' beyond the resource type, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list-clients' or 'list-users', nor does it mention any prerequisites or context for usage. It simply states what the tool does without indicating appropriate scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related 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/HaithamOumerzoug/keycloak-mcp'

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