Skip to main content
Glama

create_client_role

Create a new client role in Keycloak to define permissions and access controls for specific applications within your identity management system.

Instructions

Create a new client role. Args: client_id: Client database ID name: Role name description: Role description composite: Whether this is a composite role realm: Target realm (uses default if not specified) Returns: Status message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
client_idYes
nameYes
descriptionNo
compositeNo
realmNo

Implementation Reference

  • The core handler function for the 'create_client_role' tool, decorated with @mcp.tool() for automatic registration and schema inference. It constructs role data and makes a POST request to Keycloak's client roles endpoint using the KeycloakClient helper.
    @mcp.tool() async def create_client_role( client_id: str, name: str, description: Optional[str] = None, composite: bool = False, realm: Optional[str] = None, ) -> Dict[str, str]: """ Create a new client role. Args: client_id: Client database ID name: Role name description: Role description composite: Whether this is a composite role realm: Target realm (uses default if not specified) Returns: Status message """ role_data = {"name": name, "composite": composite, "clientRole": True} if description: role_data["description"] = description await client._make_request( "POST", f"/clients/{client_id}/roles", data=role_data, realm=realm ) return {"status": "created", "message": f"Client role {name} created 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