create_group
Create a new group in Keycloak with specified name, path, attributes, and optional target realm. Returns a status message upon completion.
Instructions
Create a new group.
Args:
name: Group name
path: Group path
attributes: Group attributes
realm: Target realm (uses default if not specified)
Returns:
Status message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| attributes | No | ||
| name | Yes | ||
| path | No | ||
| realm | No |
Implementation Reference
- src/tools/group_tools.py:54-82 (handler)The handler function for the 'create_group' tool. It is decorated with @mcp.tool() for registration and uses KeycloakClient to create a new group by sending a POST request to the Keycloak API.@mcp.tool() async def create_group( name: str, path: Optional[str] = None, attributes: Optional[Dict[str, List[str]]] = None, realm: Optional[str] = None, ) -> Dict[str, str]: """ Create a new group. Args: name: Group name path: Group path attributes: Group attributes realm: Target realm (uses default if not specified) Returns: Status message """ group_data = {"name": name} if path: group_data["path"] = path if attributes: group_data["attributes"] = attributes await client._make_request("POST", "/groups", data=group_data, realm=realm) return {"status": "created", "message": f"Group {name} created successfully"}