Skip to main content

fastmcp.utilities.inspect

Utilities for inspecting FastMCP instances.

Functions

inspect_fastmcp_v2

inspect_fastmcp_v2(mcp: FastMCP[Any]) -> FastMCPInfo
Extract information from a FastMCP v2.x instance. Args:
  • mcp: The FastMCP v2.x instance to inspect
Returns:
  • FastMCPInfo dataclass containing the extracted information

inspect_fastmcp_v1

inspect_fastmcp_v1(mcp: FastMCP1x) -> FastMCPInfo
Extract information from a FastMCP v1.x instance using a Client. Args:
  • mcp: The FastMCP v1.x instance to inspect
Returns:
  • FastMCPInfo dataclass containing the extracted information

inspect_fastmcp

inspect_fastmcp(mcp: FastMCP[Any] | FastMCP1x) -> FastMCPInfo
Extract information from a FastMCP instance into a dataclass. This function automatically detects whether the instance is FastMCP v1.x or v2.x and uses the appropriate extraction method. Args:
  • mcp: The FastMCP instance to inspect (v1.x or v2.x)
Returns:
  • FastMCPInfo dataclass containing the extracted information

format_fastmcp_info

format_fastmcp_info(info: FastMCPInfo) -> bytes
Format FastMCPInfo as FastMCP-specific JSON. This includes FastMCP-specific fields like tags, enabled, annotations, etc.

format_mcp_info

format_mcp_info(mcp: FastMCP[Any] | FastMCP1x) -> bytes
Format server info as standard MCP protocol JSON. Uses Client to get the standard MCP protocol format with camelCase fields. Includes version metadata at the top level.

format_info

format_info(mcp: FastMCP[Any] | FastMCP1x, format: InspectFormat | Literal['fastmcp', 'mcp'], info: FastMCPInfo | None = None) -> bytes
Format server information according to the specified format. Args:
  • mcp: The FastMCP instance
  • format: Output format (“fastmcp” or “mcp”)
  • info: Pre-extracted FastMCPInfo (optional, will be extracted if not provided)
Returns:
  • JSON bytes in the requested format

Classes

ToolInfo

Information about a tool.

PromptInfo

Information about a prompt.

ResourceInfo

Information about a resource.

TemplateInfo

Information about a resource template.

FastMCPInfo

Information extracted from a FastMCP instance.

InspectFormat

Output format for inspect command.
I