Skip to main content
Glama

Run a GAQL query

run_gaql_report
Read-only

Run an arbitrary read-only Google Ads Query Language (GAQL) SELECT against an account and return the raw rows. The power tool for anything the structured tools don't cover. Only SELECT is allowed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gaqlYesA GAQL SELECT statement, e.g. "SELECT campaign.name, metrics.clicks FROM campaign WHERE segments.date DURING LAST_7_DAYS". Enum-typed fields only accept their exact string name in WHERE (e.g. `campaign.status = 'ENABLED'`), never the field's underlying numeric/ordinal value (e.g. NOT `= '2'` or `= 2`) and never LIKE/wildcards. Use IN (...) with the exact enum name(s), e.g. WHERE campaign.status IN ('ENABLED','PAUSED'), or omit the filter and inspect the returned enum values in a first pass. Any metrics/segments field requires a `segments.date` filter that bounds a finite range - bound `segments.date` with either `segments.date DURING LAST_30_DAYS` (or another named range: TODAY, YESTERDAY, LAST_7_DAYS, THIS_MONTH, LAST_MONTH, ...) or `segments.date BETWEEN 'YYYY-MM-DD' AND 'YYYY-MM-DD'`. A single-sided comparison (`segments.date >= '...'`) does not count as a finite range. Otherwise Google errors with "Expects filters on the following field to limit a finite date range: 'segments.date'". For keyword-level metrics (impressions, clicks, cost, conversions, ...), query `FROM keyword_view`, not `FROM ad_group_criterion` - ad_group_criterion only exposes the criterion's own config (status, keyword.text, keyword.match_type, quality_info, ...) and has no metrics. On keyword_view, name the keyword with the `ad_group_criterion.keyword.text` / `ad_group_criterion.keyword.match_type` fields, not `segments.keyword.info.text` / `segments.keyword.info.match_type` - that segment labels a different resource's rows by the keyword involved (e.g. search_term_view), and keyword_view rows are already one per keyword. Otherwise Google errors with "metric/segment is incompatible with the resource in the FROM clause". `change_event` and `change_status` don't support `segments.date` at all - use their own date/time field instead: `change_event.change_date_time` on change_event, `change_status.last_change_date_time` on change_status. Conversion-related segments (segments.conversion_action_name, segments.conversion_action_category, segments.conversion_lag_bucket, ...) only combine with conversion-specific metrics (metrics.conversions, metrics.all_conversions, metrics.conversions_value, ...) - ordinary metrics like clicks, impressions, and cost_micros aren't computed per conversion action, and Google names the ones actually blocking the query as "unsupported metrics" above. Drop those metrics from this query, or run them separately without the conversion segment. GAQL requires that any field used in WHERE or ORDER BY also appear in the SELECT list - add the named field there too. `DURING` only accepts a fixed set of named ranges: TODAY, YESTERDAY, LAST_7_DAYS, LAST_14_DAYS, LAST_30_DAYS, LAST_BUSINESS_WEEK, THIS_WEEK_SUN_TODAY, THIS_WEEK_MON_TODAY, LAST_WEEK_SUN_SAT, LAST_WEEK_MON_SUN, THIS_MONTH, LAST_MONTH - there's no LAST_90_DAYS or other custom-length range. For anything else, use `segments.date BETWEEN 'YYYY-MM-DD' AND 'YYYY-MM-DD'` with explicit dates instead. `change_event` and `change_status` cap how far back `segments.date`/the relevant date field can start - 30 days for change_event, 90 for change_status - Google simply doesn't retain older history. Narrow the `BETWEEN`/`DURING` range to stay within that limit. `change_event` and `change_status` queries must end with an explicit `LIMIT n` where n <= 10000, e.g. `LIMIT 1000` - Google rejects them outright with no LIMIT clause at all. `change_event` has no `resource_type` field - that name belongs to `change_status`. On `change_event` the equivalent is `change_event.change_resource_type` (an enum, e.g. AD, CAMPAIGN, AD_GROUP, ...). GAQL's WHERE clause doesn't support parentheses or boolean grouping - conditions can only be ANDed together as a flat list, and there's no OR at all. Remove the parentheses; if you need an OR over the same field's values, use `IN (...)` instead, and if you need an OR across different fields, run separate queries and merge the results.
customerIdNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and openWorldHint=true, covering the safety profile. The description reinforces read-only behavior and adds 'only SELECT is allowed' and 'return the raw rows,' but does not disclose other operational traits like rate limits, pagination, or error handling. With annotations carrying the main behavioral load, this is a modest addition.

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

Conciseness5/5

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

Three short sentences with no filler, and the core purpose and fallback guidance are front-loaded. It is appropriately sized for a tool description, with detailed parameter constraints correctly delegated to the schema.

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

Completeness3/5

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

For an arbitrary-query tool, the description covers the basic contract: read-only, SELECT-only, raw rows, and fallback role. However, it does not explain the customerId parameter, and without an output schema or annotations describing return shape beyond 'raw rows,' more context would help an agent invoke it confidently.

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

Parameters2/5

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

The description adds no parameter meaning; schema description coverage is only 50% because the required gaql parameter is richly documented in the schema while customerId has no description anywhere. The description does not compensate for the undocumented customerId or explain parameter formats, leaving a clear gap.

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?

The description states a specific verb, resource, and scope: 'Run an arbitrary read-only GAQL SELECT against an account and return the raw rows.' It explicitly positions itself against siblings as 'the power tool for anything the structured tools don't cover,' so an agent can distinguish it from structured report tools without opening schemas.

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

Usage Guidelines4/5

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

It gives clear usage context: use this when structured tools do not cover the need, and it notes the SELECT-only restriction. However, it does not explicitly name alternatives or say when not to use it, so it falls short of the full when/when-not/alternatives guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources