Skip to main content
Glama
Keycloak MCP Server

Keycloak MCP Server

by Cayetano97

count_organizations

Count organizations in a Keycloak realm and filter by name/domain, exact match, custom attributes, or identity provider. Requires Keycloak 26.3+.

Instructions

Returns the organizations counts. Requires Keycloak 26.3+.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "realm": "<realm>"
    },
    "name": "count_organizations"
  }
}

Input Schema

NameRequiredDescriptionDefault
qNoA query to search for custom attributes, in the format 'key1:value2 key2:value2'
exactNoBoolean which defines whether the param 'search' must match exactly or not
realmYesRealm name
searchNoA String representing either an organization name or domain
identityProviderNoThe alias of an identity provider, to only count the organizations linked to it. Cannot be combined with 'q'

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

B3.2/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden, and it does add one genuinely useful constraint: a minimum server version (Keycloak 26.3+), which is not in the schema. However, it does not confirm the read-only nature, the return shape (a single count versus per-filter counts), or behavior on unmatched filters.

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

Conciseness4/5

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

Two short sentences, front-loaded with the purpose and followed by the version prerequisite; nothing is padding. The phrasing "organizations counts" is slightly awkward, but the structure is efficient.

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

Completeness3/5

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

For a five-parameter counting tool with no output schema and no annotations, the description is thin: it does not describe what the returned count represents or how the filters compose in the result. The fully documented schema compensates for parameter detail but not for return semantics.

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

Parameters3/5

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

Schema coverage is 100%, with all five parameters documented including the mutual exclusion of 'q' and 'identityProvider'. The description adds nothing beyond the schema, so the baseline of 3 applies.

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 gives a specific verb and resource ("Returns the organizations counts"), making it clearly a counting/aggregation tool rather than a listing tool like list_organizations. It stops short of explicitly differentiating itself from the count_* siblings or stating that it returns a single total rather than records.

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?

There is no guidance on when to call this instead of list_organizations or list_member_organizations, and no note on prerequisites beyond the Keycloak version. The agent must infer from the name alone that this is the right choice when only a number is needed.

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

Deploy Server

Other Tools