Skip to main content
Glama

Upsert Campaign Plan

upsert_campaign_plan
DestructiveIdempotent

Create or update a campaign plan from an agency's media plan or brief. The plan is keyed by (externalSource, externalId) — the platform the campaign id belongs to and its id there — so re-sending the same campaign updates it, and an identical call changes nothing (Outcome=Unchanged). It is always saved as a Draft: it does not change the forecast until a planner previews and applies it in Spark, and a plan that is already Applied or Retired is refused (CONFLICT). The agency's stated lift is the plan's conservative/expected/optimistic scenario (percent by default, or additional units). itemSkus are every product expected to move; heroSkus are the featured ones (added to the plan items automatically); the rest are expected to see halo. The owning client is derived from the items. The preview carries an advisory estimate calibration: how far this brand's completed campaigns' stated lifts have run from what sold (median and range, once enough are measured), with your lift calibrated, and the brand's measured campaign history for this kind and channels (peak lift, pull-forward, lift per 1k of spend, with a suggested range; association, not cause). Neither changes your numbers unless you set adoptCalibration or adoptCampaignHistory.

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": {
      "externalSource": "<externalSource>",
      "externalId": "<externalId>",
      "name": "<name>",
      "campaignKind": "<campaignKind>",
      "startsOn": "<startsOn>",
      "endsOn": "<endsOn>",
      "itemSkus": "<itemSkus>"
    },
    "name": "upsert_campaign_plan"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesPlan name, max 200 characters.
notesNoFree-text notes, max 4000 characters.
offerNoThe campaign's offer: kind, value, minimum, code or automatic, eligibility, stacking and the SKUs it covers. Omit for none. When sent, offerKind/offerValue/offerCurrency are ignored.
endsOnYesLast campaign day (inclusive), yyyy-MM-dd.
marketsNoTarget markets as ISO 3166 codes, e.g. US, GB, US-CA.
previewNoStep 1 of the required two-step write: set true to validate and receive a structured preview (Created/Updated/Unchanged, per-field changes, resolved items, warnings) plus a single-use previewReceipt. Nothing is saved until the commit call.
audienceNoAcquisition, Retention or Mixed.
channelsNoOne row per channel with its planned spend and currency.
clientIdNoRequired for operator (unpinned) credentials on 3PL tenants: the client (GUID) the campaign's items belong to — get ids from list_clients. Client-pinned credentials omit this; the credential decides.
heroSkusNoSKUs of the featured (hero) products; they are added to the plan items.
itemSkusYesSKUs of every product the campaign is expected to move (max 50).
liftModeNoHow the stated lift is expressed: Percent (default) or AdditionalUnits (total extra units across the plan items).
startsOnYesFirst campaign day, yyyy-MM-dd, in the workspace's time zone.
decayModeNoSustained (default: full lift through the window) or Decaying (fades to neutral).
offerKindNoDeprecated, use offer. None, PercentOff, AmountOff, Bundle or FreeShipping. Omitted (with no offer) means no offer; restating what a read returned keeps the stored offer's other details.
externalIdYesThe campaign's id in externalSource. Unique only within that source.
offerValueNoDeprecated, use offer. PercentOff: percent (0-100]. AmountOff: amount off. Bundle: bundle price.
campaignKindYesPaidSocial, PaidSearch, EmailSms, Influencer, Affiliate, Pr, SaleEvent, RetailPlacement or Other.
liftExpectedNoAgency's expected lift — the default scenario a planner applies.
plannedReachNoPlanned reach (impressions or recipients).
offerCurrencyNoDeprecated, use offer. ISO 4217 currency for an AmountOff or Bundle price.
externalSourceYesThe platform or tool the campaign id belongs to, e.g. meta_ads, google_ads, klaviyo or an agency's own planner. Letters, digits, '.', '_', '-', ':'.
idempotencyKeyNoCaller-generated idempotency key; required with previewReceipt to commit.
liftOptimisticNoAgency's optimistic lift.
previewReceiptNoStep 2 of the required two-step write: the receipt returned by the preview call. Supply together with a fresh idempotencyKey to commit; calls without it are refused.
informationOnlyNoTrue records the campaign without any forecast effect (never previewable/applied).
adoptCalibrationNoExplicitly adopt the estimate calibration shown in the preview: the lift values you send stay your stated lift and are recorded as such, and the plan stores them scaled by the calibration. Refused when no calibration is available yet. Default false: your numbers are stored as sent.
liftConservativeNoAgency's conservative lift. Percent values stay within -75 and 300.
plannedReachMetricNoWhat plannedReach counts: Impressions or Recipients.
adoptCampaignHistoryNoExplicitly adopt the measured campaign history shown in the preview (preview.campaignHistory.suggested) in place of your lift: the lift values you send stay recorded as your stated lift, and the plan stores the history's suggested percent range. Refused when the history is insufficient, or together with adoptCalibration. Default false.

Output Schema

NameRequiredDescriptionDefault
okNo
planNo
outcomeNo
previewNo
expiresAtNo
actionItemIdNo
confirmationNo
correlationIdNo
approvalResultNo
idempotencyKeyNo
previewReceiptNo
idempotentReplayNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Beyond the annotations, the description discloses the idempotency key behavior, draft-only saving, lack of forecast effect until planner preview/apply, conflict handling for Applied or Retired plans, and optional calibration adoption. These are substantive behavioral traits that help an agent predict outcomes. It does not contradict the supplied annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the create/update purpose, then proceeds through keying, draft state, lift scenarios, SKU roles, and calibration adoption. Given the 30-parameter schema and complex two-step write flow, the length is justified and no sentence is merely repetitive. It is dense but appropriately structured for the tool's complexity.

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?

The tool has annotations, a complete input schema, and an output schema, and the description covers the important behavioral nuances an agent needs before calling it. It explains the upsert key, draft/apply lifecycle, conflict conditions, SKU roles, client derivation, and calibration adoption. Nothing material is missing for correct invocation.

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 description coverage is 100%, so the baseline is 3, but the description adds cross-parameter meaning: plans are keyed by externalSource plus externalId, itemSkus drive plan items, heroSkus are automatically added, and the client is derived from items. It also clarifies that adoptCalibration and adoptCampaignHistory do not change the stated lift unless explicitly set. It does not add much syntax beyond the already detailed schema, so it stops short of 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: create or update a campaign plan from an agency's media plan or brief. It also explains the keying model and draft behavior, making the tool's purpose clear. It does not explicitly distinguish itself from the sibling preview_campaign_plan, so sibling differentiation is left partly implicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear usage context: re-sending the same campaign updates it, an identical call returns Unchanged, and Applied or Retired plans are refused with CONFLICT. It also explains the required preview-then-commit flow. It does not name the sibling preview_campaign_plan as an alternative, so alternatives are not explicit.

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