Skip to content

ADK doesn't report errors from McpToolset #4162

Closed

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.

Activity

  1. added
    mcp
    tools
    on Jan 14, 2026
  2. added theissue type on Jan 14, 2026
  3. adk-bot commented on Jan 22, 2026

    @adk-bot
    Collaborator

    Notification: The author has updated the issue description. Maintainers, please review.

  4. klateefa commented on Feb 12, 2026

    @klateefa

    @shobsi Thanks for reporting!
    The 403 response indicates that the request is successfully reaching the BigQuery MCP endpoint, but the project being used does not have MCP enabled or does not have permission to access it. So this is not an authentication or token issue. The real problem appears to be error handling in ADK Web: the 403 is surfaced as a generic “network error,” and the tool never completes, leaving the UI stuck. Ideally, the 403 should be handled gracefully and shown as a proper tool error so the user can continue chatting normally.
    Thank you.

  5. self-assigned this
    on Feb 12, 2026
  6. added
    answered
    on Feb 12, 2026
  7. shobsi commented on Feb 18, 2026

    @shobsi
    CollaboratorAuthor

    @klateefa thanks for looking into it. So it sounds like the fix is two fold:

    1. Report correct error so that the user can go enable the MCP
    2. Fix adk web UI so that the user can carry on the conversation.

    Hope we can prioritize it soon.

  8. self-assigned this
    on Jun 16, 2026
  9. GWeale commented on Jun 16, 2026

    @GWeale
    Collaborator

    Was fixed in 7744cfe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

answeredmcptools

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions