Files
a0_software_orchestrator/api/tool_capability_check.py
T

27 lines
988 B
Python
Raw Normal View History

"""API: Trigger tool capability check."""
from helpers.api import ApiHandler, Request, Response
from usr.plugins.a0_software_orchestrator.helpers.tool_capabilities import generate_capability_report, check_tool
import yaml
import os
class ToolCapabilityCheck(ApiHandler):
async def process(self, input: dict, request: Request) -> dict | Response:
tool_name = input.get("tool_name", "")
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) or {}
except Exception:
config = {}
if tool_name:
# Check single tool
status = check_tool(tool_name)
return {"tool": tool_name, **status}
else:
# Full report
report = generate_capability_report(config)
return {"tools": report}