Skip to main content
Glama

get_user_sessions

Retrieve active user sessions with a specified user ID and optional realm from the mcp-keycloak server to monitor access and manage authentication.

Instructions

Get active sessions for a user. Args: user_id: The user's ID realm: Target realm (uses default if not specified) Returns: List of active sessions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
realmNo
user_idYes

Implementation Reference

  • The primary handler function for the 'get_user_sessions' tool. It is decorated with @mcp.tool() for automatic registration and uses the KeycloakClient to fetch user sessions from the Keycloak API.
    @mcp.tool() async def get_user_sessions( user_id: str, realm: Optional[str] = None ) -> List[Dict[str, Any]]: """ Get active sessions for a user. Args: user_id: The user's ID realm: Target realm (uses default if not specified) Returns: List of active sessions """ return await client._make_request("GET", f"/users/{user_id}/sessions", 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