From 04e92794de6c56a3951d9e57a49539aef7b43225 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Mon, 31 Aug 2026 01:07:56 +0200 Subject: [PATCH] =?UTF-8?q?fix(M6):=20agents/tools-Endpoint=20=E2=80=94=20?= =?UTF-8?q?list=5Ffor=5Fapi=20statt=20nichtexistenter=20list=5Ftools=20(#3?= =?UTF-8?q?64)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- app/plugins/builtins/automation/agent_routes.py | 6 +++--- tests/test_m6_miniapp_hosts.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/plugins/builtins/automation/agent_routes.py b/app/plugins/builtins/automation/agent_routes.py index 2f90c1c..fef713a 100644 --- a/app/plugins/builtins/automation/agent_routes.py +++ b/app/plugins/builtins/automation/agent_routes.py @@ -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 ], diff --git a/tests/test_m6_miniapp_hosts.py b/tests/test_m6_miniapp_hosts.py index 66b616e..31f4f6f 100644 --- a/tests/test_m6_miniapp_hosts.py +++ b/tests/test_m6_miniapp_hosts.py @@ -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()", "")