Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
fix(mcp): fix the timeout argument in MCPToolFunction class (#1192)
DavdGao18567aefb075
diff --git a/src/agentscope/_version.py b/src/agentscope/_version.pyindex 29869ffae..657c6bd80 100644--- a/src/agentscope/_version.py+++ b/src/agentscope/_version.py@@ -1,4 +1,4 @@# -*- coding: utf-8 -*-"""The version of agentscope."""-__version__ = "1.0.14"+__version__ = "1.0.15dev"diff --git a/src/agentscope/mcp/_mcp_function.py b/src/agentscope/mcp/_mcp_function.pyindex 83701399b..44bfe6d62 100644--- a/src/agentscope/mcp/_mcp_function.py+++ b/src/agentscope/mcp/_mcp_function.py@@ -34,7 +34,27 @@ class MCPToolFunction:session: ClientSession | None = None,timeout: float | None = None,) -> None:- """Initialize the MCP function."""+ """Initialize the MCP function.++ Args:+ mcp_name (`str`):+ The name of the MCP instance.+ tool (`mcp.types.Tool`):+ The MCP tool definition.+ wrap_tool_result (`bool`):+ Whether to wrap the tool result into `ToolResponse` in+ AgentScope.+ client_gen (`Callable[..., _AsyncGeneratorContextManager[Any]] | \+ None`, *optional*):+ The MCP client generator function. Either this or `session`+ must be provided.+ session (`ClientSession | None`, *optional*):+ The MCP client session. Either this or `client_gen` must be+ provided.+ timeout (`float | None`, *optional*):+ The timeout in seconds for tool execution. If not provided,+ no timeout will be set.+ """self.mcp_name = mcp_nameself.name = tool.nameself.description = tool.description@@ -42,7 +62,7 @@ class MCPToolFunction:self.wrap_tool_result = wrap_tool_resultif timeout:- self.timeout = timedelta(timeout)+ self.timeout = timedelta(seconds=timeout)else:self.timeout = Nonediff --git a/src/agentscope/realtime/_dashscope_realtime_model.py b/src/agentscope/realtime/_dashscope_realtime_model.pyindex 09d374ce5..066e00a87 100644--- a/src/agentscope/realtime/_dashscope_realtime_model.py+++ b/src/agentscope/realtime/_dashscope_realtime_model.py@@ -20,7 +20,7 @@ class DashScopeRealtimeModel(RealtimeModelBase):- Support update session config during the session"""- support_input_modalities: list[str] = ["audio", "image"]+ support_input_modalities: list[str] = ["text", "audio", "image"]"""The supported input modalities of the DashScope realtime model."""support_tools: bool = False