update_group
Modify Keycloak group details, including name, path, and attributes, with optional realm customization, ensuring accurate identity and access management.
Instructions
Update a group.
Args:
group_id: Group ID
name: New group name
path: New group path
attributes: New group attributes
realm: Target realm (uses default if not specified)
Returns:
Status message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| attributes | No | ||
| group_id | Yes | ||
| name | No | ||
| path | No | ||
| realm | No |
Implementation Reference
- src/tools/group_tools.py:84-121 (handler)The main handler function for the 'update_group' tool. It fetches the current group, updates the provided fields (name, path, attributes), performs a PUT request via KeycloakClient, and returns a success message. Registered via @mcp.tool() decorator.@mcp.tool() async def update_group( group_id: str, name: Optional[str] = None, path: Optional[str] = None, attributes: Optional[Dict[str, List[str]]] = None, realm: Optional[str] = None, ) -> Dict[str, str]: """ Update a group. Args: group_id: Group ID name: New group name path: New group path attributes: New group attributes realm: Target realm (uses default if not specified) Returns: Status message """ # Get current group current_group = await client._make_request( "GET", f"/groups/{group_id}", realm=realm ) # Update only provided fields if name is not None: current_group["name"] = name if path is not None: current_group["path"] = path if attributes is not None: current_group["attributes"] = attributes await client._make_request( "PUT", f"/groups/{group_id}", data=current_group, realm=realm ) return {"status": "updated", "message": f"Group {group_id} updated successfully"}