Files

23 lines
1.0 KiB
Python
Raw Permalink Normal View History

"""Tool: check external tool availability."""
from helpers.tool import Tool, Response
from usr.plugins.a0_software_orchestrator.helpers.tool_capabilities import generate_capability_report
import yaml
import os
class CapabilityCheck(Tool):
async def execute(self, plugin_dir: str = "", tool_name: str = "", **kwargs):
if not plugin_dir:
plugin_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
config_path = os.path.join(plugin_dir, "default_config.yaml")
try:
with open(config_path, "r") as f:
config = yaml.safe_load(f)
except (FileNotFoundError, yaml.YAMLError) as e:
config = {}
if tool_name:
from usr.plugins.a0_software_orchestrator.helpers.tool_capabilities import check_tool
result = check_tool(tool_name)
return Response(message=str(result), break_loop=False)
report = generate_capability_report(config)
return Response(message=str(report), break_loop=False)