Jeremiah Lowin commited on
Commit
97d16c5
·
1 Parent(s): 2f3af13

Clean up docs

Browse files
docs/clients/client.mdx CHANGED
@@ -176,7 +176,7 @@ async with client:
176
 
177
  # Execute a tool
178
  result = await client.call_tool("multiply", {"a": 5, "b": 3})
179
- print(result[0].text) # "15"
180
  ```
181
 
182
  See [Tools](/clients/tools) for detailed documentation.
 
176
 
177
  # Execute a tool
178
  result = await client.call_tool("multiply", {"a": 5, "b": 3})
179
+ print(result.data) # 15
180
  ```
181
 
182
  See [Tools](/clients/tools) for detailed documentation.
docs/patterns/testing.mdx CHANGED
@@ -22,7 +22,7 @@ from fastmcp import FastMCP, Client
22
  def mcp_server():
23
  server = FastMCP("TestServer")
24
 
25
- @server.tool
26
  def greet(name: str) -> str:
27
  return f"Hello, {name}!"
28
 
@@ -32,7 +32,7 @@ async def test_tool_functionality(mcp_server):
32
  # Pass the server directly to the Client constructor
33
  async with Client(mcp_server) as client:
34
  result = await client.call_tool("greet", {"name": "World"})
35
- assert result[0].text == "Hello, World!"
36
  ```
37
 
38
  This pattern creates a direct connection between the client and server, allowing you to test your server's functionality efficiently.
 
22
  def mcp_server():
23
  server = FastMCP("TestServer")
24
 
25
+ @server.tool
26
  def greet(name: str) -> str:
27
  return f"Hello, {name}!"
28
 
 
32
  # Pass the server directly to the Client constructor
33
  async with Client(mcp_server) as client:
34
  result = await client.call_tool("greet", {"name": "World"})
35
+ assert result.data == "Hello, World!"
36
  ```
37
 
38
  This pattern creates a direct connection between the client and server, allowing you to test your server's functionality efficiently.
docs/servers/composition.mdx CHANGED
@@ -180,7 +180,7 @@ async def test_dynamic_mount():
180
 
181
  async with Client(main_mcp) as client:
182
  result = await client.call_tool("dynamic_added_later")
183
- print("Result:", result[0].text)
184
  # Shows: "Tool Added Dynamically!"
185
 
186
  if __name__ == "__main__":
 
180
 
181
  async with Client(main_mcp) as client:
182
  result = await client.call_tool("dynamic_added_later")
183
+ print("Result:", result.data)
184
  # Shows: "Tool Added Dynamically!"
185
 
186
  if __name__ == "__main__":
docs/tutorials/rest-api.mdx CHANGED
@@ -114,7 +114,7 @@ async def main():
114
  # Call one of the generated tools
115
  print("\n\nCalling tool 'get_user_by_id'...")
116
  user = await client.call_tool("get_user_by_id", {"id": 1})
117
- print(f"Result:\n{user[0].text}")
118
 
119
  if __name__ == "__main__":
120
  asyncio.run(main())
 
114
  # Call one of the generated tools
115
  print("\n\nCalling tool 'get_user_by_id'...")
116
  user = await client.call_tool("get_user_by_id", {"id": 1})
117
+ print(f"Result:\n{user.data}")
118
 
119
  if __name__ == "__main__":
120
  asyncio.run(main())