Fix documentation to use 'meta' instead of '_meta' for MCP spec field (#2735)

This commit is contained in:
Jeremiah Lowin 2025-12-25 21:05:11 -05:00 committed by GitHub
commit 4de06d7f73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 24 additions and 24 deletions

View file

@ -324,7 +324,7 @@ mcp = FastMCP.from_openapi(
#### OpenAPI Tags in Client Meta
FastMCP automatically includes OpenAPI tags from your specification in the component's metadata. These tags are available to MCP clients through the `_meta._fastmcp.tags` field, allowing clients to filter and organize components based on the original OpenAPI tagging:
FastMCP automatically includes OpenAPI tags from your specification in the component's metadata. These tags are available to MCP clients through the `meta._fastmcp.tags` field, allowing clients to filter and organize components based on the original OpenAPI tagging:
<CodeGroup>
```json {5} OpenAPI spec with tags
@ -344,9 +344,9 @@ FastMCP automatically includes OpenAPI tags from your specification in the compo
async with client:
tools = await client.list_tools()
for tool in tools:
if hasattr(tool, '_meta') and tool._meta:
if tool.meta:
# OpenAPI tags are now available in _fastmcp namespace!
fastmcp_meta = tool._meta.get('_fastmcp', {})
fastmcp_meta = tool.meta.get('_fastmcp', {})
openapi_tags = fastmcp_meta.get('tags', [])
if 'users' in openapi_tags:
print(f"Found user-related tool: {tool.name}")