Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

list_groups

Retrieve groups from Keycloak realms with pagination and search filters to manage user access and organization structures.

Instructions

List all groups in the realm.

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

Returns:
    List of groups

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNo
maxNo
searchNo
realmNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'list_groups' tool handler function, including the @mcp.tool() decorator which handles registration and schema via type annotations and docstring. This implements the core logic to list Keycloak groups using the KeycloakClient.
    @mcp.tool()
    async def list_groups(
        first: Optional[int] = None,
        max: Optional[int] = None,
        search: Optional[str] = None,
        realm: Optional[str] = None,
    ) -> List[Dict[str, Any]]:
        """
        List all groups in the realm.
    
        Args:
            first: Pagination offset
            max: Maximum results size
            search: Search string
            realm: Target realm (uses default if not specified)
    
        Returns:
            List of groups
        """
        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", "/groups", params=params, realm=realm)
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks behavioral details. It mentions pagination and search parameters but doesn't disclose rate limits, authentication needs, error conditions, or whether it's read-only (implied by 'List' but not explicit).

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 (Args, Returns) and front-loaded purpose. It's concise with no wasted sentences, though minor improvements like merging 'List all groups in the realm' with the Args section could make it tighter.

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 an output schema (returns 'List of groups'), the description adequately covers parameter semantics but lacks behavioral context (e.g., permissions, errors). It's minimally viable but has clear gaps for a read operation tool.

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 description adds meaningful context for all 4 parameters (first, max, search, realm) beyond the 0% schema coverage, explaining their purposes like 'Pagination offset' and 'Target realm'. However, it doesn't specify units (e.g., max in items) or constraints (e.g., realm format), keeping it from a 5.

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 ('all groups in the realm'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_group' or 'get_user_groups', which would require a 5.

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 is provided on when to use this tool versus alternatives like 'get_group' (for single groups) or 'get_user_groups' (for groups of a specific user). The description only states what it does, not when it's appropriate.

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