delete_user
Remove a user account from Keycloak identity management by specifying the user ID and optional realm to maintain system security and access control.
Instructions
Delete a user.
Args:
user_id: The user's ID
realm: Target realm (uses default if not specified)
Returns:
Status message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes | ||
| realm | No |
Implementation Reference
- src/tools/user_tools.py:174-187 (handler)The main handler function for the 'delete_user' tool. It is decorated with @mcp.tool() which likely registers it as an MCP tool. The function deletes the specified user from the Keycloak realm using the KeycloakClient.@mcp.tool() async def delete_user(user_id: str, realm: Optional[str] = None) -> Dict[str, str]: """ Delete a user. Args: user_id: The user's ID realm: Target realm (uses default if not specified) Returns: Status message """ await client._make_request("DELETE", f"/users/{user_id}", realm=realm) return {"status": "deleted", "message": f"User {user_id} deleted successfully"}