diff --git a/backend/open_webui/routers/tools.py b/backend/open_webui/routers/tools.py index 8a98b4e20..56ede2208 100644 --- a/backend/open_webui/routers/tools.py +++ b/backend/open_webui/routers/tools.py @@ -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), diff --git a/backend/open_webui/utils/tools.py b/backend/open_webui/utils/tools.py index 91b01f7d8..ba19298aa 100644 --- a/backend/open_webui/utils/tools.py +++ b/backend/open_webui/utils/tools.py @@ -56,7 +56,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: