Jeremiah Lowin commited on
Commit
c084231
·
1 Parent(s): 066ca4c

Add client docs

Browse files
docs/clients/prompts.mdx CHANGED
@@ -25,8 +25,33 @@ async with client:
25
  print(f"Description: {prompt.description}")
26
  if prompt.arguments:
27
  print(f"Arguments: {[arg.name for arg in prompt.arguments]}")
 
 
 
28
  ```
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  ## Using Prompts
31
 
32
  ### Basic Usage
 
25
  print(f"Description: {prompt.description}")
26
  if prompt.arguments:
27
  print(f"Arguments: {[arg.name for arg in prompt.arguments]}")
28
+ # Access tags and other metadata
29
+ if hasattr(prompt, '_meta') and prompt._meta:
30
+ print(f"Tags: {prompt._meta.get('tags', [])}")
31
  ```
32
 
33
+ ### Filtering by Tags
34
+
35
+ You can use the `meta` field to filter prompts based on their tags:
36
+
37
+ ```python
38
+ async with client:
39
+ prompts = await client.list_prompts()
40
+
41
+ # Filter prompts by tag
42
+ analysis_prompts = [
43
+ prompt for prompt in prompts
44
+ if hasattr(prompt, '_meta') and prompt._meta and
45
+ 'analysis' in prompt._meta.get('tags', [])
46
+ ]
47
+
48
+ print(f"Found {len(analysis_prompts)} analysis prompts")
49
+ ```
50
+
51
+ <Note>
52
+ The `_meta` field is part of the standard MCP specification, but the inclusion of tags within it is specific to FastMCP servers. Other MCP server implementations may not provide tags in their metadata.
53
+ </Note>
54
+
55
  ## Using Prompts
56
 
57
  ### Basic Usage
docs/clients/resources.mdx CHANGED
@@ -34,6 +34,9 @@ async with client:
34
  print(f"Name: {resource.name}")
35
  print(f"Description: {resource.description}")
36
  print(f"MIME Type: {resource.mimeType}")
 
 
 
37
  ```
38
 
39
  ### Resource Templates
@@ -49,8 +52,33 @@ async with client:
49
  print(f"Template URI: {template.uriTemplate}")
50
  print(f"Name: {template.name}")
51
  print(f"Description: {template.description}")
 
 
 
52
  ```
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  ## Reading Resources
55
 
56
  ### Static Resources
 
34
  print(f"Name: {resource.name}")
35
  print(f"Description: {resource.description}")
36
  print(f"MIME Type: {resource.mimeType}")
37
+ # Access tags and other metadata
38
+ if hasattr(resource, '_meta') and resource._meta:
39
+ print(f"Tags: {resource._meta.get('tags', [])}")
40
  ```
41
 
42
  ### Resource Templates
 
52
  print(f"Template URI: {template.uriTemplate}")
53
  print(f"Name: {template.name}")
54
  print(f"Description: {template.description}")
55
+ # Access tags and other metadata
56
+ if hasattr(template, '_meta') and template._meta:
57
+ print(f"Tags: {template._meta.get('tags', [])}")
58
  ```
59
 
60
+ ### Filtering by Tags
61
+
62
+ You can use the `meta` field to filter resources based on their tags:
63
+
64
+ ```python
65
+ async with client:
66
+ resources = await client.list_resources()
67
+
68
+ # Filter resources by tag
69
+ config_resources = [
70
+ resource for resource in resources
71
+ if hasattr(resource, '_meta') and resource._meta and
72
+ 'config' in resource._meta.get('tags', [])
73
+ ]
74
+
75
+ print(f"Found {len(config_resources)} config resources")
76
+ ```
77
+
78
+ <Note>
79
+ The `_meta` field is part of the standard MCP specification, but the inclusion of tags within it is specific to FastMCP servers. Other MCP server implementations may not provide tags in their metadata.
80
+ </Note>
81
+
82
  ## Reading Resources
83
 
84
  ### Static Resources
docs/clients/tools.mdx CHANGED
@@ -25,8 +25,33 @@ async with client:
25
  print(f"Description: {tool.description}")
26
  if tool.inputSchema:
27
  print(f"Parameters: {tool.inputSchema}")
 
 
 
28
  ```
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  ## Executing Tools
31
 
32
  ### Basic Execution
 
25
  print(f"Description: {tool.description}")
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
+ print(f"Tags: {tool._meta.get('tags', [])}")
31
  ```
32
 
33
+ ### Filtering by Tags
34
+
35
+ You can use the `meta` field to filter tools based on their tags:
36
+
37
+ ```python
38
+ async with client:
39
+ tools = await client.list_tools()
40
+
41
+ # Filter tools by tag
42
+ analysis_tools = [
43
+ tool for tool in tools
44
+ if hasattr(tool, '_meta') and tool._meta and
45
+ 'analysis' in tool._meta.get('tags', [])
46
+ ]
47
+
48
+ print(f"Found {len(analysis_tools)} analysis tools")
49
+ ```
50
+
51
+ <Note>
52
+ The `_meta` field is part of the standard MCP specification, but the inclusion of tags within it is specific to FastMCP servers. Other MCP server implementations may not provide tags in their metadata.
53
+ </Note>
54
+
55
  ## Executing Tools
56
 
57
  ### Basic Execution