|
25 | 25 | from mcp.client.stdio import StdioServerParameters |
26 | 26 | from mcp.client.streamable_http import streamablehttp_client |
27 | 27 | from mcp.shared.exceptions import McpError |
| 28 | +from mcp.shared.session import ProgressFnT |
28 | 29 |
|
29 | 30 |
|
30 | 31 | class SseServerParameters(BaseModel): |
@@ -172,11 +173,25 @@ def tools(self) -> dict[str, types.Tool]: |
172 | 173 | """Returns the tools as a dictionary of names to tools.""" |
173 | 174 | return self._tools |
174 | 175 |
|
175 | | - async def call_tool(self, name: str, args: dict[str, Any]) -> types.CallToolResult: |
| 176 | + async def call_tool( |
| 177 | + self, |
| 178 | + name: str, |
| 179 | + args: dict[str, Any], |
| 180 | + read_timeout_seconds: timedelta | None = None, |
| 181 | + progress_callback: ProgressFnT | None = None, |
| 182 | + *, |
| 183 | + meta: dict[str, Any] | None = None, |
| 184 | + ) -> types.CallToolResult: |
176 | 185 | """Executes a tool given its name and arguments.""" |
177 | 186 | session = self._tool_to_session[name] |
178 | 187 | session_tool_name = self.tools[name].name |
179 | | - return await session.call_tool(session_tool_name, args) |
| 188 | + return await session.call_tool( |
| 189 | + session_tool_name, |
| 190 | + args, |
| 191 | + read_timeout_seconds=read_timeout_seconds, |
| 192 | + progress_callback=progress_callback, |
| 193 | + meta=meta, |
| 194 | + ) |
180 | 195 |
|
181 | 196 | async def disconnect_from_server(self, session: mcp.ClientSession) -> None: |
182 | 197 | """Disconnects from a single MCP server.""" |
|
0 commit comments