fix(M6): agents/tools-Endpoint — list_for_api statt nichtexistenter list_tools (#364)
Check Cross-Plugin Imports / check (push) Has been cancelled
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:
@@ -166,14 +166,14 @@ async def list_tools(
|
|||||||
)
|
)
|
||||||
|
|
||||||
registry = get_tool_registry()
|
registry = get_tool_registry()
|
||||||
tools = registry.list_tools()
|
tools = registry.list_for_api()
|
||||||
return {
|
return {
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"id": t.get("id", t.get("name", "")),
|
"id": t.get("name", ""),
|
||||||
"name": t.get("name", ""),
|
"name": t.get("name", ""),
|
||||||
"description": t.get("description", ""),
|
"description": t.get("description", ""),
|
||||||
"plugin": t.get("plugin", ""),
|
"plugin": t.get("plugin_name", ""),
|
||||||
}
|
}
|
||||||
for t in tools
|
for t in tools
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -169,3 +169,17 @@ class TestAgentLoopContext:
|
|||||||
|
|
||||||
src = inspect.getsource(agent_loop)
|
src = inspect.getsource(agent_loop)
|
||||||
assert '"agent_name"' in src, "tool_context must include agent_name"
|
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()", "")
|
||||||
|
|||||||
Reference in New Issue
Block a user