MCPcopy Create free account
hub / github.com/InternScience/InternAgent / _execute_tool

Method _execute_tool

demo.py:35–53  ·  view source on GitHub ↗

执行工具函数 Args: function_name: 工具名称 function_args: 工具参数 Returns: 工具执行结果

(self, function_name: str, function_args: Dict[str, Any])

Source from the content-addressed store, hash-verified

33 logger.info(f"MyAgent initialized with {len(self.tool_registry)} tools: {self.tool_registry.get_all_names()}")
34
35 async def _execute_tool(self, function_name: str, function_args: Dict[str, Any]) -> Any:
36 """
37 执行工具函数
38
39 Args:
40 function_name: 工具名称
41 function_args: 工具参数
42
43 Returns:
44 工具执行结果
45 """
46 logger.info(f"🔧 Executing: {function_name}")
47 logger.info(f"📝 Args: {json.dumps(function_args, ensure_ascii=False)}")
48
49 # 通过注册表执行工具
50 result = await self.tool_registry.execute(function_name, **function_args)
51
52 logger.info(f"✅ Result: {result}")
53 return result
54
55 def get_registered_tools(self) -> list:
56 """获取所有工具的OpenAI格式定义"""

Callers

nothing calls this directly

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected