get_realm_role
Retrieve a specific realm role by name from Keycloak identity and access management. Specify the role name and optionally the target realm to obtain the role object.
Instructions
Get a specific realm role by name.
Args:
role_name: Role name
realm: Target realm (uses default if not specified)
Returns:
Role object
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| realm | No | ||
| role_name | Yes |
Implementation Reference
- src/tools/role_tools.py:39-51 (handler)The @mcp.tool()-decorated async function implementing the get_realm_role tool. It fetches the specific realm role by name using the KeycloakClient._make_request method to perform a GET request to /roles/{role_name} endpoint.@mcp.tool() async def get_realm_role(role_name: str, realm: Optional[str] = None) -> Dict[str, Any]: """ Get a specific realm role by name. Args: role_name: Role name realm: Target realm (uses default if not specified) Returns: Role object """ return await client._make_request("GET", f"/roles/{role_name}", realm=realm)