Marsley commited on
Commit
46b2a97
·
unverified ·
1 Parent(s): 10b8a90

Fix #1506: Update tool filtering documentation from _meta to meta (#1511)

Browse files
Files changed (1) hide show
  1. docs/clients/tools.mdx +6 -6
docs/clients/tools.mdx CHANGED
@@ -26,8 +26,8 @@ async with client:
26
  if tool.inputSchema:
27
  print(f"Parameters: {tool.inputSchema}")
28
  # Access tags and other metadata
29
- if hasattr(tool, '_meta') and tool._meta:
30
- fastmcp_meta = tool._meta.get('_fastmcp', {})
31
  print(f"Tags: {fastmcp_meta.get('tags', [])}")
32
  ```
33
 
@@ -44,16 +44,16 @@ async with client:
44
  # Filter tools by tag
45
  analysis_tools = [
46
  tool for tool in tools
47
- if hasattr(tool, '_meta') and tool._meta and
48
- tool._meta.get('_fastmcp', {}) and
49
- 'analysis' in tool._meta.get('_fastmcp', {}).get('tags', [])
50
  ]
51
 
52
  print(f"Found {len(analysis_tools)} analysis tools")
53
  ```
54
 
55
  <Note>
56
- 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.
57
  </Note>
58
 
59
  ## Executing Tools
 
26
  if tool.inputSchema:
27
  print(f"Parameters: {tool.inputSchema}")
28
  # Access tags and other metadata
29
+ if hasattr(tool, 'meta') and tool.meta:
30
+ fastmcp_meta = tool.meta.get('_fastmcp', {})
31
  print(f"Tags: {fastmcp_meta.get('tags', [])}")
32
  ```
33
 
 
44
  # Filter tools by tag
45
  analysis_tools = [
46
  tool for tool in tools
47
+ if hasattr(tool, 'meta') and tool.meta and
48
+ tool.meta.get('_fastmcp', {}) and
49
+ 'analysis' in tool.meta.get('_fastmcp', {}).get('tags', [])
50
  ]
51
 
52
  print(f"Found {len(analysis_tools)} analysis tools")
53
  ```
54
 
55
  <Note>
56
+ 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.
57
  </Note>
58
 
59
  ## Executing Tools