Skip to main content
Glama

list_users

Retrieve and filter users in Keycloak realms by username, email, or enabled status. Supports pagination and search for streamlined user management.

Instructions

List users in the realm. Args: first: Pagination offset max: Maximum results size (defaults to 100) search: Search string for username, first/last name, or email username: Username filter email: Email filter enabled: Filter by enabled/disabled users realm: Target realm (uses default if not specified) Returns: List of user objects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailNo
enabledNo
firstNo
maxNo
realmNo
searchNo
usernameNo

Implementation Reference

  • The handler function for the 'list_users' tool. It is decorated with @mcp.tool() which handles registration and schema inference from type hints and docstring. The function builds query parameters and delegates to KeycloakClient._make_request to retrieve the list of users from the Keycloak API.
    @mcp.tool() async def list_users( first: Optional[int] = None, max: Optional[int] = None, search: Optional[str] = None, username: Optional[str] = None, email: Optional[str] = None, enabled: Optional[bool] = None, realm: Optional[str] = None, ) -> List[Dict[str, Any]]: """ List users in the realm. Args: first: Pagination offset max: Maximum results size (defaults to 100) search: Search string for username, first/last name, or email username: Username filter email: Email filter enabled: Filter by enabled/disabled users realm: Target realm (uses default if not specified) Returns: List of user objects """ params = {} if first is not None: params["first"] = first if max is not None: params["max"] = max if search: params["search"] = search if username: params["username"] = username if email: params["email"] = email if enabled is not None: params["enabled"] = str(enabled).lower() return await client._make_request("GET", "/users", params=params, realm=realm)

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