Skip to main content
Glama
Keycloak MCP Server

Keycloak MCP Server

by Cayetano97

add_organization_group_realm_role_mappings

Adds realm-level role mappings to an organization group’s users in Keycloak; requires Keycloak 26.7+.

Instructions

Add realm-level role mappings to the user. Requires Keycloak 26.7+.

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>",
      "org_id": "<org_id>",
      "group_id": "<group_id>",
      "roles": "<roles>"
    },
    "name": "add_organization_group_realm_role_mappings"
  }
}

Input Schema

NameRequiredDescriptionDefault
realmYesRealm name
rolesYesList of role representations
org_idYesOrganization ID
group_idYesOrganization group ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

C2.6/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full disclosure burden and largely drops it. It does not say whether the operation is additive or replace-existing, whether it is idempotent when a role is already mapped, what happens if the group or role does not exist, or what permissions (auth requirements) are needed. Only the Keycloak version floor adds any behavioral context.

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 with no filler, and the actionable information is front-loaded. It is efficient, though the second sentence's content is partially inaccurate rather than merely terse.

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?

For a mutation tool with four required parameters, a nested roles object, no annotations and no output schema, the definition is thin. It never clarifies the expected shape of the "role representations" nor the failure behavior, leaving the agent largely dependent on the name and schema.

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 description coverage is 100%, so all four parameters are documented there and the baseline is 3. The description adds no syntax or semantic detail for the nested roles object, and its reference to a "user" introduces a target that does not correspond to any parameter.

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

Purpose3/5

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

The verb+resource ("Add realm-level role mappings") is clear, but the stated target "to the user" is wrong for a tool whose required parameters are realm, org_id and group_id. An agent reading only the description would look for a user identifier that does not exist in the schema, so the purpose is recognizable from the name but actively blurred by the text.

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 only guidance is a version prerequisite ("Requires Keycloak 26.7+"). There is no statement of when to use this versus siblings such as add_group_realm_role_mappings, add_organization_group_client_role_mappings, or the get_* variants that inspect existing mappings.

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