Skip to main content
Glama
panther-labs

Panther MCP Server

Official

get_user

Retrieve detailed user information from Panther's security platform by providing a user ID. Returns email, names, role, authentication status, and timestamps for security monitoring and investigation.

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 handler function for the "get_user" MCP tool. It fetches detailed user information from the Panther REST API endpoint `/users/{user_id}`. Handles 404 not found and other errors, returning structured success/failure responses. Input schema defined via Annotated[str, Field(...)] with description and examples. Decorated with @mcp_tool for automatic registration, including permissions.
    @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)}", }
  • Registers all auto-discovered MCP tools (including "get_user") with the FastMCP server instance via register_all_tools(mcp). This is the point where tools become available to the MCP protocol.
    # Note: Dependencies are declared in fastmcp.json for FastMCP v2.14.0+ mcp = FastMCP(MCP_SERVER_NAME, lifespan=lifespan) # Register all tools with MCP using the registry register_all_tools(mcp) # Register all prompts with MCP using the registry register_all_prompts(mcp) # Register all resources with MCP using the registry register_all_resources(mcp)
  • The registry mechanism that collects all @mcp_tool decorated functions and registers them with the MCP server using FastMCP's tool() decorator, preserving name, description, and annotations like permissions.
    def register_all_tools(mcp_instance) -> None: """ Register all tools marked with @mcp_tool with the given MCP instance. Args: mcp_instance: The FastMCP instance to register tools with """ logger.info(f"Registering {len(_tool_registry)} tools with MCP") # Sort tools by name sorted_funcs = sorted(_tool_registry, key=lambda f: f.__name__) for tool in sorted_funcs: logger.debug(f"Registering tool: {tool.__name__}") # Get tool metadata if it exists metadata = getattr(tool, "_mcp_tool_metadata", {}) annotations = metadata.get("annotations", {}) # Create tool decorator with metadata tool_decorator = mcp_instance.tool( name=metadata.get("name"), description=metadata.get("description"), annotations=annotations, ) if annotations and annotations.get("permissions"): if not tool.__doc__: tool.__doc__ = "" tool.__doc__ += f"\n\n Permissions:{annotations.get('permissions')}" # Register the tool tool_decorator(tool) logger.info("All tools registered successfully")

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