Execute tool function (routes to either function-based or MCP tool)
(self, function_name: str, function_args: Dict[str, Any])
| 110 | logger.info(f"All tools available") |
| 111 | |
| 112 | async def _execute_tool(self, function_name: str, function_args: Dict[str, Any]) -> Any: |
| 113 | """Execute tool function (routes to either function-based or MCP tool)""" |
| 114 | logger.info(f"Executing tool: {function_name}") |
| 115 | logger.debug(f"Arguments: {json.dumps(function_args, ensure_ascii=False)}") |
| 116 | |
| 117 | try: |
| 118 | result = await self.tool_registry.execute(function_name, **function_args) |
| 119 | logger.info(f"Tool execution successful: {function_name}") |
| 120 | logger.info(f"Tool Call Result: {result}") |
| 121 | return result |
| 122 | except Exception as e: |
| 123 | logger.error(f"Tool execution failed for {function_name}: {e}") |
| 124 | raise |
| 125 | |
| 126 | async def get_registered_tools(self) -> list: |
| 127 | """Get all tool definitions in OpenAI format (with permission filtering applied)""" |