Skip to main content
Glama

Run a BigQuery query

bq_query_run
Read-only

Runs a read-only GoogleSQL SELECT or WITH query and returns rows as a Markdown table; use dry_run to validate SQL and estimate bytes scanned before execution.

Instructions

Runs one read-only GoogleSQL query (a single SELECT or WITH statement) and returns the rows as a Markdown table, ending with rows received / total rows, bytes scanned and whether the cache was used. Use it to look at data or check numbers; with dry_run it only validates the query and estimates the bytes it would scan. Anything that changes data is refused before it is sent (save SQL with bq_view_create instead); the configured max_bytes_billed caps the cost, and max_rows above the configured limit is lowered to it.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sql": "<sql>"
    },
    "name": "bq_query_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesOne GoogleSQL statement starting with SELECT or WITH; one trailing semicolon is fine.
dry_runNoOnly validate the query and estimate the bytes it would scan, without running it.
max_rowsNoMost rows to return (1–10000). Defaults to max_rows in the config (500), which is also the upper limit.
project_idNoGoogle Cloud project id, e.g. "my-project". Defaults to billing_project in the config, then the project of the Application Default Credentials.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.7/5.0
Behavior5/5

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

readOnlyHint=true is already declared, yet the description still adds substantive behavior: mutating statements are refused before being sent, the configured max_bytes_billed caps cost, and a max_rows request above the configured limit is silently lowered rather than rejected. It also documents the response shape (rows plus totals, bytes scanned, cache usage), which is not inferable from the annotations.

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 the action and constraint, then the use cases, then the safety/cost behavior — no filler sentences. It is dense to the point of being a single long paragraph, and the last clause about max_rows clamping is buried inside a sentence carrying two other facts.

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

Completeness4/5

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

With no output schema, the description carries the burden of explaining the return value, and it does (Markdown table plus rows/total/bytes/cache). Together with mutation refusal, cost caps, and dry-run semantics this is close to complete; only error surfacing and how truncated results are signaled beyond the row counters are left unstated.

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

Parameters4/5

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

Schema coverage is 100%, so baseline would be 3, but the description adds behavior beyond the schema: max_rows is clamped down to the configured limit instead of erroring, and dry_run's cost-estimation role is tied to the max_bytes_billed guard. The only missing link is that the referenced config values (max_bytes_billed, configured max_rows default) are not exposed as parameters.

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 concrete verb and resource ("Runs one read-only GoogleSQL query ... a single SELECT or WITH statement") and specifies the return form (Markdown table plus row counts, bytes scanned, cache status). It also differentiates scope by refusing data-changing statements and pointing at bq_view_create for persistence, so an agent can tell it apart from data-modifying or saved-view tools.

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?

Explicitly gives the primary use case ("look at data or check numbers"), the dry-run alternative ("with dry_run it only validates the query and estimates the bytes it would scan"), and the exclusion with a pointer to a different tool ("save SQL with bq_view_create instead"). Both the when and the when-not are stated rather than implied.

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