Skip to main content
Glama

Google Ads & Meta Ads

Google Ads: Run Query

gads_query
Read-onlyIdempotent

Run a read-only Google Ads Query Language (GAQL) SELECT against the account and return the raw rows. Use this for reporting questions the typed tools do not cover — a breakdown by device and day of week, impression share lost to rank, month-over-month by network, ad approval status. Prefer the typed tools where one fits: gads_get_insights for standard performance, gads_list_campaigns, gads_list_ads, gads_list_keywords, gads_list_search_terms. This tool cannot change anything; every write has its own tool. Call gads_get_resource_metadata first when unsure which fields a resource has. Note the case difference: the query is written in snake_case (campaign.name, metrics.cost_micros) and the rows come back in camelCase (campaign.name, metrics.costMicros), because that is what the API returns. Money arrives in micros — divide by 1,000,000. A query with no LIMIT gets LIMIT 100, and LIMIT above 1000 is lowered to it. GAQL has no OR and no parentheses: use IN, REGEXP_MATCH, or separate queries. Campaign dates are campaign.start_date_time and campaign.end_date_time. change_event only reaches back 30 days and needs a LIMIT. Not every resource accepts segments.date — check gads_get_resource_metadata first.

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": {
      "query": "<query>"
    },
    "name": "gads_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesThe GAQL statement, e.g. "SELECT campaign.name, segments.device, metrics.cost_micros, metrics.conversions FROM campaign WHERE segments.date DURING LAST_30_DAYS ORDER BY metrics.cost_micros DESC". One SELECT, no semicolon. Date ranges use segments.date with DURING or BETWEEN.
customer_idNoGoogle Ads account to read: customer id or account name (from gads_list_ad_accounts). Pass it whenever the conversation is about a particular account; omitted, the only account or the stored default is used.

Output Schema

NameRequiredDescriptionDefault
rowsYesOne object per result row, nested exactly as the Google Ads REST API returns it (camelCase field paths).
queryYesThe query as actually sent, which differs from the one passed in when a LIMIT was added or lowered.
rowCountYesNumber of rows returned.
fieldMaskNoGoogle's own comma-separated list of the field paths present in the rows.
truncatedYesTrue when the row cap was reached, so more rows match than were returned.
customerIdYesCustomer account the query ran against.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnlyHint, idempotentHint, destructiveHint=false), but the description adds real behavior the annotations cannot: the tool cannot change anything, an absent LIMIT defaults to 100, LIMIT above 1000 is silently lowered, change_event only reaches back 30 days, money is returned in micros, and snake_case input comes back camelCase. These are exactly the operational details that cause silent failures. One notch off 5 only because it does not touch on rate limits or per-account quotas for open-world queries.

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 routing guidance, then operational gotchas in roughly descending importance. Nearly every sentence carries a fact an agent would otherwise get wrong. It is dense to the point of being a wall of prose — a short bulleted 'gotchas' block would scan better — but there is little fat to cut.

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 free-form query tool over an open-world API, this covers the failure modes that matter: syntax limitations, date-segment restrictions, default and capped LIMIT, micros conversion, and case mapping on results. An output schema exists, yet the description still flags the camelCase/micros return quirks, which is genuinely additive rather than redundant.

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 the baseline is 3, and the description exceeds it by adding semantics the schema does not: GAQL has no OR and no parentheses (use IN, REGEXP_MATCH, or split queries), campaign dates live at campaign.start_date_time/end_date_time, not every resource accepts segments.date, and implicit LIMIT behavior. This materially changes how the query parameter should be written.

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 the exact verb and resource — run a read-only GAQL SELECT against the account returning raw rows — and immediately distinguishes itself from the typed siblings by listing reporting questions they do not cover (device x day-of-week, impression share lost to rank, month-over-month by network). An agent can separate this from gads_get_insights or gads_list_campaigns without opening a schema.

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 when-to-use (non-standard reporting breakdowns), explicit when-not ('Prefer the typed tools where one fits'), named alternatives (gads_get_insights, gads_list_campaigns, gads_list_ads, gads_list_keywords, gads_list_search_terms), and a prerequisite ('Call gads_get_resource_metadata first when unsure which fields a resource has'). Also routes writes away from this tool entirely.

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