Skip to main content
Glama
mrz1880

mcp-keycloak-admin

Assign a client role to a user

keycloak_user_client_role_assign
Idempotent

Assign a specific client-level role to a Keycloak user. Idempotent operation uses user UUID, client UUID, and role name.

Instructions

Write: grants a single client-level role (belonging to one specific client) to a user, not a realm role. This is idempotent — assigning a role the user already has succeeds without changing anything. The role must already exist on the client; list candidates with keycloak_client_roles_list and verify current assignments with keycloak_user_client_roles_get. Returns a confirmation that the client role was assigned, or a message explaining why it was not (for example, the user, client, or role was not found).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
roleYesThe name of an existing client role to grant (e.g. 'manage-users'), as returned by keycloak_client_roles_list. 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 who receives the client role.
clientIdYesThe Keycloak client's internal ID (the client's UUID), not the human-readable clientId/client name. Identifies the client that owns the role being granted.
Behavior4/5

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

The description complements the annotations by detailing the return behavior (confirmation or explanation for failure) and confirming idempotency. While it lacks explicit mention of error handling (e.g., exceptions), it sufficiently discloses what happens when the user, client, or role is not found. Annotations already mark it as non-destructive and idempotent, so the description adds value without contradiction.

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 three sentences long, each earning its place. The first sentence states the core purpose and distinction, the second explains idempotency, and the third covers return behavior. No extraneous information, and the most important facts are front-loaded.

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?

Given the tool's low complexity (three required parameters, no output schema, no nested objects), the description covers all essential aspects: purpose, scope, idempotency, prerequisites, failure cases, and return value. It also references sibling tools for listing and verification. No gaps remain for an agent to use this tool correctly.

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?

With 100% schema coverage, the schema already documents all three parameters thoroughly. The description adds contextual value by explaining idempotency and the prerequisite that the role must exist, plus useful cross-references to sibling tools. This extra context justifies a score above the baseline of 3.

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?

The description clearly states the tool grants a single client-level role to a user, explicitly distinguishing it from realm roles. The title 'Assign a client role to a user' and the first sentence provide a specific verb-resource pair, and the sibling context includes both keycloak_user_role_assign (realm roles) and keycloak_user_client_role_unassign, making differentiation clear.

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?

The description explicitly says when to use (for client-level roles, not realm roles) and provides concrete pre- and post-steps: list candidates with keycloak_client_roles_list and verify with keycloak_user_client_roles_get. It also notes the role must already exist and that the operation is idempotent, guiding proper usage.

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

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/mrz1880/mcp-keycloak-admin'

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