gaql-google-ads-query-language

gaql-google-ads-query-language is a cursor rule for Cursor from cohnen/mcp-google-ads. It costs 8 tokens per session (2,584 once invoked), scanned A, original, MIT.

A set of guidelines for GAQL, the query language used to request data from the Google Ads API. It explains resources, attributes, segments, metrics, and the structure of SELECT, FROM, WHERE, and ORDER BY queries.

In plain words
What is it for?
Use it when writing queries for campaigns, ad groups, performance data, or Google Ads API field metadata.
Why use it?
Google Ads queries can return unexpected groupings or results when fields are used incorrectly, especially when metrics and segments are mixed.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when writing queries for campaigns, ad groups, performance data, or Google Ads API field metadata.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/cohnen/mcp-google-ads/gaql-google-ads-query-language
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/cohnen/mcp-google-ads

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gaql-google-ads-query-language

README.md
[![agentmods](https://agentmods.dev/badge/rules/cohnen/mcp-google-ads/gaql-google-ads-query-language/github.svg)](https://agentmods.dev/rules/cohnen/mcp-google-ads/gaql-google-ads-query-language)
Your own site
<a href="https://agentmods.dev/rules/cohnen/mcp-google-ads/gaql-google-ads-query-language"><img src="https://agentmods.dev/badge/rules/cohnen/mcp-google-ads/gaql-google-ads-query-language/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for gaql-google-ads-query-language

Your own site · 80×15
<a href="https://agentmods.dev/rules/cohnen/mcp-google-ads/gaql-google-ads-query-language"><img src="https://agentmods.dev/badge/rules/cohnen/mcp-google-ads/gaql-google-ads-query-language.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 8 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,584 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00008 $0.02584
Opus 5 $0.00004 $0.01292
Sonnet 5 $0.00002 $0.00517
Haiku 4.5 $0.00001 $0.00258

Measured 11d ago against content hash 6a538750e611, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

gaql-google-ads-query-language scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/gaql-google-ads-query-language.mdc · 391 lines

How it starts

The opening of the file, as written. The whole thing — 391 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Overview

The Google Ads Query Language (GAQL) is a powerful tool for querying the Google Ads API that allows you to retrieve:

  1. Resources and their related attributes, segments, and metrics using GoogleAdsService.Search or GoogleAdsService.SearchStream
  2. Metadata about available fields and resources using GoogleAdsFieldService

Field Categories

Understanding field categories is essential for building effective GAQL queries:

  1. RESOURCE: Represents a primary entity (e.g., campaign, ad_group) that can be used in the FROM clause
  2. ATTRIBUTE: Properties of a resource (e.g., campaign.id, campaign.name). Including these may segment results depending on the resource relationship
  3. SEGMENT: Fields that always segment search queries (e.g., segments.date, segments.device)
  4. METRIC: Performance data fields (e.g., metrics.impressions, metrics.clicks) that never segment search queries

Query Structure

A GAQL query consists of the following components:

SELECT
  <field_1>,
  <field_2>,
  ...
FROM <resource>
WHERE <condition_1> AND <condition_2> AND ...
ORDER BY <field_1> [ASC|DESC], <field_2> [ASC|DESC], ...
LIMIT <number_of_results>

SELECT Clause

The SELECT clause specifies the fields to return in the query results:

SELECT
  campaign.id,
  campaign.name,
  metrics.impressions,
  segments.device

Only fields that are marked as selectable: true in the GoogleAdsField metadata can be used in the SELECT clause.

FROM Clause

The FROM clause specifies the primary resource type to query from. Only one resource can be specified, and it must have the category RESOURCE.

FROM campaign

WHERE Clause (optional)

The WHERE clause specifies conditions to filter the results. Only fields marked as filterable: true in the GoogleAdsField metadata can be used for filtering.

WHERE 
  campaign.status = 'ENABLED'
  AND metrics.impressions > 1000
  AND segments.date DURING LAST_30_DAYS

Read the full file on GitHub · 391 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 391 lines · 8 tokens per session scan A 6a538750e611

Subscribe to this mod's changes

gaql-google-ads-query-language is a cursor rule published in the GitHub repository cohnen/mcp-google-ads (706 stars, last pushed 10mo ago), licensed MIT. It adds 8 tokens to every session and 2,584 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.