MCPcopy Create free account
hub / github.com/TheSecuredAnalyst/security-suite / check_tool

Method check_tool

core/tools.py:37–57  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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",

Calls 2

ToolNotFoundErrorClass · 0.90
find_toolMethod · 0.80