Check if tool is available. Args: tool_name: Name of the tool to check raise_error: Raise ToolNotFoundError if tool not found Returns: True if tool is found, False otherwise Raises: ToolNotFoun
(tool_name: str, raise_error: bool = True)
| 35 | def check_tool(tool_name: str, raise_error: bool = True) -> bool: |
| 36 | """Check if tool is available. |
| 37 | |
| 38 | Args: |
| 39 | tool_name: Name of the tool to check |
| 40 | raise_error: Raise ToolNotFoundError if tool not found |
| 41 | |
| 42 | Returns: |
| 43 | True if tool is found, False otherwise |
| 44 | |
| 45 | Raises: |
| 46 | ToolNotFoundError: If raise_error=True and tool not found |
| 47 | """ |
| 48 | if ToolManager.find_tool(tool_name): |
| 49 | return True |
| 50 | |
| 51 | if raise_error: |
| 52 | raise ToolNotFoundError(tool_name) |
| 53 | |
| 54 | logger.warning(f"Tool '{tool_name}' not found") |
| 55 | return False |
| 56 | |
| 57 | @staticmethod |
| 58 | def run_command( |
| 59 | command: list[str], |
| 60 | tool_name: str = "external_tool", |