Spaces:
Running
Running
Neil Conway commited on
Fix docstring format for fastmcp.client.Client (#1094)
Browse files- src/fastmcp/client/client.py +17 -12
src/fastmcp/client/client.py
CHANGED
|
@@ -93,13 +93,16 @@ class Client(Generic[ClientTransportT]):
|
|
| 93 |
https://github.com/jlowin/fastmcp/pull/1054
|
| 94 |
|
| 95 |
Args:
|
| 96 |
-
transport:
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
| 103 |
roots: Optional RootsList or RootsHandler for filesystem access
|
| 104 |
sampling_handler: Optional handler for sampling requests
|
| 105 |
log_handler: Optional handler for log messages
|
|
@@ -110,14 +113,16 @@ class Client(Generic[ClientTransportT]):
|
|
| 110 |
Set to 0 to disable. If None, uses the value in the FastMCP global settings.
|
| 111 |
|
| 112 |
Examples:
|
| 113 |
-
```python
|
| 114 |
-
|
|
|
|
| 115 |
|
| 116 |
async with client:
|
| 117 |
-
# List available resources
|
|
|
|
| 118 |
|
| 119 |
-
# Call a tool
|
| 120 |
-
"value"})
|
| 121 |
```
|
| 122 |
"""
|
| 123 |
|
|
|
|
| 93 |
https://github.com/jlowin/fastmcp/pull/1054
|
| 94 |
|
| 95 |
Args:
|
| 96 |
+
transport:
|
| 97 |
+
Connection source specification, which can be:
|
| 98 |
+
|
| 99 |
+
- ClientTransport: Direct transport instance
|
| 100 |
+
- FastMCP: In-process FastMCP server
|
| 101 |
+
- AnyUrl or str: URL to connect to
|
| 102 |
+
- Path: File path for local socket
|
| 103 |
+
- MCPConfig: MCP server configuration
|
| 104 |
+
- dict: Transport configuration
|
| 105 |
+
|
| 106 |
roots: Optional RootsList or RootsHandler for filesystem access
|
| 107 |
sampling_handler: Optional handler for sampling requests
|
| 108 |
log_handler: Optional handler for log messages
|
|
|
|
| 113 |
Set to 0 to disable. If None, uses the value in the FastMCP global settings.
|
| 114 |
|
| 115 |
Examples:
|
| 116 |
+
```python
|
| 117 |
+
# Connect to FastMCP server
|
| 118 |
+
client = Client("http://localhost:8080")
|
| 119 |
|
| 120 |
async with client:
|
| 121 |
+
# List available resources
|
| 122 |
+
resources = await client.list_resources()
|
| 123 |
|
| 124 |
+
# Call a tool
|
| 125 |
+
result = await client.call_tool("my_tool", {"param": "value"})
|
| 126 |
```
|
| 127 |
"""
|
| 128 |
|