fix: mismatch between TOOL_SERVERS / TOOL_SERVER_CONNECTIONS indexing

This commit is contained in:
Thomas Rehn 2025-04-08 12:35:04 +02:00
parent 66322727e3
commit f5b2867e45
2 changed files with 8 additions and 3 deletions

View File

@ -45,7 +45,7 @@ async def get_tools(request: Request, user=Depends(get_verified_user)):
)
tools = Tools.get_tools()
for idx, server in enumerate(request.app.state.TOOL_SERVERS):
for server in request.app.state.TOOL_SERVERS:
tools.append(
ToolUserResponse(
**{
@ -60,7 +60,7 @@ async def get_tools(request: Request, user=Depends(get_verified_user)):
.get("description", ""),
},
"access_control": request.app.state.config.TOOL_SERVER_CONNECTIONS[
idx
server["idx"]
]
.get("config", {})
.get("access_control", None),

View File

@ -55,7 +55,12 @@ def get_tools(
tool_server_connection = (
request.app.state.config.TOOL_SERVER_CONNECTIONS[server_idx]
)
tool_server_data = request.app.state.TOOL_SERVERS[server_idx]
tool_server_data = None
for server in request.app.state.TOOL_SERVERS:
if server["idx"] == server_idx:
tool_server_data = server
break
assert tool_server_data is not None
specs = tool_server_data.get("specs", [])
for spec in specs: