Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

get_group_members

Retrieve members of a Keycloak group to manage access control and permissions. Supports pagination and realm specification for efficient user management.

Instructions

Get members of a group.

Args:
    group_id: Group ID
    first: Pagination offset
    max: Maximum results size
    realm: Target realm (uses default if not specified)

Returns:
    List of group members

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
group_idYes
firstNo
maxNo
realmNo

Implementation Reference

  • The main handler function for the 'get_group_members' tool. It is decorated with @mcp.tool() which registers it as an MCP tool. The function fetches members of a specified group from Keycloak using the KeycloakClient, supporting pagination and realm specification. The docstring provides the input schema description.
    @mcp.tool()
    async def get_group_members(
        group_id: str,
        first: Optional[int] = None,
        max: Optional[int] = None,
        realm: Optional[str] = None,
    ) -> List[Dict[str, Any]]:
        """
        Get members of a group.
    
        Args:
            group_id: Group ID
            first: Pagination offset
            max: Maximum results size
            realm: Target realm (uses default if not specified)
    
        Returns:
            List of group members
        """
        params = {}
        if first is not None:
            params["first"] = first
        if max is not None:
            params["max"] = max
    
        return await client._make_request(
            "GET", f"/groups/{group_id}/members", 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