refac: safer tool server handling

This commit is contained in:
Timothy Jaeryang Baek
2026-03-11 15:22:51 -05:00
parent f2217da94e
commit 8da29566a1
2 changed files with 17 additions and 8 deletions
+8 -5
View File
@@ -275,11 +275,14 @@ async def get_tools(
continue
tool_server_idx = tool_server_data.get("idx", 0)
tool_server_connection = (
request.app.state.config.TOOL_SERVER_CONNECTIONS[
tool_server_idx
]
)
connections = request.app.state.config.TOOL_SERVER_CONNECTIONS
if tool_server_idx >= len(connections):
log.warning(
f"Tool server index {tool_server_idx} out of range "
f"(have {len(connections)} connections), skipping server {server_id}"
)
continue
tool_server_connection = connections[tool_server_idx]
# Check access control for tool server
if not has_connection_access(