Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

list_clients

Retrieve and filter client applications from a Keycloak realm to manage access control and permissions.

Instructions

List clients in the realm.

Args:
    client_id: Filter by client ID (partial match)
    viewable_only: Only return viewable clients
    first: Pagination offset
    max: Maximum results size
    realm: Target realm (uses default if not specified)

Returns:
    List of client objects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
client_idNo
viewable_onlyNo
firstNo
maxNo
realmNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'list_clients' MCP tool. It is decorated with @mcp.tool() for registration and implements the logic to list Keycloak clients with optional filtering, pagination, and realm specification using the KeycloakClient instance.
    @mcp.tool()
    async def list_clients(
        client_id: Optional[str] = None,
        viewable_only: bool = False,
        first: Optional[int] = None,
        max: Optional[int] = None,
        realm: Optional[str] = None,
    ) -> List[Dict[str, Any]]:
        """
        List clients in the realm.
    
        Args:
            client_id: Filter by client ID (partial match)
            viewable_only: Only return viewable clients
            first: Pagination offset
            max: Maximum results size
            realm: Target realm (uses default if not specified)
    
        Returns:
            List of client objects
        """
        params = {}
        if client_id:
            params["clientId"] = client_id
        if viewable_only:
            params["viewableOnly"] = "true"
        if first is not None:
            params["first"] = first
        if max is not None:
            params["max"] = max
    
        return await client._make_request("GET", "/clients", params=params, realm=realm)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions filtering and pagination parameters, it doesn't describe important behavioral traits like whether this requires authentication, what permissions are needed, whether results are paginated by default, what happens when no realm is specified, or the structure of returned client objects. The description provides basic functional information but lacks critical operational context.

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 and appropriately sized. It begins with the core purpose statement, then provides a clean parameter section with clear explanations, and ends with the return statement. Every sentence earns its place, though the 'Returns' section is somewhat redundant given the existence of an output schema. The structure is efficient and front-loaded.

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 (5 parameters, list operation) and the presence of an output schema, the description is adequate but has gaps. It covers parameters well and the output schema will handle return values, but it lacks behavioral context about authentication, permissions, pagination behavior, and error conditions. For a list operation with filtering capabilities, more operational guidance would be helpful.

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 0% schema description coverage, the description must compensate by explaining parameters, which it does effectively. It clearly documents all 5 parameters with brief but meaningful explanations: 'client_id: Filter by client ID (partial match)', 'viewable_only: Only return viewable clients', 'first: Pagination offset', 'max: Maximum results size', and 'realm: Target realm (uses default if not specified)'. This adds substantial value beyond the bare schema.

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 ('clients in the realm'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from sibling tools like 'get_client' or 'get_client_by_clientid', which appear to retrieve individual clients rather than lists. The purpose is clear but lacks sibling differentiation.

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. With sibling tools like 'get_client', 'get_client_by_clientid', and 'list_users' available, there's no indication of when listing clients is preferred over retrieving individual clients or when to use this versus other list operations. No usage context or exclusions are mentioned.

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