Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/agentscope/mcp/_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ async def get_callable_function(
self,
func_name: str,
wrap_tool_result: bool = True,
execution_timeout: float | None = None,
) -> Callable:
"""Get a tool function by its name."""

Expand Down
5 changes: 5 additions & 0 deletions src/agentscope/tool/_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,7 @@ async def register_mcp_client(
"raise",
"rename",
] = "raise",
execution_timeout: float | None = None,
) -> None:
"""Register tool functions from an MCP client.

Expand Down Expand Up @@ -1092,6 +1093,9 @@ async def register_mcp_client(
- 'skip': skip the registration of the new tool function.
- 'rename': rename the new tool function by appending a random
suffix to make it unique.
execution_timeout (`float | None`, optional):
The preset timeout in seconds for calling the tool function.
If `None`, no timeout will be applied.
"""
if (
isinstance(mcp_client, StatefulClientBase)
Expand Down Expand Up @@ -1151,6 +1155,7 @@ async def register_mcp_client(
func_obj = await mcp_client.get_callable_function(
func_name=mcp_tool.name,
wrap_tool_result=True,
execution_timeout=execution_timeout,
)

# Prepare preset kwargs
Expand Down
Loading