Skip to main content
Glama
mcp-keycloak-admin

mcp-keycloak-admin

by mrz1880

Remove a realm role from a user

keycloak_user_role_unassign
Destructive

Revoke a specific realm-level role from a Keycloak user. Requires explicit confirmation to proceed; use after viewing current roles to avoid accidental removal.

Instructions

Destructive write: revokes a single realm-level role from a user (not a client role), removing the access that role grants. This action requires explicit confirmation and will not proceed unless 'confirm' is true. Use keycloak_user_roles_get first to see the user's current realm roles; for client-scoped roles use keycloak_user_client_role_unassign instead. Returns a confirmation that the role was removed, or a message explaining why it was not (for example, confirmation was declined or the user or role was not found).

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": {
      "userId": "<userId>",
      "role": "<role>"
    },
    "name": "keycloak_user_role_unassign"
  }
}

Input Schema

NameRequiredDescriptionDefault
roleYesThe name of the realm role to revoke (e.g. 'admin'), as shown by keycloak_user_roles_get. This is the role name, not its ID.
userIdYesThe Keycloak user ID (the user's UUID, e.g. 'f47ac10b-58cc-4372-a567-0e02b2c3d479'), not the username. Identifies the user the role is removed from.
confirmNoExplicit confirmation gate for this destructive removal. Must be set to true to actually revoke the role; if omitted or false, the operation is declined and no change is made.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.1.2
    • addedInput schema / properties / confirm / description
      Added value: +"Explicit confirmation gate for this destructive removal. Must be set to true to actually revoke the role; if omitted or false, the operation is declined and no change is made."
    • addedInput schema / properties / role / description
      Added value: +"The name of the realm role to revoke (e.g. 'admin'), as shown by keycloak_user_roles_get. This is the role name, not its ID."
    • addedInput schema / properties / userId / description
      Added value: +"The Keycloak user ID (the user's UUID, e.g. 'f47ac10b-58cc-4372-a567-0e02b2c3d479'), not the username. Identifies the user the role is removed from."
  2. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations declare destructiveHint=true and readOnlyHint=false; description adds that explicit confirmation is required (confirm=true) and explains return values, going beyond annotations.

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?

Two sentences cover purpose, usage, behavior, and return. Front-loaded with key information, no wasted words.

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

Completeness5/5

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

No output schema exists, but description explains return values. Covers all needed context: purpose, prerequisites, alternatives, confirmation gate, and error cases.

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 provides full descriptions for all 3 parameters. Description reiterates the confirmation requirement but adds no new semantic detail beyond what is already in the schema.

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

Purpose5/5

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

Clearly states it revokes a single realm-level role from a user, differentiating from client roles and using a specific verb (revokes) and resource (realm-level role).

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

Usage Guidelines5/5

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

Explicitly advises using keycloak_user_roles_get first and directs to keycloak_user_client_role_unassign for client roles, providing clear when-to-use and alternatives.

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