gads_list_ad_groups
Google Ads read low risk
Part of the Google Ads Manager Agent.
What it does
List ad groups in an account or a specific campaign via GoogleAdsService.SearchStream over the ad_group resource, with optional filters (status, type, campaign) and optional performance metrics prior_period deltas via include_prior_period=true. Returns rows of ad_group.id, name, status, type, campaign, bids and (when requested) impressions/clicks/ctr/cost_micros/conversions. Accuracy: monetary fields are micros (/1e6, currency-labeled); including segments.date or segments.device multiplies rows per segment so per-ad-group totals must be summed; metrics must reconcile to the Google Ads UI within +/-1%; results reflect only ad groups the user's account role can see.
When to use it
When the user asks what ad groups exist in a campaign or the account, their status, or their performance side by side.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | 10-digit CID, dashes stripped. |
campaign_id | string | no | Restrict to one campaign (adds WHERE ad_group.campaign = ...). |
status_filter | string | no | AdGroupStatus filter ENABLED|PAUSED|REMOVED (enum-normalized). Omit or pass ALL for all statuses. |
type_filter | string | no | AdGroupType filter, enum-normalized. |
include_metrics | boolean | no | Add metrics.* over date_range and compute prior-period delta. |
date_range | string | no | GAQL date macro or explicit range; used only with include_metrics. Omitted with include_metrics=true = metrics over ALL TIME (a warning is returned). |
limit | integer | no | GAQL LIMIT to cap returned rows; recommend ORDER BY metrics.cost_micros DESC when narrowing. |
include_prior_period | boolean | no | Opt-in: also run the equal-length preceding window and attach prior_period={date_range, metrics, delta_pct} to every row. Needs a translatable date_range (LAST_7/14/30_DAYS, TODAY, YESTERDAY, THIS_MONTH, LAST_MONTH, or explicit 'YYYY-MM-DD,YYYY-MM-DD'); untranslatable ranges skip with a warning. |
manager_id | string | no | Optional MCC login-customer-id. |
Safeguards
Policy
Read-only; all listed metrics must reconcile to the Google Ads UI within +/-1%. Present only ad groups the queried account legitimately owns — never pool or cross-reference across accounts.
Reminder
Strict per-account isolation (server-derived tenant context + RLS); do not retain or expose ad group lists beyond this request.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
CUSTOMER_NOT_FOUND | Customer ID not found / unauthorized. | Verify CID and authorization; re-auth if revoked. | no |
TOKEN_REVOKED | OAuth credential revoked/expired. | Prompt reconnect (needs_reauth). | no |
INVALID_ARGUMENT | GAQL filter rejected — surfacing Google's message. | Surface exact error; fix filter, don't guess. | no |
PERMISSION_DENIED | Scope/role does not permit reading this account. | Confirm adwords scope and access; CID may be outside the bearer scope. | no |
RESOURCE_EXHAUSTED | Rate/quota exceeded (429). | Backoff 5->10->20s cap 60s; honor retryDelay. | yes |
PLATFORM_UNAVAILABLE | Google Ads API 5xx. | Retry after backoff. | yes |
Edge cases
- Campaign or account with no ad groups -> success:true, count:0, data:[].
- Large accounts: response may be very large — apply LIMIT + ORDER BY to narrow rather than truncating silently; tell the user it is capped.
- include_metrics with segments multiplies rows — aggregate for per-ad-group totals.
- REMOVED ad groups excluded by default; include them only when explicitly requested.
- Querying ad_group on an MCC returns the manager's own (typically empty) set, not aggregated client data — scope to one client CID.
- Expired token mid-stream -> refresh once and retry.