Skip to main content
Glama
panther-labs

Panther MCP Server

Official

get_user

Retrieve comprehensive user data including email, names, role, and authentication status by providing a user ID. Requires 'Read User Info' permission.

Instructions

Get detailed information about a Panther user by ID

Returns complete user information including email, names, role, authentication status, and timestamps.

Permissions:{'all_of': ['Read User Info']}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYesThe ID of the user to fetch

Implementation Reference

  • The core implementation of the 'get_user' MCP tool. The @mcp_tool decorator registers the tool with the MCP framework, defines permissions annotations, provides input schema via Pydantic's Annotated and Field for the user_id parameter, and the function body handles API calls to fetch user details, with proper error handling for 404 and other exceptions.
    @mcp_tool( annotations={ "permissions": all_perms(Permission.USER_READ), "readOnlyHint": True, } ) async def get_user( user_id: Annotated[ str, Field( description="The ID of the user to fetch", examples=["user-123", "john.doe@company.com", "<admin@example.com>"], ), ], ) -> dict[str, Any]: """Get detailed information about a Panther user by ID Returns complete user information including email, names, role, authentication status, and timestamps. """ logger.info(f"Fetching user details for user ID: {user_id}") try: async with get_rest_client() as client: # Allow 404 as a valid response to handle not found case result, status = await client.get( f"/users/{user_id}", expected_codes=[200, 404] ) if status == 404: logger.warning(f"No user found with ID: {user_id}") return { "success": False, "message": f"No user found with ID: {user_id}", } logger.info(f"Successfully retrieved user details for user ID: {user_id}") return {"success": True, "user": result} except Exception as e: logger.error(f"Failed to get user details: {str(e)}") return { "success": False, "message": f"Failed to get user details: {str(e)}", }
  • The call to register_all_tools(mcp) in the main server file, which iterates over all decorated tools (including get_user) and registers them with the FastMCP instance.
    register_all_tools(mcp)
  • The mcp_tool decorator used to mark and collect tools for registration, and the register_all_tools function that performs the actual MCP server registration for all tools.
    def mcp_tool( func: Optional[Callable] = None, *, name: Optional[str] = None, description: Optional[str] = None, annotations: Optional[Dict[str, Any]] = None, ) -> Callable: """ Decorator to mark a function as an MCP tool. Functions decorated with this will be automatically registered when register_all_tools() is called. Can be used in two ways: 1. Direct decoration: @mcp_tool def my_tool(): ... 2. With parameters: @mcp_tool( name="custom_name", description="Custom description", annotations={"category": "data_analysis"} ) def my_tool(): ... Args: func: The function to decorate name: Optional custom name for the tool. If not provided, uses the function name. description: Optional description of what the tool does. If not provided, uses the function's docstring. annotations: Optional dictionary of additional annotations for the tool. """ def decorator(func: Callable) -> Callable: # Store metadata on the function func._mcp_tool_metadata = { "name": name, "description": description, "annotations": annotations, } _tool_registry.add(func) @wraps(func) def wrapper(*args, **kwargs): return func(*args, **kwargs) return wrapper # Handle both @mcp_tool and @mcp_tool(...) cases if func is None: return decorator return decorator(func)

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/panther-labs/mcp-panther'

If you have feedback or need assistance with the MCP directory API, please join our Discord server