Skip to main content
Glama
deBilla

BigQuery MCP

by deBilla

run_query

Read-onlyIdempotent

Execute read-only SELECT queries on BigQuery with dry-run cost estimation, returning rows only after confirming expensive scans.

Instructions

Run a read-only (SELECT/WITH) SQL query against BigQuery and return rows.

Cost safety: the query is ALWAYS dry-run first to estimate how much data it will scan. If that estimate is above the warning threshold, the query does NOT run — instead this returns status: "confirmation_required" with the estimated size and cost. Stop there, tell the user the estimated scan and cost, and ask. Only re-call with confirm_expensive=true once they have agreed: that flag records the user's decision, not yours. Queries above the hard cap never run, even with confirmation.

Always fully-qualify tables as <project>.<dataset>.<table>, and check get_table_schema first — a WHERE clause only limits the scan on a table that is actually partitioned.

Args: sql: A SELECT (or WITH ... SELECT) query. max_rows: Max rows to return, to keep responses small. 0 (the default) uses the server's configured limit. confirm_expensive: Set True only after the user has agreed to a query previously flagged as costly. Leave False for the first attempt. environment: Which configured BigQuery environment to query. Omit to use the default. Call list_environments to see what exists.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
max_rowsNo
environmentNo
confirm_expensiveNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.0

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare readOnlyHint/destructiveHint but don't convey the two-phase dry-run cost gate, the warning-threshold stop condition, the hard cap that never runs even with confirmation, or the confirmation_required status payload. This is exactly the behavioral context annotations cannot express, and the description delivers it.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose then cost-safety then qualification advice then args. Every sentence earns its place. Slightly prose-heavy in the cost paragraph, but the detail is load-bearing for safe invocation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-param query tool with no output schema, the description covers execution semantics, cost gating, the confirmation_required return shape, table qualification, and environment selection. Nothing essential to correct invocation is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description carries the full burden. It documents all four params: sql (SELECT/WITH), max_rows (0=server default), confirm_expensive (only after user agreement, records user decision not agent's), and environment (omit for default, list_environments to discover). Semantic value well beyond bare schema titles/defaults.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Run a read-only SELECT/WITH SQL query against BigQuery and return rows'). The read-only constraint and SQL dialect are explicit, distinguishing it from sibling listing/schema tools that don't execute queries.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit workflows: check get_table_schema first before writing WHERE clauses; call list_environments to see environments; the dry-run confirmation protocol states exactly when to stop, what to tell the user, and when to re-call with confirm_expensive. Names siblings (get_table_schema, list_environments) and the condition for each.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.