feat: improve error message when failing to get tools from MCP

Include the underlying exception message in the ConnectionError raised when session.list_tools() fails.

PiperOrigin-RevId: 861889733
This commit is contained in:
Google Team Member
2026-01-27 14:33:14 -08:00
committed by Copybara-Service
parent 65cbf4b35c
commit 3480b3b82d
+1 -1
View File
@@ -173,7 +173,7 @@ class McpToolset(BaseToolset):
session.list_tools(), timeout=timeout_in_seconds
)
except Exception as e:
raise ConnectionError("Failed to get tools from MCP server.") from e
raise ConnectionError(f"Failed to get tools from MCP server: {e}") from e
# Apply filtering based on context and tool_filter
tools = []