Route tool calls to appropriate handler.
(self, server_name: str, *, tool_name: str,
tool_args: dict)
| 653 | return {self.SERVER_NAME: tools} |
| 654 | |
| 655 | async def call_tool(self, server_name: str, *, tool_name: str, |
| 656 | tool_args: dict) -> str: |
| 657 | """Route tool calls to appropriate handler.""" |
| 658 | if tool_name == 'fetch_page': |
| 659 | return await self.fetch_page(**(tool_args or {})) |
| 660 | |
| 661 | # Map tool_name to engine_type |
| 662 | tool_to_engine = self._get_tool_name_to_engine_map() |
| 663 | engine_type = tool_to_engine.get(tool_name) |
| 664 | |
| 665 | if not engine_type or engine_type not in self._engines: |
| 666 | return _json_dumps({ |
| 667 | 'status': |
| 668 | 'error', |
| 669 | 'message': |
| 670 | f'Unknown tool: {tool_name}. Available: {list(tool_to_engine.keys())}' |
| 671 | }) |
| 672 | |
| 673 | return await self._execute_search(engine_type, tool_args or {}) |
| 674 | |
| 675 | def _fetch_content_sync(self, url: str) -> Dict[str, Any]: |
| 676 | """Synchronous content fetch wrapper.""" |