Skip to main content
Glama
google-ads-agents

google-ads-agents

Google Ads Agents

Paid media audits, tracking checks and reviewed changes.

Tests Release Python 3.10+ MIT license arcbaslow/google-ads-agents MCP server

Quick start | How an audit runs | Example output | MCP | Tests | Contributing

A Python toolkit for investigating Google Ads accounts and preparing changes for review. Use individual adapters from a terminal, or use the specialist agents and /gads skills in an agent runtime. API responses are structured JSON; the audit driver combines them into reports.

What you can do

Area

Included capabilities

Campaigns

Search, Performance Max, App, Display, Demand Gen, Shopping and YouTube analysis

Measurement

Conversion-action health and Google tag checks

Optimization

Search-term mining, negative candidates, recommendations with a brand hold, Quality Score and bid-strategy fit

Delivery

Budget pacing, anomalies, placement classification, demographic and geographic breakdowns

Assets

RSA strength, PMax linked asset inventory, creative briefs and asset workflows

Account operations

Per-MCC auth profiles, saved audit history and multi-account audits

Reviewed changes

PAUSED Search, Demand Gen, Display and App campaigns, App targets, negatives, placements, Display targeting, image and YouTube video assets, and Video/Display ad edits with JSON review, confirmation and validation

Related MCP server: Google Ads MCP Worker

How an audit runs

flowchart LR
  A["gads_audit.py<br/>--customer ID --days 28"] --> B["16 read-only adapters, up to 6 at a time<br/>conversions, Search, search terms, PMax,<br/>App, Display, Demand Gen, Shopping, YouTube,<br/>auction insights, placements, recommendations,<br/>bid strategy, pacing, Quality Score, demographics"]
  A -. "--site URL" .-> C["Google tag scan<br/>and linked accounts"]
  B --> D[("audit.json")]
  C --> D
  D --> E["gads_report.py<br/>Markdown or HTML"]
  D -. "--save-history" .-> F["Saved snapshot"]
  classDef step fill:#eef3fe,stroke:#2563eb,color:#17202a
  class A,B,C,D,E,F step

No adapter waits on another, so one failed read does not stop the rest. Read the conversion findings and the tag-scan limits first; bidding, pacing and search-term results depend on them.

Installation

Requires Python 3.10+. Live queries also require Google Ads account access, an approved OAuth Cloud project, and Google Cloud SDK (gcloud) for the default authentication path.

git clone https://github.com/arcbaslow/google-ads-agents.git
cd google-ads-agents
python -m venv .venv

Activate the environment with source .venv/bin/activate on macOS/Linux or .venv\Scripts\Activate.ps1 in Windows PowerShell. Then:

python -m pip install -e ".[dev]"

Prefer uv? Run uv venv, uv pip install -e ".[dev]", then prefix Python commands with uv run.

Quick start

First print and run the Google sign-in command, then register a manager-account profile:

python scripts/gads_auth.py --adc
# Run the gcloud command printed above, then configure your profile:
python scripts/gads_auth.py --add-profile demo --login-customer-id YOUR_MCC_ID
python scripts/gads_auth.py --use-profile demo
python scripts/gads_auth.py --check
python scripts/gads_auth.py --customers

Replace the example customer ID below with an account returned by --customers:

python scripts/gads_audit.py --customer 1234567890 --days 28 --output audit.json
python scripts/gads_report.py --input audit.json --format md --output audit.md

Add --site https://example.com to include the website tag check, and --save-history to retain a snapshot. The local session expires after 24 hours. For multiple MCCs, add profiles and switch with --use-profile. For an OAuth-client fallback, see setup.

Developer tokens are optional legacy configuration. API access belongs to the OAuth Cloud project; see setup for approval and authentication instructions.

Example output

Google Ads audit rendered from the bundled synthetic example

The screenshot shows the actual Markdown report, rendered for documentation, using synthetic data. Reproduce it locally without Google credentials:

python scripts/gads_report.py --input examples/demo/audit.json --format md --output audit.md
python scripts/gads_report.py --input examples/demo/audit.json --format html --output audit.html

Read the generated report or inspect the input fixture.

Everyday commands

python scripts/gads_search.py --customer 1234567890 --days 28 --negative-candidates --json
python scripts/gads_demandgen.py --customer 1234567890 --days 28 --json
python scripts/gads_placements.py --customer 1234567890 --days 28 --json
python scripts/gads_recommendations.py --customer 1234567890 --json
python scripts/gads_anomalies.py --customer 1234567890 --days 30 --baseline-days 14 --z 2.0 --json
python scripts/gads_history.py --customer 1234567890 --changes --days 7 --json
python scripts/gads_audit.py --all-customers --days 28 --save-history --output audits.json

Use --help on an adapter for its complete flags. Most read commands print a compact summary; --json selects machine-readable output. The audit driver always emits JSON.

Read-only GAQL and saved multi-account audit exports are documented in REPORTING.md; local monitoring output does not refresh credentials or schedule new account reads. See read-only interoperability for query and export handoffs, and offline evaluation for safety task fixtures.

Agent workflow

The router exposes commands such as:

/gads audit 1234567890
/gads search 1234567890
/gads pmax 1234567890
/gads conversions 1234567890
/gads pacing 1234567890
/gads quality 1234567890

The repository includes plugin metadata, specialist agent definitions and skills. Other runtimes can follow AGENTS.md and call the same Python adapters. The audit skill runs the standalone driver, then interprets conversion checks and tag-scan limitations before wider analysis. Raw adapter outputs differ; failed blocks and missing fields are not a clean bill of health.

Changes to an account

Supported write commands print the operation JSON to stderr and require an explicit y at a y/N prompt. --apply validates the same operations before applying them; --validate-only stops after validation. The flags are mutually exclusive. Piped stdin, EOF or unavailable input cancels the request.

# Produce a campaign planning draft without calling the API.
python scripts/gads_creation.py --customer 1234567890 --context-file context.json --json

# Validate proposed negatives without applying them.
python scripts/gads_apply.py --customer 1234567890 negatives --input negatives.json --validate-only --json

# Review and upload a local video once (interactive terminal required).
python scripts/gads_upload_video.py --customer 1234567890 --file video.mp4 --title "Product demo" --description "Product walkthrough" --json

Video uploads default to UNLISTED; --privacy PUBLIC needs --channel-id for a brand channel, since Google-managed channels accept only UNLISTED. Uploads have no validate-only mode: the CLI previews the resolved file path, size and metadata, requires terminal y/N, and opens the upload session once with a 30-minute deadline. Within that session the SDK may resend chunks after a network error, which cannot create a second upload. It returns the upload resource, upload ID and a processing-state query for MCP run_gaql. Any failure after confirmation reports outcome_unknown.

Campaign context produces a planning draft and does not verify measurement health. Separate strict --search-spec, --demand-gen-spec, --display-spec and --app-spec JSON files create PAUSED campaigns atomically after terminal review, with --validate-only or --apply. Display creates one standard ad group and one responsive Display ad from existing image assets, with a daily budget and campaign-level geo and language criteria. Video campaigns cannot be created through the API; use Demand Gen with a VIDEO_RESPONSIVE ad to reach YouTube inventory. See bounded writes for the Search, Demand Gen, Display and App fields and limits.

Optional hooks and sign-in service

The hooks guide covers the session-expiry guard and opt-in Telegram notifications. The separate FastAPI service in webapp/ supports hosted sign-in; it is not required to run local audits.

MCP

scripts/gads_mcp.py exposes eleven read-only tools to an MCP client, plus fourteen gated write tools for a host. Run it as a standalone stdio server (read tools only), or import it in a host FastMCP server and call register(server, prefix="", provider_factory=None) and register_writes(server, gate, prefix="", provider_factory=None), which return the number of tools added.

python -m pip install -e ".[mcp]"
gads-mcp

Tool

Returns

limit default / max

list_accounts

Accounts under the profile's manager account: ID, name, level, currency, time zone and status. Without a manager account, the customer IDs the credentials can access directly.

200 / 500

run_gaql

Rows for one GAQL SELECT against a customer ID. Only a single statement is accepted, optionally ending in one LIMIT n, without PARAMETERS, comments or semicolons. Rows are bounded by the smaller of that LIMIT and limit.

100 / 500

resource_metadata

GAQL resources, or the fields under a resource or prefix, with selectable, filterable and sortable flags. detail=true adds enum values and the resources, metrics and segments a name can be selected with.

200 / 500

account_audit

Status and summary of every read-only audit agent, plus the top findings by severity. Raw agent data, the website tag scan and saved snapshots are not included.

50 / 200

anomalies_and_pacing

Day-level metric anomalies and month-to-date budget pacing, together or separately.

50 / 200 per list

change_history

Recent change_event entries over up to 30 days. Actor emails are reduced to their domain.

50 / 200

keywords

Keyword criteria (not negatives) with criterion ID, ad group ID, campaign ID, text, match type and status. Filters: campaign, ad group, status (default all but REMOVED).

200 / 500

ads

Ads with ad ID, ad group ID, campaign ID, type, status, policy approval status and final URLs. Same filters as keywords.

200 / 500

search_terms

Search terms between two dates, highest cost first: term status, campaign and ad group IDs, matched keyword text, match type and criterion ID, cost, clicks, impressions, conversions. The matched keyword's own status is not in this report; look it up with keywords.

200 / 500

asset_group_assets

Performance Max asset group links: field type, asset ID, type, name or text, link status and primary status. API v25 has no asset performance label.

200 / 500

shared_blocklists

Reusable NEGATIVE_KEYWORDS and NEGATIVE_PLACEMENTS shared sets with member and linked campaign counts. Pass shared_set_id to also list criteria IDs and linked campaigns.

200 / 500

Every tool registered by register is annotated read-only. These tools call only GoogleAdsService search, CustomerService.ListAccessibleCustomers and GoogleAdsFieldService search. They do not write to an account, save audit snapshots, send notifications or change local credential files. Bounded results include rows_returned and complete; complete: false means rows were cut by limit, or an audit agent failed. Failures return {"error": "<category>", "hint": "..."}, where the category is auth_required, permission_denied, quota_exceeded, invalid_argument, not_found or upstream_error. Provider error messages are not passed through.

With shared_set_id, shared_blocklists caps criteria and campaigns independently at limit. criteria_complete and campaigns_complete report whether each detail list is complete. Top-level complete is false if blocklists, criteria or campaigns were cut; rows_returned counts only the returned blocklists.

Write tools. register_writes adds these tools. Each takes confirm and profile.

Tool

Changes

Mutate

set_keyword_status

Up to 200 keywords of one ad group to ENABLED or PAUSED (ad_group_criterion.status).

AdGroupCriterionService

set_ad_status

Up to 200 ads of one ad group to ENABLED or PAUSED (ad_group_ad.status).

AdGroupAdService

update_campaign_schedule

Campaign end_date_time (YYYY-MM-DD 23:59:59) and, before the campaign starts, start_date_time (YYYY-MM-DD 00:00:00).

CampaignService

set_conversion_action_goal

conversion_action.primary_for_goal: primary or secondary for its goal.

ConversionActionService

add_placement_exclusions

Up to 200 campaign-level negative placement, YouTube channel, YouTube video and mobile app criteria, all or none.

CampaignCriterionService

update_asset_group_assets

Links existing assets to a Performance Max asset group and unlinks others, unlinks first, all or none. No upload. Annotated destructive.

AssetGroupAssetService

manage_labels

Create, update supplied fields or remove one label. Names up to 80 characters, descriptions up to 200 and #RRGGBB colors. Annotated destructive.

LabelService

manage_label_associations

Attach or remove a label on up to 200 campaigns, ad groups or ad group criteria. Customer-level labels are not supported yet. Checks existing links and refuses Video campaign targets. Annotated destructive.

Campaign, ad group and criterion label services

create_asset

Create an unlinked text, image, YouTube video, sitelink, callout or structured snippet asset. Images are base64 PNG/JPEG/GIF up to 5120 KB; previews contain only MIME, byte count and SHA-256. Use update_asset_group_assets to link to PMax.

AssetService

create_demand_gen_campaign

PAUSED Demand Gen campaign, one ad group and one ad from existing assets. Same strict spec as --demand-gen-spec, including channel controls and VIDEO_RESPONSIVE for YouTube inventory.

GoogleAdsService (atomic)

create_display_campaign

PAUSED Display campaign, one standard ad group and one responsive Display ad from existing images. Same strict spec as --display-spec.

GoogleAdsService (atomic)

create_app_campaign

PAUSED App install or engagement campaign, one ad group and one ad from existing assets. Same strict spec as --app-spec, with conversion-action and user-list checks.

GoogleAdsService (atomic)

manage_shared_blocklist

Create (CREATE, optionally seeding up to 200 items atomically), populate (ADD_ITEMS), trim (REMOVE_ITEMS) or remove (REMOVE) a NEGATIVE_KEYWORDS or NEGATIVE_PLACEMENTS shared set. Annotated destructive.

SharedSetService, SharedCriterionService, or GoogleAdsService (atomic)

manage_campaign_blocklists

Attach (CREATE) or detach (REMOVE) an ENABLED shared negative list on up to 200 campaigns. Checks existing links and refuses Video campaigns. Annotated destructive.

CampaignSharedSetService

For manage_shared_blocklist operations ADD_ITEMS, REMOVE_ITEMS and REMOVE, the preview includes reference_count, member_count, and campaigns with customer ID, campaign ID, name, status and advertising channel type for ENABLED links to campaigns that are not removed. The preview lists at most 200 campaigns; campaigns_complete: false means it was cut. account_level reports whether the list is linked through customer_negative_criterion in the same account. When true, item edits include a scope_note stating that the change applies to the whole account; a scope_note also appears when reference_count is higher than the links listed, since the count may include removed campaigns or links from other accounts. REMOVE refuses an account-level list before the host gate and before sending any mutate, including validation, on both the dry run and the confirmed call; detach the customer-level link before requesting a new dry run. manage_campaign_blocklists previews include the list's member_count and list_type for both attach and detach. Counts, types and scope are re-read on confirmation; changes, including campaign links beyond the preview cap, return conflict.

Campaign creation checks referenced asset types and rejects an existing non-REMOVED campaign with the same name. References and matching campaigns are re-read on confirmation; changed state returns conflict. Each campaign request uses partial_failure=False.

A call without confirm changes nothing: it reads the targets, sends the operations with validate_only, and returns current and new values with a single-use confirm token valid for 10 minutes. The identical call with that token calls the host's gate(), then sends the same operations once, with a 60-second deadline and no automatic retry. Different arguments or a used token return invalid_argument; targets that changed since the dry run return conflict; in both cases nothing is sent. A gate refusal is returned unchanged and keeps the token. A Google Ads rejection returns errors with only the API's error codes and field paths. A timeout or server error on a confirmed write says the change may have been applied; read before trying again. Video campaigns return not_supported, since the API rejects every change to them. Each confirmed write logs one line: ads write <tool> <resource> outcome=<ok|category>. The OAuth scope is the same adwords scope the read tools use; the Google Ads user needs Standard or Admin access to the account.

Authentication. Every tool accepts profile. The standalone server uses the active local profile from gads_auth.py, including the 24-hour session cap. It never switches profiles: naming a different profile returns invalid_argument with the --use-profile command to run locally. A host can pass provider_factory(profile), which returns a gads_provider.CredentialProvider, to supply its own per-profile credentials. A developer token is optional. credentials_present() reports whether a local credentials file, a GOOGLE_APPLICATION_CREDENTIALS file or the gcloud application-default credentials file exists. It does not open these files or make a network call.

Quotas. Each request counts against the Google Ads API quota of the OAuth Cloud project. account_audit sends 20 search requests, plus one search-terms request when scripts/brand_rules.json has brand terms for the customer (cached 15 minutes). The other tools send one request, or two for anomalies_and_pacing with check="both", plus that same search-terms request for pacing when brand terms are configured. When the API reports a quota or rate limit, the tool returns quota_exceeded; retry later or narrow the request.

Tests

python -m pytest scripts/ -q
python -m ruff check scripts/ hooks/ webapp/

# Optional hosted sign-in service: install its dependencies, then test it.
python -m pip install -r webapp/requirements.txt
python -m pytest webapp/tests/ -q

The suites use mocks and temporary credential stores. They cover auth profiles and expiry, GAQL, placement rules, campaign validation, report rendering, audit history, optimization heuristics, hooks, OAuth, sessions and the web API. No live Google Ads account is needed. CI runs the adapter and webapp suites on Python 3.10–3.13; see the verification record for the release run.

Repository map

Path

Purpose

scripts/

API adapters, report rendering and unit tests

agents/, skills/

Specialist instructions and /gads routing

hooks/

Session guard and Telegram notifications

webapp/

Optional hosted sign-in service and tests

examples/demo/

Reproducible report with synthetic data

docs/

Setup, hooks, release and verification guides

Releases

v0.7.0 - see the release notes for this release and the changelog for project history.

GitHub Releases include downloadable artifacts and checksums. Package-registry publication is a separate, opt-in workflow; a GitHub release does not imply that the same version is available on PyPI or npm. Maintainers can follow the release guide.

Contributing

Read CONTRIBUTING.md, run the checks above, and include a minimal reproduction for bugs. Report vulnerabilities through SECURITY.md.

Project

Use it for

Google Analytics Agent

GA4 data quality, funnels and property management.

Search Console Agent

Search performance, indexing and page experience.

Meta Ads Agents

Campaign performance, creative fatigue and event health.

GTM Diff

Review the changes in your Google Tag Manager exports.

Figma Taxonomy Gen

Turn interactive designs into a reviewable tracking plan.

Maintained by Good Labs - measurement implementation, tracking plans and analytics audits.

License

MIT © Dilshat Rakhimov. This is an independent project; it is not an official product of the platform vendors.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables interaction with Google Ads through the Google Ads API using GCloud authentication. Supports GAQL query execution, performance data retrieval, account management, and resource discovery with pagination and multiple output formats.
      9
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables management of Google Ads accounts via MCP, providing read and write tools for campaigns, ad groups, keywords, assets, and more, with support for reporting and mutations.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Claude, ChatGPT, Copilot, and Cursor to read Google Ads data—campaigns, ad groups, ads, keywords, search terms, budgets, conversion actions, change history, and custom GAQL queries—through 17 read-only MCP tools. It supports OAuth-authenticated access to real accounts without requiring a developer token, keeping all operations read-only and auditable.
      58 npm
      AGPL 3.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP clients to manage Google Ads accounts through guarded tools for GAQL reporting, keywords, ads, budgets, callouts, and sitelinks, with dry runs and paused-by-default creates.
      Apache 2.0