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

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)

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