-
Notifications
You must be signed in to change notification settings - Fork 33
[bigquery-maps-mcp]: Exception during MCP session execution: Failed to get tools from MCP server #1730
Copy link
Copy link
Closed
Description
On Step 7 of this codelab, when trying to test the Agent, I'm getting this error:
INFO: Started server process [7381]
INFO: Waiting for application startup.
+-----------------------------------------------------------------------------+
| ADK Web Server started |
| |
| For local testing, access at http://127.0.0.1:8000. |
+-----------------------------------------------------------------------------+
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: 127.0.0.1:39928 - "GET /?authuser=0 HTTP/1.1" 307 Temporary Redirect
INFO: 127.0.0.1:39928 - "GET /dev-ui/ HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:39928 - "GET /dev-ui/polyfills-5CFQRCPP.js HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:39928 - "GET /dev-ui/chunk-BX7YU7E6.js HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:39928 - "GET /dev-ui/chunk-W7GRJBO5.js HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:39928 - "GET /dev-ui/styles-SI5RXIFC.css HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:39938 - "GET /dev-ui/main-QQBY56NS.js HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:39938 - "GET /dev-ui/assets/config/runtime-config.json HTTP/1.1" 200 OK
INFO: 127.0.0.1:39938 - "GET /list-apps?relative_path=./ HTTP/1.1" 200 OK
INFO: 127.0.0.1:39938 - "GET /dev-ui/assets/ADK-512-color.svg HTTP/1.1" 304 Not Modified
2026-03-10 13:31:57,098 - INFO - local_storage.py:60 - Creating local session service at /home/reachsiddajmera/mcp/examples/launchmybakery/adk_agent/mcp_bakery_app/.adk/session.db
INFO: 127.0.0.1:39928 - "GET /builder/app/mcp_bakery_app?ts=1773149517041 HTTP/1.1" 200 OK
2026-03-10 13:31:57,111 - INFO - adk_web_server.py:666 - New session created: d28ba9cc-3858-478c-ba8d-c2e501800636
INFO: 127.0.0.1:39938 - "POST /apps/mcp_bakery_app/users/user/sessions HTTP/1.1" 200 OK
INFO: 127.0.0.1:39938 - "GET /apps/mcp_bakery_app/users/user/sessions/d28ba9cc-3858-478c-ba8d-c2e501800636 HTTP/1.1" 200 OK
INFO: 127.0.0.1:39938 - "GET /debug/trace/session/d28ba9cc-3858-478c-ba8d-c2e501800636 HTTP/1.1" 200 OK
INFO: 127.0.0.1:39938 - "GET /debug/trace/session/d28ba9cc-3858-478c-ba8d-c2e501800636 HTTP/1.1" 200 OK
INFO: 127.0.0.1:39928 - "GET /apps/mcp_bakery_app/eval_sets HTTP/1.1" 200 OK
INFO: 127.0.0.1:39938 - "GET /apps/mcp_bakery_app/users/user/sessions HTTP/1.1" 200 OK
INFO: 127.0.0.1:39938 - "GET /apps/mcp_bakery_app/eval_results HTTP/1.1" 200 OK
INFO: 127.0.0.1:39938 - "GET /apps/mcp_bakery_app/users/user/sessions HTTP/1.1" 200 OK
2026-03-10 13:32:11,818 - INFO - envs.py:83 - Loaded .env file for mcp_bakery_app at /home/reachsiddajmera/mcp/examples/launchmybakery/adk_agent/mcp_bakery_app/.env
2026-03-10 13:32:11,819 - INFO - envs.py:83 - Loaded .env file for mcp_bakery_app at /home/reachsiddajmera/mcp/examples/launchmybakery/adk_agent/mcp_bakery_app/.env
MCP Toolset configured for Streamable HTTP connection.
MCP Toolset configured for Streamable HTTP connection.
2026-03-10 13:32:12,634 - INFO - agent_loader.py:130 - Found root_agent in mcp_bakery_app.agent
INFO: 127.0.0.1:54354 - "POST /run_sse HTTP/1.1" 200 OK
2026-03-10 13:32:12,721 - INFO - _client.py:1740 - HTTP Request: POST https://mapstools.googleapis.com/mcp "HTTP/1.1 200 OK"
2026-03-10 13:32:12,723 - INFO - streamable_http.py:193 - Negotiated protocol version: 2025-11-25
2026-03-10 13:32:12,731 - INFO - _client.py:1740 - HTTP Request: POST https://mapstools.googleapis.com/mcp "HTTP/1.1 202 Accepted"
2026-03-10 13:32:12,749 - INFO - _client.py:1740 - HTTP Request: POST https://mapstools.googleapis.com/mcp "HTTP/1.1 200 OK"
/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/features/_feature_decorator.py:72: UserWarning: [EXPERIMENTAL] feature FeatureName.BASE_AUTHENTICATED_TOOL is enabled.
check_feature_enabled()
2026-03-10 13:32:12,762 - INFO - types.py:2570 -
Note: Conversion of fields that are not included in the JSONSchema class are ignored.
Json Schema is now supported natively by both Vertex AI and Gemini API. Users
are recommended to pass/receive Json Schema directly to/from the API. For example:
1. the counter part of GenerateContentConfig.response_schema is
GenerateContentConfig.response_json_schema, which accepts [JSON
Schema](https://json-schema.org/)
2. the counter part of FunctionDeclaration.parameters is
FunctionDeclaration.parameters_json_schema, which accepts [JSON
Schema](https://json-schema.org/)
3. the counter part of FunctionDeclaration.response is
FunctionDeclaration.response_json_schema, which accepts [JSON
Schema](https://json-schema.org/)
2026-03-10 13:32:13,024 - INFO - _client.py:1740 - HTTP Request: POST https://bigquery.googleapis.com/mcp "HTTP/1.1 200 OK"
2026-03-10 13:32:13,027 - INFO - streamable_http.py:193 - Negotiated protocol version: 2025-11-25
2026-03-10 13:32:13,237 - INFO - _client.py:1740 - HTTP Request: POST https://bigquery.googleapis.com/mcp "HTTP/1.1 202 Accepted"
2026-03-10 13:32:13,477 - INFO - _client.py:1740 - HTTP Request: POST https://bigquery.googleapis.com/mcp "HTTP/1.1 200 OK"
2026-03-10 13:32:13,816 - INFO - google_llm.py:185 - Sending out request, model: gemini-3.1-pro-preview, backend: GoogleLLMVariant.VERTEX_AI, stream: False
2026-03-10 13:32:21,265 - INFO - _client.py:1740 - HTTP Request: POST https://aiplatform.googleapis.com/v1beta1/projects/adk-mcp-489812/locations/global/publishers/google/models/gemini-3.1-pro-preview:generateContent "HTTP/1.1 200 OK"
2026-03-10 13:32:21,268 - INFO - google_llm.py:250 - Response received from the model.
2026-03-10 13:32:21,268 - WARNING - types.py:7460 - Warning: there are non-text parts in the response: ['function_call'], returning concatenated text result from text parts. Check the full candidates.content.parts accessor to get the full model response.
2026-03-10 13:32:26,270 - ERROR - mcp_toolset.py:284 - Exception during MCP session execution: Failed to get tools from MCP server:
Traceback (most recent call last):
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/anyio/streams/memory.py", line 117, in receive
return self.receive_nowait()
^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/anyio/streams/memory.py", line 112, in receive_nowait
raise WouldBlock
anyio.WouldBlock
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/mcp/client/session.py", line 529, in list_tools
result = await self.send_request(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/mcp/shared/session.py", line 292, in send_request
response_or_error = await response_stream_reader.receive()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/anyio/streams/memory.py", line 125, in receive
await receive_event.wait()
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 1789, in wait
await self._event.wait()
File "/usr/lib/python3.12/asyncio/locks.py", line 212, in wait
await fut
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/tools/mcp_tool/mcp_toolset.py", line 280, in _execute_with_session
return await asyncio.wait_for(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
async with timeouts.timeout(timeout):
File "/usr/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
raise TimeoutError from exc_val
TimeoutError
2026-03-10 13:32:26,273 - ERROR - mcp_toolset.py:284 - Exception during MCP session execution: Failed to get tools from MCP server:
Traceback (most recent call last):
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/anyio/streams/memory.py", line 117, in receive
return self.receive_nowait()
^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/anyio/streams/memory.py", line 112, in receive_nowait
raise WouldBlock
anyio.WouldBlock
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/mcp/client/session.py", line 529, in list_tools
result = await self.send_request(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/mcp/shared/session.py", line 292, in send_request
response_or_error = await response_stream_reader.receive()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/anyio/streams/memory.py", line 125, in receive
await receive_event.wait()
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 1789, in wait
await self._event.wait()
File "/usr/lib/python3.12/asyncio/locks.py", line 212, in wait
await fut
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/tools/mcp_tool/mcp_toolset.py", line 280, in _execute_with_session
return await asyncio.wait_for(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
async with timeouts.timeout(timeout):
File "/usr/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
raise TimeoutError from exc_val
TimeoutError
2026-03-10 13:32:26,282 - ERROR - adk_web_server.py:1643 - Error in event_generator: Failed to get tools from MCP server:
Traceback (most recent call last):
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/anyio/streams/memory.py", line 117, in receive
return self.receive_nowait()
^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/anyio/streams/memory.py", line 112, in receive_nowait
raise WouldBlock
anyio.WouldBlock
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
return await fut
^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/mcp/client/session.py", line 529, in list_tools
result = await self.send_request(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/mcp/shared/session.py", line 292, in send_request
response_or_error = await response_stream_reader.receive()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/anyio/streams/memory.py", line 125, in receive
await receive_event.wait()
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 1789, in wait
await self._event.wait()
File "/usr/lib/python3.12/asyncio/locks.py", line 212, in wait
await fut
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/tools/mcp_tool/mcp_toolset.py", line 280, in _execute_with_session
return await asyncio.wait_for(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
async with timeouts.timeout(timeout):
File "/usr/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
raise TimeoutError from exc_val
TimeoutError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/cli/adk_web_server.py", line 1616, in event_generator
async for event in agen:
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 565, in run_async
async for event in agen:
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 550, in _run_with_trace
async for event in agen:
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 782, in _exec_with_plugin
async for event in agen:
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 539, in execute
async for event in agen:
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/agents/base_agent.py", line 295, in run_async
async for event in agen:
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/agents/llm_agent.py", line 470, in _run_async_impl
async for event in agen:
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 752, in run_async
async for event in agen:
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 829, in _run_one_step_async
async for llm_response in agen:
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 1186, in _call_llm_async
async for event in agen:
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 1178, in _call_llm_with_tracing
if altered_llm_response := await self._handle_after_model_callback(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 1226, in _handle_after_model_callback
return await _handle_after_model_callback(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 296, in _handle_after_model_callback
return await _maybe_add_grounding_metadata()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 263, in _maybe_add_grounding_metadata
tools = await agent.canonical_tools(readonly_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/agents/llm_agent.py", line 606, in canonical_tools
results = await asyncio.gather(*(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/agents/llm_agent.py", line 182, in _convert_tool_union_to_tools
return await tool_union.get_tools_with_prefix(ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/tools/base_toolset.py", line 115, in get_tools_with_prefix
tools = await self.get_tools(readonly_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/tools/mcp_tool/mcp_session_manager.py", line 163, in wrapper
return await func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/tools/mcp_tool/mcp_toolset.py", line 304, in get_tools
tools_response: ListToolsResult = await self._execute_with_session(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/reachsiddajmera/mcp/examples/launchmybakery/.venv/lib/python3.12/site-packages/google/adk/tools/mcp_tool/mcp_toolset.py", line 287, in _execute_with_session
raise ConnectionError(f"{error_message}: {e}") from e
ConnectionError: Failed to get tools from MCP server:
2026-03-10 13:32:26,287 - WARNING - session_context.py:190 - Error on session runner task: unhandled errors in a TaskGroup (1 sub-exception)
2026-03-10 13:32:26,287 - WARNING - session_context.py:190 - Error on session runner task: unhandled errors in a TaskGroup (1 sub-exception)
INFO: 127.0.0.1:54354 - "GET /debug/trace/session/d28ba9cc-3858-478c-ba8d-c2e501800636 HTTP/1.1" 200 OK
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels