Skip to content

ADK doesn't report errors from McpToolset #4162

@shobsi

Description

@shobsi

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Please share a minimal code and data to reproduce your problem.
Steps to reproduce the behavior:

  1. Create the agent based on McpToolset tools in bigquery_mcp/agent.py:
from google.adk.agents.llm_agent import LlmAgent
from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams
from google.adk.tools.mcp_tool.mcp_toolset import McpToolset
import google.auth

BIGQUERY_AGENT_NAME = "adk_sample_bigquery_mcp_agent"
BIGQUERY_MCP_ENDPOINT = "https://bigquery.googleapis.com/mcp"
BIGQUERY_SCOPE = "https://www.googleapis.com/auth/bigquery"

# Initialize the tools to use the application default credentials.
# https://cloud.google.com/docs/authentication/provide-credentials-adc
credentials, project_id = google.auth.default(scopes=[BIGQUERY_SCOPE])
credentials.refresh(google.auth.transport.requests.Request())
oauth_token = credentials.token

bigquery_mcp_toolset = McpToolset(
    connection_params=StreamableHTTPConnectionParams(
        url=BIGQUERY_MCP_ENDPOINT,
        headers={"Authorization": f"Bearer {oauth_token}"},
    )
)

# The variable name `root_agent` determines what your root agent is for the
# debug CLI
root_agent = LlmAgent(
    model="gemini-2.0-flash",
    name=BIGQUERY_AGENT_NAME,
    description=(
        "Agent to answer questions about BigQuery data and models and execute"
        " SQL queries using MCP."
    ),
    instruction="""\
        You are a data science agent with access to several BigQuery tools provided via MCP.
        Make use of those tools to answer the user's questions.
    """,
    tools=[bigquery_mcp_toolset],
)
  1. Run adk web --log_level debug
  2. Open http://127.0.0.1:8000/dev-ui/?app=bigquery_mcp
  3. Notice the error on the terminal
receive_response_headers.complete return_value=(b'HTTP/1.1', 403, b'Forbidden', [(b'Vary', b'Origin'), (b'Vary', b'X-Origin'), (b'Vary', b'Referer'), (b'Content-Type', b'application/json; charset=UTF-8'), (b'Content-Encoding', b'gzip'), (b'Date', b'Wed, 14 Jan 2026 22:43:58 GMT'), (b'Server', b'ESF'), (b'X-XSS-Protection', b'0'), (b'X-Frame-Options', b'SAMEORIGIN'), (b'X-Content-Type-Options', b'nosniff'), (b'Transfer-Encoding', b'chunked')])
  1. On ADK Web UI see "TypeError: network error" notification at the bottom (which looks like outside the main chat UI) but the tool doesn't finish, all you see is "...."

Expected behavior
If the BigQuery MCP feature is not enabled in the GCP project (which is the case for the project bigquery-public-data), an appropriate error should be reported to the user and the user should be able to continue to chat normally.

Screenshots
screen/5c337S54ceDgprf

Desktop (please complete the following information):

  • OS: Linux
  • Python version(python -V): 3.11.4
  • ADK version(pip show google-adk): 1.21.0

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used(e.g. gemini-2.5-flash)

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    mcp[Component] Issues about MCP supporttools[Component] This issue is related to tools

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions