Merge pull request #12602 from alpha-pet/fix-tool-server-indexing-mismatch

fix: mismatch between TOOL_SERVERS / TOOL_SERVER_CONNECTIONS indexing
This commit is contained in:
Tim Jaeryang Baek 2025-04-10 09:06:30 -07:00 committed by GitHub
commit a3e477e100
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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() tools = Tools.get_tools()
for idx, server in enumerate(request.app.state.TOOL_SERVERS): for server in request.app.state.TOOL_SERVERS:
tools.append( tools.append(
ToolUserResponse( ToolUserResponse(
**{ **{
@ -60,7 +60,7 @@ async def get_tools(request: Request, user=Depends(get_verified_user)):
.get("description", ""), .get("description", ""),
}, },
"access_control": request.app.state.config.TOOL_SERVER_CONNECTIONS[ "access_control": request.app.state.config.TOOL_SERVER_CONNECTIONS[
idx server["idx"]
] ]
.get("config", {}) .get("config", {})
.get("access_control", None), .get("access_control", None),

View File

@ -56,7 +56,12 @@ def get_tools(
tool_server_connection = ( tool_server_connection = (
request.app.state.config.TOOL_SERVER_CONNECTIONS[server_idx] 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", []) specs = tool_server_data.get("specs", [])
for spec in specs: for spec in specs: