get_group_members
Retrieve members of a specific group in Keycloak by providing the group ID, with optional pagination, results limit, and realm parameters.
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
| Name | Required | Description | Default |
|---|---|---|---|
| first | No | ||
| group_id | Yes | ||
| max | No | ||
| realm | No |
Implementation Reference
- src/tools/group_tools.py:140-167 (handler)The main handler function for the 'get_group_members' tool. It is decorated with @mcp.tool() for automatic registration and schema inference from the type hints and docstring. The function retrieves group members from Keycloak using the KeycloakClient, supporting pagination via 'first' and 'max' parameters.@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 )