get_user
Retrieve a specific user's details by ID from Keycloak identity management, optionally specifying a realm for targeted access.
Instructions
Get a specific user by ID.
Args:
user_id: The user's ID
realm: Target realm (uses default if not specified)
Returns:
User object
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes | ||
| realm | No |
Implementation Reference
- src/tools/user_tools.py:51-63 (handler)The main handler for the 'get_user' MCP tool. It is decorated with @mcp.tool() which registers it with the MCP server using the function name as the tool name. The function retrieves a specific user by ID from the Keycloak realm.@mcp.tool() async def get_user(user_id: str, realm: Optional[str] = None) -> Dict[str, Any]: """ Get a specific user by ID. Args: user_id: The user's ID realm: Target realm (uses default if not specified) Returns: User object """ return await client._make_request("GET", f"/users/{user_id}", realm=realm)