Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

update_realm_role

Modify realm role attributes like description and composite status in Keycloak identity management to adjust access control configurations.

Instructions

Update a realm role.

Args:
    role_name: Current role name
    description: New description
    composite: Whether this is a composite role
    realm: Target realm (uses default if not specified)

Returns:
    Status message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
role_nameYes
descriptionNo
compositeNo
realmNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'update_realm_role' MCP tool. It fetches the current role, updates specified fields (description or composite), performs a PUT request via KeycloakClient, and returns a success message.
    @mcp.tool()
    async def update_realm_role(
        role_name: str,
        description: Optional[str] = None,
        composite: Optional[bool] = None,
        realm: Optional[str] = None,
    ) -> Dict[str, str]:
        """
        Update a realm role.
    
        Args:
            role_name: Current role name
            description: New description
            composite: Whether this is a composite role
            realm: Target realm (uses default if not specified)
    
        Returns:
            Status message
        """
        # Get current role
        current_role = await client._make_request("GET", f"/roles/{role_name}", realm=realm)
    
        # Update only provided fields
        if description is not None:
            current_role["description"] = description
        if composite is not None:
            current_role["composite"] = composite
    
        await client._make_request(
            "PUT", f"/roles/{role_name}", data=current_role, realm=realm
        )
        return {
            "status": "updated",
            "message": f"Realm role {role_name} updated successfully",
        }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is an update operation, implying mutation, but doesn't describe what happens during the update (e.g., whether it overwrites all fields or merges changes), what permissions are required, whether changes are reversible, or any rate limits or side effects. The return statement mentions a 'status message' but gives no details about success/error formats or what to expect.

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?

The description is well-structured with clear sections for Args and Returns, making it easy to parse. It's front-loaded with the core purpose ('Update a realm role.'), and each sentence adds value without redundancy. However, the 'Returns' section is somewhat vague ('Status message'), which slightly reduces efficiency.

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?

Given the complexity of a mutation tool with 4 parameters, no annotations, and an output schema (which likely covers return values), the description is moderately complete. It explains the purpose and parameters well, but lacks behavioral details like permissions, side effects, or error handling. The output schema existence means the description doesn't need to detail return values, but other gaps remain for a tool that modifies security roles.

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 schema description coverage is 0%, so the description must compensate. It provides clear semantic explanations for all four parameters: 'role_name' as the current role name (identifying what to update), 'description' as the new description, 'composite' as whether this is a composite role, and 'realm' as the target realm with default behavior. This adds meaningful context beyond the bare schema, though it doesn't explain format constraints or the implications of 'composite'.

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 ('Update') and resource ('a realm role'), making the purpose unambiguous. It distinguishes this tool from other realm role tools like 'create_realm_role' and 'delete_realm_role' by focusing on modification rather than creation or deletion. However, it doesn't explicitly differentiate from other update tools like 'update_client' or 'update_user' beyond the resource type.

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. It doesn't mention prerequisites (e.g., needing an existing role), compare to similar tools like 'update_client' or 'update_user', or specify scenarios where this tool is appropriate versus when other tools might be better. The only implicit guidance is that it updates realm roles, but no explicit usage context is provided.

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

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