Skip to main content
Glama

list_realm_roles

Retrieve a list of realm roles with pagination, search, and realm-specific filtering options for efficient Keycloak role management.

Instructions

List all realm roles. Args: first: Pagination offset max: Maximum results size search: Search string realm: Target realm (uses default if not specified) Returns: List of realm roles

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstNo
maxNo
realmNo
searchNo

Implementation Reference

  • The handler function for the list_realm_roles tool, decorated with @mcp.tool() which also handles registration. It constructs query parameters for pagination and search, then calls the Keycloak client's request method to fetch realm roles.
    @mcp.tool() async def list_realm_roles( first: Optional[int] = None, max: Optional[int] = None, search: Optional[str] = None, realm: Optional[str] = None, ) -> List[Dict[str, Any]]: """ List all realm roles. Args: first: Pagination offset max: Maximum results size search: Search string realm: Target realm (uses default if not specified) Returns: List of realm roles """ params = {} if first is not None: params["first"] = first if max is not None: params["max"] = max if search: params["search"] = search return await client._make_request("GET", "/roles", params=params, realm=realm)
  • Import of role_tools module in tools __init__.py, which executes the @mcp.tool() decorators to register the list_realm_roles tool among others.
    from . import role_tools

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