Skip to content

fix(tools/bigquery-execute-sql): avoid surfacing invalid queries as MCP 500s#3056

Open
jack-larch wants to merge 4 commits intogoogleapis:mainfrom
jack-larch:fix/bigquery-execute-sql-mcp-errors
Open

fix(tools/bigquery-execute-sql): avoid surfacing invalid queries as MCP 500s#3056
jack-larch wants to merge 4 commits intogoogleapis:mainfrom
jack-larch:fix/bigquery-execute-sql-mcp-errors

Conversation

@jack-larch
Copy link
Copy Markdown

Description

Route bigquery-execute-sql dry-run validation failures through the shared GCP error processor instead of hardcoding them as internal server errors.

This keeps normal BigQuery query mistakes in the tool-error path rather than escalating them into MCP transport failures.

PR Checklist

  • Make sure you reviewed CONTRIBUTING.md
  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

Notes:

  • I could not run go test locally in this environment because the Go toolchain is not installed on this machine.
  • I added a focused regression test around ProcessGcpError so the intended classification is explicit in CI.

🛠️ Fixes #3055

Made with Cursor

…CP 500s

Route dry-run BigQuery validation failures through the shared GCP error processor so normal query mistakes are returned as tool errors instead of transport-level internal errors.

Made-with: Cursor
@jack-larch jack-larch requested review from a team as code owners April 14, 2026 17:03
@google-cla
Copy link
Copy Markdown

google-cla bot commented Apr 14, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the BigQuery SQL execution tool to use a centralized GCP error processing utility, util.ProcessGcpError, instead of a generic internal server error for query validation failures. Additionally, it introduces unit tests for ProcessGcpError to ensure correct mapping of GCP errors to AgentError or ClientServerError based on status codes and error reasons. I have no feedback to provide.

Copy link
Copy Markdown
Contributor

@duwenxin99 duwenxin99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jack-larch Thanks for opening the PR! Could you make sure to sign the CLA? Thanks!

@duwenxin99 duwenxin99 added the release candidate Use label to signal PR should be included in the next release. label Apr 14, 2026
@duwenxin99
Copy link
Copy Markdown
Contributor

/gcbrun

@duwenxin99 duwenxin99 enabled auto-merge (squash) April 16, 2026 14:46
@duwenxin99
Copy link
Copy Markdown
Contributor

/gcbrun

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

Labels

release candidate Use label to signal PR should be included in the next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(bigquery-execute-sql): invalid BigQuery query errors are surfaced as MCP 500s

2 participants