add_realm_default_group
Assign a default group to a realm in Keycloak by specifying the group ID and optional target realm. Simplifies group management within identity and access systems.
Instructions
Add a default group to the realm.
Args:
group_id: Group ID to add as default
realm: Target realm (uses default if not specified)
Returns:
Status message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| group_id | Yes | ||
| realm | No |
Implementation Reference
- src/tools/realm_tools.py:228-244 (handler)The main handler function for the 'add_realm_default_group' tool. It uses the KeycloakClient to add a group as default via PUT /default-groups/{group_id}. The @mcp.tool() decorator registers it as an MCP tool and infers schema from signature/docstring.@mcp.tool() async def add_realm_default_group( group_id: str, realm: Optional[str] = None ) -> Dict[str, str]: """ Add a default group to the realm. Args: group_id: Group ID to add as default realm: Target realm (uses default if not specified) Returns: Status message """ await client._make_request("PUT", f"/default-groups/{group_id}", realm=realm) return {"status": "added", "message": f"Group {group_id} added as default group"}