Skip to main content
Glama

Metadata MCP Connector

Set Campaign UTMs

set_campaign_utms
Destructive

Set or clear the UTM tracking parameters of ONE channel on a wizard campaign, merging into what the channel already stores.

            KEYWORDS: utm, utms, set utm, change utm, utm_source, utm_medium, utm_campaign, utm_term, utm_content, tracking parameters, campaign override, UPDATE ME

            USE THIS TOOL WHEN THE USER ASKS:
            - "Set utm_source=Linkedin and utm_medium=paid-social on this campaign"
            - "Fix the UPDATE ME placeholder in campaign X's UTMs"
            - "Use utm_campaign=DG_Touch-3 on the LinkedIn channel"

            INHERITANCE RULE - READ BEFORE ANSWERING ANY UTM QUESTION:
            UTMs are inherited, never blank. A campaign channel with an empty stored
            mapping does NOT have "no UTMs" - it tracks with the account's UTM defaults,
            and where the account set nothing it tracks with the Metadata platform default.
            Roughly half of all channel rows in production are in that inherited state.
            NEVER report "no UTMs configured" from an empty stored field: report the
            resolved value and its origin.

            ORIGIN IS PER CHANNEL, not per key: a channel with an empty stored mapping
            inherits the account default whole, so a channel whose resolved mapping differs
            at all from that is stored on the campaign and every one of its values is an
            override. The per-key `same_as_default` flag says whether that one key happens
            to match the default anyway.

            ORIGIN VALUES:
            - campaign_override: stored on this campaign channel, differs from what it would inherit.
            - account_default: inherited from this account's UTM defaults.
            - platform_default: inherited from the Metadata-wide default (account set nothing).
            - not_set: the channel really has no UTM mapping (non-sponsored channels only).

            HONEST LIMIT: a campaign that stores a mapping identical to the default it
            would inherit is reported as inherited. The platform returns resolved values
            with no provenance, so that case cannot be distinguished - say so rather than
            claiming the campaign has no override.

            TRACKING TIMING AND TOKEN MEANING:

Leads using server-resolved campaign UTMs use the current saved mapping when the platform processes them, without waiting for an ad republish. Captured URL or caller-supplied values can follow a different ingestion path, so do not generalize this timing to every new lead. Native click-time macros retain values captured from the lead's click URL. Ad click URLs have a separate publication timeline: a draft uses the saved mapping at launch, and launched ads use it on their next campaign publish. Saving a launched Microsoft Ads campaign triggers a live UTM push. AD_NAME is a dynamic token, not necessarily an individual ad name: standard experiments use their ad group name when present, otherwise their creative name; native ad structures use the native ad's own name. CAMPAIGN_NAME uses the wizard campaign name. Saving a launched campaign can also queue an asynchronous existing-lead UTM refresh. Do not assume historical rows are immutable or that all old rows have already refreshed. Verify the saved mapping with get_campaign_utms and actual lead values and ingestion timing separately from live ad click URLs; a supplied or backfilled lead creation date alone does not prove when its UTMs were resolved.

            INPUT:
            - campaign_id: the WIZARD campaign id (from list_wizard_campaigns / search_campaigns_by_names).
            - channel: the enabled channel to edit: LINKEDIN, FACEBOOK, INSTAGRAM, GOOGLE_ADS,
              MICROSOFT_ADS or REDDIT. UTMs are stored per channel; call once per channel.
            - utms: object of UTM key to value. Standard keys UTM_SOURCE, UTM_MEDIUM, UTM_TERM,
              UTM_CAMPAIGN, UTM_CONTENT (utm_source style is accepted and normalised); other keys
              are custom static parameters. A value is either literal text ("paid-social") or one
              of the platform's dynamic tokens: AD_CHANNEL, AD_NAME,
              CAMPAIGN_NAME, OFFER_TYPE, OFFER_FORM_NAME, AUDIENCE_NAME_OR_KEYWORD, EXPERIMENT_ID,
              EXPERIMENT_NAME, NATIVE_CHANNEL_CAMPAIGN_ID, NATIVE_CHANNEL_ADGROUP_ID,
              NATIVE_CHANNEL_CREATIVE_ID, NATIVE_CHANNEL_KEYWORD, NATIVE_CHANNEL_SEARCH_TERM.
              Keys you omit keep their current value; an empty string clears a key (the channel
              then inherits that key's default again only if the whole mapping becomes empty).
              `metadata_cid` is reserved and refused.

            HOW IT WRITES: the platform endpoint replaces the campaign's whole UTM map and blanks
            any enabled channel left out of it, so this tool reads the current mappings first and
            re-sends every other enabled channel unchanged. A channel that was inheriting the
            account default is re-sent with the same values it already resolves to, so tracking
            does not change for it.

            Saving changes the mapping used for incoming server-resolved leads immediately;
            no ad republish is required for those leads. Publishing ad click URLs is separate.
            Verify the stored mapping with get_campaign_utms and observed lead values separately.

            RESPONSE SHAPE:
            {"success": true, "campaign_id": 173290, "channel": "LINKEDIN",
              "applied": {"set": {"UTM_SOURCE": "Linkedin"}, "cleared": []},
              "stored_mapping": {...}, "resolved": {...same shape as get_campaign_utms.channels.LINKEDIN...},
              "notes": ["..."]}

            Account-level UTM defaults are NOT edited here (get_account_utm_defaults is read-only).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
utmsYesUTM key to value, e.g. {"UTM_SOURCE": "Linkedin", "UTM_MEDIUM": "paid-social", "UTM_CAMPAIGN": "DG_Touch-3_TAG", "UTM_CONTENT": "AD_NAME"}. Empty string clears a key.
channelYesThe enabled channel whose UTM mapping to edit.
campaign_idYesWizard campaign id (the `id` from list_wizard_campaigns).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true and openWorldHint=true, and the description goes well beyond them: it explains that the platform endpoint replaces the whole UTM map and blanks omitted channels, that the tool therefore re-reads and re-sends other channels unchanged, that clearing works per key, and that saving affects incoming server-resolved leads immediately without an ad republish. This is exactly the mitigation detail an agent needs before invoking a destructive write.

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

Conciseness2/5

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

The body is a wall of text with heavy redundancy: the instruction to verify with get_campaign_utms appears three separate times, and the inheritance/origin rules are restated across sections. Large portions concern how to interpret UTM reads rather than how to perform this write, so much of the length does not earn its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive write on a shared per-channel map with a nested object parameter and no output schema, the description supplies input rules, write semantics, a concrete RESPONSE SHAPE, and post-write verification guidance. Nothing essential is missing, though the volume of tangential read-side material makes it harder to extract the complete picture.

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 coverage is 100%, so the baseline is 3, but the description adds real value: the list of accepted dynamic tokens (AD_NAME, CAMPAIGN_NAME, NATIVE_CHANNEL_*), the note that utm_source-style keys are normalised, omitted keys retain current values, empty string clears, and that metadata_cid is reserved and refused. That exceeds what the schema documents.

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 opening sentence gives a specific verb pair (set/clear), resource (UTM tracking parameters) and scope (ONE channel on a wizard campaign), which is enough to distinguish it from the read-side siblings. However, the enormous inheritance/origin block that follows is really about interpreting UTM reads and dilutes the write purpose.

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?

There is an explicit 'USE THIS TOOL WHEN THE USER ASKS' list with concrete example utterances, plus an exclusion stating account-level defaults are not edited here. It stops short of an explicit 'do not use this to read UTMs - use get_campaign_utms', though it repeatedly points there for verification.

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