add a timeout arguments on per-request basis (as per MCP specifications) (#601)

This commit is contained in:
Guillaume Raille
2025-04-29 14:58:48 +02:00
committed by GitHub
parent 697b6e8e05
commit 96e5327110
2 changed files with 18 additions and 9 deletions

View File

@@ -254,7 +254,10 @@ class ClientSession(
)
async def call_tool(
self, name: str, arguments: dict[str, Any] | None = None
self,
name: str,
arguments: dict[str, Any] | None = None,
read_timeout_seconds: timedelta | None = None,
) -> types.CallToolResult:
"""Send a tools/call request."""
return await self.send_request(
@@ -265,6 +268,7 @@ class ClientSession(
)
),
types.CallToolResult,
request_read_timeout_seconds=read_timeout_seconds,
)
async def list_prompts(self) -> types.ListPromptsResult: