mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-24 06:24:18 +02:00
Clean up docs
This commit is contained in:
parent
756e5c31e3
commit
5ddb54bbd4
4 changed files with 5 additions and 5 deletions
|
|
@ -176,7 +176,7 @@ async with client:
|
|||
|
||||
# Execute a tool
|
||||
result = await client.call_tool("multiply", {"a": 5, "b": 3})
|
||||
print(result[0].text) # "15"
|
||||
print(result.data) # 15
|
||||
```
|
||||
|
||||
See [Tools](/clients/tools) for detailed documentation.
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ from fastmcp import FastMCP, Client
|
|||
def mcp_server():
|
||||
server = FastMCP("TestServer")
|
||||
|
||||
@server.tool
|
||||
@server.tool
|
||||
def greet(name: str) -> str:
|
||||
return f"Hello, {name}!"
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ async def test_tool_functionality(mcp_server):
|
|||
# Pass the server directly to the Client constructor
|
||||
async with Client(mcp_server) as client:
|
||||
result = await client.call_tool("greet", {"name": "World"})
|
||||
assert result[0].text == "Hello, World!"
|
||||
assert result.data == "Hello, World!"
|
||||
```
|
||||
|
||||
This pattern creates a direct connection between the client and server, allowing you to test your server's functionality efficiently.
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ async def test_dynamic_mount():
|
|||
|
||||
async with Client(main_mcp) as client:
|
||||
result = await client.call_tool("dynamic_added_later")
|
||||
print("Result:", result[0].text)
|
||||
print("Result:", result.data)
|
||||
# Shows: "Tool Added Dynamically!"
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ async def main():
|
|||
# Call one of the generated tools
|
||||
print("\n\nCalling tool 'get_user_by_id'...")
|
||||
user = await client.call_tool("get_user_by_id", {"id": 1})
|
||||
print(f"Result:\n{user[0].text}")
|
||||
print(f"Result:\n{user.data}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue