Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

list_realm_roles

Retrieve and manage realm roles in Keycloak with pagination, search, and filtering options for identity and access management.

Instructions

List all realm roles.

Args:
    first: Pagination offset
    max: Maximum results size
    search: Search string
    realm: Target realm (uses default if not specified)

Returns:
    List of realm roles

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNo
maxNo
searchNo
realmNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'list_realm_roles' MCP tool. It is decorated with @mcp.tool() for automatic registration and uses KeycloakClient to fetch realm roles with optional pagination and search parameters.
    @mcp.tool()
    async def list_realm_roles(
        first: Optional[int] = None,
        max: Optional[int] = None,
        search: Optional[str] = None,
        realm: Optional[str] = None,
    ) -> List[Dict[str, Any]]:
        """
        List all realm roles.
    
        Args:
            first: Pagination offset
            max: Maximum results size
            search: Search string
            realm: Target realm (uses default if not specified)
    
        Returns:
            List of realm roles
        """
        params = {}
        if first is not None:
            params["first"] = first
        if max is not None:
            params["max"] = max
        if search:
            params["search"] = search
    
        return await client._make_request("GET", "/roles", params=params, realm=realm)
Behavior2/5

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

With no annotations, the description carries full burden but provides minimal behavioral context. It mentions pagination and search parameters but doesn't disclose default behaviors (e.g., what happens if 'realm' is unspecified), rate limits, permission requirements, or whether it's a read-only operation (implied by 'List' but not explicit). The return format is stated but lacks detail on structure or error cases.

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, using bullet-like formatting. It's front-loaded with the core purpose, and each sentence adds value (e.g., explaining parameter roles). However, it could be more concise by integrating parameter explanations into a single sentence or removing redundant phrasing like 'Target realm'.

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 4 parameters with 0% schema coverage and no annotations, the description partially compensates with parameter semantics but lacks behavioral details like authentication needs or error handling. The output schema exists, so return values needn't be explained, but overall completeness is moderate due to missing usage context and transparency for a list operation with multiple parameters.

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?

Schema description coverage is 0%, so the description must compensate. It adds meaningful semantics for all 4 parameters: 'first' as pagination offset, 'max' as maximum results size, 'search' as search string, and 'realm' as target realm with default behavior. This goes beyond schema titles like 'First' and 'Max', providing clear usage context, though it doesn't specify formats (e.g., integer ranges) or search syntax.

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 'List' and resource 'realm roles' with 'all' indicating comprehensive retrieval. It distinguishes from siblings like 'get_realm_role' (singular) and 'list_client_roles' (different resource), but doesn't explicitly differentiate from other list tools like 'list_users' or 'list_groups' beyond the resource name.

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?

No guidance on when to use this tool versus alternatives is provided. It doesn't mention prerequisites (e.g., authentication), compare to similar tools like 'get_user_realm_roles' (user-specific roles), or specify scenarios where pagination/search is needed versus retrieving all roles at once.

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