Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

update_group

Modify Keycloak group details like name, path, or attributes to manage user access and permissions.

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
NameRequiredDescriptionDefault
group_idYes
nameNo
pathNo
attributesNo
realmNo

Implementation Reference

  • The primary handler for the 'update_group' MCP tool. Decorated with @mcp.tool() for automatic registration and schema inference from type hints and documentation. Executes partial updates to a Keycloak group by fetching current state and applying changes via API calls.
    @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"}

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