Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

get_client_by_clientid

Retrieve a specific client configuration from Keycloak identity management using its unique client ID. Specify the realm to access client details for authentication and authorization setup.

Instructions

Get a specific client by client ID.

Args:
    client_id: The client's client_id
    realm: Target realm (uses default if not specified)

Returns:
    Client object

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
client_idYes
realmNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function implementing the get_client_by_clientid tool. It is decorated with @mcp.tool() which registers it. Queries Keycloak /clients endpoint filtered by clientId, iterates to find exact match, returns the client dict or raises Exception.
    @mcp.tool()
    async def get_client_by_clientid(
        client_id: str, realm: Optional[str] = None
    ) -> Dict[str, Any]:
        """
        Get a specific client by client ID.
    
        Args:
            client_id: The client's client_id
            realm: Target realm (uses default if not specified)
    
        Returns:
            Client object
        """
        clients = await client._make_request(
            "GET", "/clients", params={"clientId": client_id}, realm=realm
        )
        if clients and len(clients) > 0:
            # Find exact match
            for c in clients:
                if c.get("clientId") == client_id:
                    return c
        raise Exception(f"Client with client_id '{client_id}' not found")
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states this is a read operation ('Get'), which is clear, but lacks critical behavioral details: whether it requires authentication, rate limits, error handling (e.g., if client_id doesn't exist), or what 'Client object' contains. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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 appropriately sized with a clear purpose statement followed by Args and Returns sections. Each sentence earns its place, though the 'Returns' line is somewhat vague ('Client object'). It's front-loaded with the core functionality, making it easy to scan.

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 tool's moderate complexity (2 parameters, no annotations, but has output schema), the description is partially complete. It covers the basic purpose and parameters but lacks behavioral context (auth, errors) and doesn't leverage the output schema to explain return values. For a read operation with siblings, more guidance would improve completeness.

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 0%, so the description must compensate. It adds meaning by explaining 'client_id' identifies the client and 'realm' is optional with default behavior. However, it doesn't clarify parameter formats (e.g., string patterns), what 'default' realm means, or provide examples. With 2 parameters and low schema coverage, this is minimal but adequate baseline.

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 tool's purpose with 'Get a specific client by client ID', specifying both the verb ('Get') and resource ('client'). It distinguishes from siblings like 'get_client' (which likely has different parameters) and 'list_clients' (which returns multiple clients). However, it doesn't explicitly contrast with 'get_client' which might be a similar lookup tool.

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

Usage Guidelines3/5

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

The description implies usage when you need a specific client identified by client_id, but provides no explicit guidance on when to use this vs. alternatives like 'get_client' (which might use different identifiers) or 'list_clients' (for multiple clients). The realm parameter description hints at default behavior but doesn't clarify edge cases or prerequisites.

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