gads_add_ad_schedule
Google Ads write medium risk
Part of the Ad Schedule Agent.
What it does
Add campaign ad-schedule (dayparting) criteria, optionally with a per-window bid_modifier (the modifier sits on the CampaignCriterion, not on AdScheduleInfo). SCALIX SOP: dayparting must be driven by data — the call is BLOCKED with error_class 'review_required' until the caller passes reviewed_performance=true, confirming the ad-schedule performance report was consulted. PREVIEW->APPROVE->COMMIT. PREVIEW SEMANTICS: the first call (no preview_id) is sent to the Google Ads API in validation mode — field, enum, policy and permission errors surface AT PREVIEW, nothing is changed, and the response returns a preview_id. To apply, show the preview to the user, get their approval, and re-call with that preview_id and IDENTICAL arguments within 30 minutes; changed arguments or an expired token fail closed to a fresh preview. validate_only=true forces another preview; validate_only=false alone never commits.
When to use it
Run gads_get_ad_schedule_performance first and show the buyer which days/hours actually convert. Then ask which windows to include and what bid modifier each should carry, and re-call with reviewed_performance=true.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | 10-digit CID, dashes/spaces stripped. Tenant context server-derived. |
campaign_id | string | yes | Numeric campaign ID. |
schedules | array<object> | yes | Each: {day_of_week (MONDAY..SUNDAY, enum-normalized uppercase), start_hour 0-23, start_minute (ZERO|FIFTEEN|THIRTY|FORTY_FIVE), end_hour 0-24, end_minute (same enum), bid_modifier optional 0.1-10.0 (not 0)}. end_hour 24 with end_minute ZERO means end of day. |
validate_only | boolean | no | Optional. true forces another preview even with a preview_id; false is DEPRECATED and no longer commits — only a valid preview_id applies the write. |
reviewed_performance | boolean | no | Must be true: confirms gads_get_ad_schedule_performance was reviewed first. |
preview_id | string | no | Omit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview. |
Safeguards
A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.
Policy
Ad scheduling is content-neutral; it must reflect only the user-approved windows. Do not use scheduling to mask review of a restricted ad or to silently suppress required disclosures during certain hours.
Reminder
Always state the account timezone the schedule is interpreted in; don't retain scheduling data beyond this request.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
CUSTOMER_NOT_FOUND | Customer ID not found or not linked. | Verify CID (dashes stripped); re-auth if stale. | no |
TOKEN_REVOKED | Authorization revoked / refresh token expired. | Trigger re-auth (needs_reauth); do not retry with the dead token. | no |
OVERLAPPING_SCHEDULE | A submitted window overlaps an existing or another submitted ad-schedule slot for the same day. | Surface the conflicting windows; ask the user to merge/adjust. Do not auto-merge. | no |
INVALID_ARGUMENT | Bad time (e.g. end before start, invalid minute enum, end_hour>24, bid_modifier=0). | Surface the exact platform message; correct the window — do not guess. | no |
OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE | Campaign type doesn't support ad schedule or per-slot bid modifiers. | Explain the channel-type limitation; branch before retry. | no |
PERMISSION_DENIED | Missing scope or read-only role. | Report missing scope / role; do not retry. | no |
MANAGER_ACCOUNT_WRITE | Target CID is a manager (MCC) account. | Ask which child serving account to target. | no |
RESOURCE_EXHAUSTED | Rate/quota limit (HTTP 429). | Backoff 5->10->20s cap 60s, honor retryDelay; retry. | yes |
PARTIAL_FAILURE | Some schedule windows failed, others succeeded. | Report per-window; retry only failures. | no |
PLATFORM_UNAVAILABLE | Google Ads 5xx / INTERNAL / DEADLINE_EXCEEDED. | Idempotent retry with backoff. | yes |
Edge cases
- Empty schedules -> success:false 'no schedule windows supplied'.
- Adding any ad-schedule criterion means the campaign serves ONLY during covered windows -> warn that uncovered hours now go dark.
- Crossing-midnight window (e.g. 22:00-02:00) must be split into two day entries; flag and offer to split.
- bid_modifier of exactly 0 is invalid (no true blackout via modifier) -> reject and explain before the API call.
- Timezone is the account's (customer.time_zone), not the user's local time -> always surface it.
- Expired token -> refresh once, retry.
- Preview expired before approval -> re-run validate_only before commit.