get_client_by_clientid
Retrieve a specific client object by providing the client ID and optional realm in the mcp-keycloak server for identity and access management.
Instructions
Get a specific client by client ID.
Args:
client_id: The client's client_id
realm: Target realm (uses default if not specified)
Returns:
Client object
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| client_id | Yes | ||
| realm | No |
Implementation Reference
- src/tools/client_tools.py:58-80 (handler)The handler function for the 'get_client_by_clientid' tool, decorated with @mcp.tool() for registration. It retrieves clients filtered by client_id and returns the exact match, or raises an exception if not found.@mcp.tool() async def get_client_by_clientid( client_id: str, realm: Optional[str] = None ) -> Dict[str, Any]: """ Get a specific client by client ID. Args: client_id: The client's client_id realm: Target realm (uses default if not specified) Returns: Client object """ clients = await client._make_request( "GET", "/clients", params={"clientId": client_id}, realm=realm ) if clients and len(clients) > 0: # Find exact match for c in clients: if c.get("clientId") == client_id: return c raise Exception(f"Client with client_id '{client_id}' not found")