From 83b20d56123ee7948312fa05056c473547111ce4 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Thu, 25 Dec 2025 20:58:49 -0500 Subject: [PATCH] Fix documentation to use 'meta' instead of '_meta' for MCP spec field --- docs/clients/prompts.mdx | 12 ++++++------ docs/clients/resources.mdx | 16 ++++++++-------- docs/clients/tools.mdx | 4 ++-- docs/integrations/openapi.mdx | 6 +++--- docs/servers/prompts.mdx | 4 ++-- docs/servers/resources.mdx | 4 ++-- docs/servers/tools.mdx | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/clients/prompts.mdx b/docs/clients/prompts.mdx index a6d6e155be..1c05b75b3f 100644 --- a/docs/clients/prompts.mdx +++ b/docs/clients/prompts.mdx @@ -26,8 +26,8 @@ async with client: if prompt.arguments: print(f"Arguments: {[arg.name for arg in prompt.arguments]}") # Access tags and other metadata - if hasattr(prompt, '_meta') and prompt._meta: - fastmcp_meta = prompt._meta.get('_fastmcp', {}) + if prompt.meta: + fastmcp_meta = prompt.meta.get('_fastmcp', {}) print(f"Tags: {fastmcp_meta.get('tags', [])}") ``` @@ -44,16 +44,16 @@ async with client: # Filter prompts by tag analysis_prompts = [ prompt for prompt in prompts - if hasattr(prompt, '_meta') and prompt._meta and - prompt._meta.get('_fastmcp', {}) and - 'analysis' in prompt._meta.get('_fastmcp', {}).get('tags', []) + if prompt.meta and + prompt.meta.get('_fastmcp', {}) and + 'analysis' in prompt.meta.get('_fastmcp', {}).get('tags', []) ] print(f"Found {len(analysis_prompts)} analysis prompts") ``` -The `_meta` field is part of the standard MCP specification. FastMCP servers include tags and other metadata within a `_fastmcp` namespace (e.g., `_meta._fastmcp.tags`) to avoid conflicts with user-defined metadata. This behavior can be controlled with the server's `include_fastmcp_meta` setting - when disabled, the `_fastmcp` namespace won't be included. Other MCP server implementations may not provide this metadata structure. +The `meta` field is part of the standard MCP specification. FastMCP servers include tags and other metadata within a `_fastmcp` namespace (e.g., `meta._fastmcp.tags`) to avoid conflicts with user-defined metadata. This behavior can be controlled with the server's `include_fastmcp_meta` setting - when disabled, the `_fastmcp` namespace won't be included. Other MCP server implementations may not provide this metadata structure. ## Using Prompts diff --git a/docs/clients/resources.mdx b/docs/clients/resources.mdx index b5120fdf1c..22ebafab81 100644 --- a/docs/clients/resources.mdx +++ b/docs/clients/resources.mdx @@ -35,8 +35,8 @@ async with client: print(f"Description: {resource.description}") print(f"MIME Type: {resource.mimeType}") # Access tags and other metadata - if hasattr(resource, '_meta') and resource._meta: - fastmcp_meta = resource._meta.get('_fastmcp', {}) + if resource.meta: + fastmcp_meta = resource.meta.get('_fastmcp', {}) print(f"Tags: {fastmcp_meta.get('tags', [])}") ``` @@ -54,8 +54,8 @@ async with client: print(f"Name: {template.name}") print(f"Description: {template.description}") # Access tags and other metadata - if hasattr(template, '_meta') and template._meta: - fastmcp_meta = template._meta.get('_fastmcp', {}) + if template.meta: + fastmcp_meta = template.meta.get('_fastmcp', {}) print(f"Tags: {fastmcp_meta.get('tags', [])}") ``` @@ -72,16 +72,16 @@ async with client: # Filter resources by tag config_resources = [ resource for resource in resources - if hasattr(resource, '_meta') and resource._meta and - resource._meta.get('_fastmcp', {}) and - 'config' in resource._meta.get('_fastmcp', {}).get('tags', []) + if resource.meta and + resource.meta.get('_fastmcp', {}) and + 'config' in resource.meta.get('_fastmcp', {}).get('tags', []) ] print(f"Found {len(config_resources)} config resources") ``` -The `_meta` field is part of the standard MCP specification. FastMCP servers include tags and other metadata within a `_fastmcp` namespace (e.g., `_meta._fastmcp.tags`) to avoid conflicts with user-defined metadata. This behavior can be controlled with the server's `include_fastmcp_meta` setting - when disabled, the `_fastmcp` namespace won't be included. Other MCP server implementations may not provide this metadata structure. +The `meta` field is part of the standard MCP specification. FastMCP servers include tags and other metadata within a `_fastmcp` namespace (e.g., `meta._fastmcp.tags`) to avoid conflicts with user-defined metadata. This behavior can be controlled with the server's `include_fastmcp_meta` setting - when disabled, the `_fastmcp` namespace won't be included. Other MCP server implementations may not provide this metadata structure. ## Reading Resources diff --git a/docs/clients/tools.mdx b/docs/clients/tools.mdx index 372905bc53..4d7ebabc4e 100644 --- a/docs/clients/tools.mdx +++ b/docs/clients/tools.mdx @@ -26,7 +26,7 @@ async with client: if tool.inputSchema: print(f"Parameters: {tool.inputSchema}") # Access tags and other metadata - if hasattr(tool, 'meta') and tool.meta: + if tool.meta: fastmcp_meta = tool.meta.get('_fastmcp', {}) print(f"Tags: {fastmcp_meta.get('tags', [])}") ``` @@ -44,7 +44,7 @@ async with client: # Filter tools by tag analysis_tools = [ tool for tool in tools - if hasattr(tool, 'meta') and tool.meta and + if tool.meta and tool.meta.get('_fastmcp', {}) and 'analysis' in tool.meta.get('_fastmcp', {}).get('tags', []) ] diff --git a/docs/integrations/openapi.mdx b/docs/integrations/openapi.mdx index ed102986a2..7eceea4077 100644 --- a/docs/integrations/openapi.mdx +++ b/docs/integrations/openapi.mdx @@ -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: ```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}") diff --git a/docs/servers/prompts.mdx b/docs/servers/prompts.mdx index 1e1df2fad3..bc9933959f 100644 --- a/docs/servers/prompts.mdx +++ b/docs/servers/prompts.mdx @@ -107,7 +107,7 @@ def data_analysis_prompt( - Optional meta information about the prompt. This data is passed through to the MCP client as the `_meta` field of the client-side prompt object and can be used for custom metadata, versioning, or other application-specific purposes. + Optional meta information about the prompt. This data is passed through to the MCP client as the `meta` field of the client-side prompt object and can be used for custom metadata, versioning, or other application-specific purposes. @@ -241,7 +241,7 @@ def code_review(code: str) -> PromptResult: **`description`** - Optional description of the prompt result. If not provided, defaults to the prompt's docstring. -**`meta`** - Optional metadata dictionary that will be included in the MCP response's `_meta` field. Use this for runtime metadata like categorization, priority, or other client-specific data. +**`meta`** - Optional metadata dictionary that will be included in the MCP response's `meta` field. Use this for runtime metadata like categorization, priority, or other client-specific data. The `meta` field in `PromptResult` is for runtime metadata specific to this render response. This is separate from the `meta` parameter in `@mcp.prompt(meta={...})`, which provides static metadata about the prompt definition itself (returned when listing prompts). diff --git a/docs/servers/resources.mdx b/docs/servers/resources.mdx index 1668bdf583..ea9d16f6d7 100644 --- a/docs/servers/resources.mdx +++ b/docs/servers/resources.mdx @@ -128,7 +128,7 @@ def get_application_status() -> dict: - Optional meta information about the resource. This data is passed through to the MCP client as the `_meta` field of the client-side resource object and can be used for custom metadata, versioning, or other application-specific purposes. + Optional meta information about the resource. This data is passed through to the MCP client as the `meta` field of the client-side resource object and can be used for custom metadata, versioning, or other application-specific purposes. @@ -170,7 +170,7 @@ def get_widget() -> ResourceContent: **`mime_type`** - Optional MIME type for the content. Defaults to `"text/plain"` for string content and `"application/octet-stream"` for binary content. -**`meta`** - Optional metadata dictionary that will be included in the MCP response's `_meta` field. Use this for runtime metadata like Content Security Policy headers, caching hints, or other client-specific data. +**`meta`** - Optional metadata dictionary that will be included in the MCP response's `meta` field. Use this for runtime metadata like Content Security Policy headers, caching hints, or other client-specific data. ```python # Binary content with metadata diff --git a/docs/servers/tools.mdx b/docs/servers/tools.mdx index 942638a7dc..3fda89e1cf 100644 --- a/docs/servers/tools.mdx +++ b/docs/servers/tools.mdx @@ -112,7 +112,7 @@ def search_products_implementation(query: str, category: str | None = None) -> l - Optional meta information about the tool. This data is passed through to the MCP client as the `_meta` field of the client-side tool object and can be used for custom metadata, versioning, or other application-specific purposes. + Optional meta information about the tool. This data is passed through to the MCP client as the `meta` field of the client-side tool object and can be used for custom metadata, versioning, or other application-specific purposes.