fix(M6): agents/tools-Endpoint — list_for_api statt nichtexistenter list_tools (#364)
Check Cross-Plugin Imports / check (push) Has been cancelled

- Vorbestands-Bug (live gemessen: 500 "ToolRegistry has no attribute list_tools"):
  automation/agent_routes.py rief registry.list_tools() auf, ToolRegistry
  bietet get_all()/list_for_api() — Route auf list_for_api() mit korrektem
  Feld-Mapping (plugin_name -> plugin) umgestellt
- Regressionstest gesichert (test_agents_tools_route_uses_list_for_api)
- M6-Suite 8/8 gruen
This commit is contained in:
Agent Zero
2026-08-31 01:07:56 +02:00
parent 335762dd3d
commit 04e92794de
2 changed files with 17 additions and 3 deletions
@@ -166,14 +166,14 @@ async def list_tools(
)
registry = get_tool_registry()
tools = registry.list_tools()
tools = registry.list_for_api()
return {
"items": [
{
"id": t.get("id", t.get("name", "")),
"id": t.get("name", ""),
"name": t.get("name", ""),
"description": t.get("description", ""),
"plugin": t.get("plugin", ""),
"plugin": t.get("plugin_name", ""),
}
for t in tools
],
+14
View File
@@ -169,3 +169,17 @@ class TestAgentLoopContext:
src = inspect.getsource(agent_loop)
assert '"agent_name"' in src, "tool_context must include agent_name"
def test_agents_tools_route_uses_list_for_api():
"""M6 verification blocker fixed: /api/v1/agents/tools used to call
registry.list_tools() (nonexistent — 500 on production, pre-existing).
The route must use list_for_api() with the correct field mapping.
"""
import inspect
from app.plugins.builtins.automation.agent_routes import list_tools
src = inspect.getsource(list_tools)
assert "list_for_api()" in src, "route must use list_for_api()"
assert "list_tools()" not in src.replace("list_for_api()", "")