MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / make_mcp_tool_function

Method make_mcp_tool_function

src/mcp_client/client.py:313–325  ·  view source on GitHub ↗
(
        self, tool_name: str, param_names: list[str]
    )

Source from the content-addressed store, hash-verified

311 raise RuntimeError(f"Failed to fetch tools from MCP: {e}")
312
313 def make_mcp_tool_function(
314 self, tool_name: str, param_names: list[str]
315 ) -> callable:
316 def wrapper(*args, is_catch_exception=True, **kwargs) -> dict:
317 if len(args) > len(param_names):
318 raise ValueError(
319 f"Too many arguments: expected {len(param_names)}, got {len(args)}"
320 )
321 arguments = dict(zip(param_names, args))
322 arguments.update(kwargs)
323 return self.invoke(tool_name, arguments, is_catch_exception)
324
325 return wrapper
326
327 def process_tool_calls(self, msg: Any) -> List[dict]:
328 tool_calls = msg.tool_calls or []

Callers 3

__init__Method · 0.80
runMethod · 0.80
__init__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected