Skip to main content
Glama

Metadata MCP Connector

Add & Edit Campaign Elements

add_and_edit_campaign_elements
Destructive

Add new elements and edit existing properties of a Precision Optimization (1×1×1 / METADATA) marketing campaign. This tool serves two purposes: 1. ADD new audiences, ads, offers, and keywords to campaigns across LinkedIn, Facebook, Instagram, Google Ads, and Reddit. 2. EDIT existing campaign level properties: name, budget group, schedule dates, and offers per channel.

        CRITICAL: PRECISION / METADATA CAMPAIGNS ONLY — NATIVE CAMPAIGNS USE A DIFFERENT TOOL.
        This tool edits **Precision Optimization (1×1×1 / METADATA)** campaigns. For a **Channel-First / Native / Platform-First (N×N×N)** campaign, use `add_and_edit_native_campaign_elements` instead (it takes container-shaped input). If you call this tool on a Native campaign it returns an error telling you to use the native tool (and vice-versa), so a wrong guess self-corrects — no silent mis-write. Pick by the campaign's structure, not by user phrasing.

        CRITICAL: REMEMBER — CAMPAIGN STRUCTURE IS FIXED AT CREATION AND CANNOT BE CHANGED HERE.
        A campaign's structure (Precision 1×1×1 vs Native N×N×N) is chosen at creation and this tool does NOT switch it. Changing structure means building a NEW campaign with create_campaign (Precision) or create_native_structure_campaign (Native).

        WARNING: THIS IS THE TOOL TO USE WHEN THE USER WANTS TO:
        - EDIT/UPDATE a campaign's name, budget group, start date, or end date
        - CHANGE or REPLACE the offers assigned to a channel in a campaign
        - ENABLE a channel on an existing campaign
        - ADD new audiences, ads, ad groups, or keywords to a campaign
        - Expand campaign reach without recreating the entire campaign

        CRITICAL OFFER-CHANNEL PAIRING RULE (silent failure if violated)
        Lead Gen offers are CHANNEL-LOCKED at creation time (the channel was set on create_update_offer via data.channel). When you populate any channel's "offers" array here, you MUST only pass offer_ids whose data.channel matches that slot — the API DOES NOT validate the pairing and will SILENTLY return a "successful" update on a campaign that cannot serve.
          • linkedin.offers → only Lead Gen offer_ids with data.channel='LINKEDIN' (or Landing Page offer_ids).
          • facebook.offers → only Lead Gen offer_ids with data.channel='FACEBOOK' (or Landing Page offer_ids).
          • instagram.offers → only Lead Gen offer_ids with data.channel='INSTAGRAM' or 'FACEBOOK' (or Landing Page offer_ids).
          • google.offers → ONLY Landing Page offer_ids (Google Ads does not support Lead Gen forms).
          • reddit.offers → ONLY Landing Page offer_ids (Reddit does not support Lead Gen forms).
        Because this tool's "offers" arrays are FULL REPLACEMENTS (not appends), a wrong id here will overwrite the channel's correct offers with broken ones. If you cannot remember an offer_id's channel, call get_offer(name=<offer_name>) BEFORE submitting and inspect the channel field.

        ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
        EDIT CAPABILITIES (overwrites/replaces previous values):
        ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
        - name → Renames the campaign (smart: only executes if new name differs from current)
        - budgetGroup → Reassigns campaign to a different budget group (smart: only if different from current)
        - startDate → Replaces the campaign start date (can be updated independently)
        - endDate → Replaces the campaign end date (can be updated independently)
        - offers → WARNING: FULL REPLACEMENT per channel. Sending offers OVERWRITES the entire offer list for that channel.
        - Channel state → Enables any channel included in the payload (idempotent if already enabled)

        ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
        ADD CAPABILITIES (appends alongside existing, non-destructive):
        ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
        - audiences → Appended to existing audiences (POST)
        - exclude_audiences → Appended as channel-level EXCLUDE (negative-targeting) audience groups (POST). This is the consolidated home for exclusion audiences (the standalone add_exclusion_audiences_to_campaign tool was retired).
        - target_groups → Appended to existing target groups (POST)
        - ads → Appended to existing ads/ad groups (POST)
        - keywords (Google only) → Create keyword groups (free-text and/or existing keyword IDs); optionally LINK a group to a native ad container (NATIVE structure), or change an existing group's match type in place (set_match_type)
        - negative_keyword_lists (Google only) → Assigned to Google Ads channel after processing

        REQUIRED PARAMETER:
        - campaignId: Campaign ID (numeric identifier for the campaign)

        OPTIONAL EDIT FIELDS, supplied only for changes the user requested:
        - campaignType: "Lead Gen" or "Brand Awareness" (informational; must match existing campaign)
        - name: New campaign name, only for a rename
        - startDate: New campaign start date in YYYY-MM-DD format, only for an intentional schedule change
        - endDate: New campaign end date in YYYY-MM-DD format, only for an intentional schedule change
        - budgetGroup: New budget group name, only for reassignment

        CHANNEL ELEMENTS:

        WARNING: ADS — SEPARATE (default) vs BUNDLED INTO ONE GROUP (opt-in):
        - "ads.list": ad IDs sent one per request. DEFAULT — use this unless the user
          explicitly asks to group ads. A list of N ids produces N separate ads, not one bundle.
        - "ads.groups" ([{name, ads:[ids]}]): bundles ads into named ad groups. ONLY when grouping is requested.
        (LinkedIn has no ad groups — always use list.)

        LinkedIn:
        - audiences: Array of audience names (APPENDED)
        - target_groups: Array of Targeting Group names (APPENDED)
        - ads: Object with "groups" (ad group objects) and/or "list" (individual ad IDs) (APPENDED)
        - offers: Array of offer IDs (WARNING: REPLACES all existing offers on this channel)

        Facebook:
        - audiences: Array of audience names (APPENDED)
        - target_groups: Array of Targeting Group names (APPENDED)
        - ads: Object with "groups" and/or "list" (APPENDED)
        - offers: Array of offer IDs (WARNING: REPLACES all existing offers on this channel)

        Instagram:
        - audiences: Array of audience names (APPENDED)
        - target_groups: Array of Targeting Group names (APPENDED)
        - ads: Object with "groups" and/or "list" (APPENDED)
        - offers: Array of offer IDs (WARNING: REPLACES all existing offers on this channel)

        Google Ads:
        - keywords: Object with "groups" and/or "set_match_type".
            - groups: [{name, keywords?: [str], keyword_ids?: [int], match_type?: PHRASE|BROAD|EXACT, container?/container_id?}]
              Creates keyword groups. A group naming a container/container_id is LINKED to that native ad container (NATIVE structure: keywordGroupId set by re-POSTing the channel's container list). A group with no container is appended unlinked.
            - set_match_type: [{keyword_group_id? | container?/container_id?, match_type}] — change an existing group's match type in place (PATCH; non-destructive).
        - audiences: Array of audience names (APPENDED)
        - ads: Object with "groups" and/or "list" (APPENDED)
        - offers: Array of offer IDs (WARNING: REPLACES all existing offers on this channel)
        - negative_keyword_lists: Array of negative keyword list names (optional)
            Example: ["Competitor Brands", "Low Intent Keywords"]
            Assigned to the Google Ads channel after processing.
            Names must match existing negative keyword lists (use list_negative_keywords_list to find them).

        Reddit:
        - audiences: Array of audience names (APPENDED)
        - target_groups: Array of Targeting Group names (APPENDED; Reddit Target Groups come from create_reddit_target_group)
        - ads: Object with "list" only — Reddit ads attach one per request, like LinkedIn (APPENDED)
        - offers: Array of offer IDs (WARNING: REPLACES all existing offers on this channel)
        - Channel settings (objective, comments, placements, conversion pixel) are NOT edited
          here — use update_reddit_channel_settings. When this tool flips a disabled Reddit
          channel to enabled, UI-equivalent defaults are applied (Lead Gen → CLICKS + AUTO_BID;
          Brand Awareness → IMPRESSIONS + MANUAL_BID).

        CHANNEL ACTIVATION LOGIC:
        A channel is enabled if ANY of these conditions are met (OR logic):
        - audiences array has at least 1 item, OR
        - target_groups array has at least 1 item, OR
        - ads object exists, OR
        - offers array has at least 1 item, OR
        - keywords exist (Google Ads only)

        WARNING: AUDIENCES vs TARGET GROUPS — CRITICAL DISTINCTION:
        - "audiences": standard Metadata audiences (Firmographic, Bombora Intent, Retargeting, LinkedIn/Facebook Native, etc.)
        - "target_groups": Targeting Groups (also called Target Groups) created in the platform's Targeting Groups section.
        Both are arrays of names (strings). Send each type in its own field — do NOT mix them.
        If the user mentions a "Targeting Group" or "Target Group", it goes in "target_groups", NOT in "audiences".

        EXAMPLES:

        Edit campaign name and dates (no channel elements needed):
        add_and_edit_campaign_elements({
            "campaignId": 12345,
            "campaignType": "Lead Gen",
            "name": "NEW_CAMPAIGN_NAME_2025",
            "startDate": "2025-09-01",
            "endDate": "2025-12-31",
            "budgetGroup": "BoFu"
        })

        Replace offers on LinkedIn:
        add_and_edit_campaign_elements({
            "campaignId": 12345,
            "linkedin": {
                "offers": [57538, 57504]
            }
        })

        Add audiences and ads to LinkedIn:
        add_and_edit_campaign_elements({
            "campaignId": 12345,
            "linkedin": {
                "audiences": ["Test Native Audience", "EU Countries"],
                "ads": {
                    "groups": [{"name": "1GOAT", "ads": [173669, 171805]}],
                    "list": [156502, 156485]
                },
                "offers": [57538, 57504]
            }
        })

        Add Google keywords:
        add_and_edit_campaign_elements({
            "campaignId": 12345,
            "google": {
                "keywords": {
                    "groups": [{"name": "CRM Keywords", "keywords": ["crm software", "lead gen tools"]}]
                },
                "audiences": ["SUP_SF_All-Customers-Contacts_ALL_3"],
                "ads": {"list": [175258]},
                "offers": [61054]
            }
        })

        Mixed: edit budget group + add across multiple channels:
        add_and_edit_campaign_elements({
            "campaignId": 12345,
            "budgetGroup": "ToFu",
            "linkedin": {"audiences": ["New Audience"], "offers": [57538]},
            "facebook": {"audiences": ["FB Audience"], "ads": {"list": [171806]}},
            "google": {"keywords": {"groups": [{"name": "Keywords", "keywords": ["keyword"]}]}, "offers": [61054]}
        })

        VALIDATION:
        - campaignId must match existing campaign
        - All asset IDs (ads, offers) must exist
        - Audience names must match existing audiences
        - Budget group and name use smart filters: only updated if different from current values
        - Dates support partial updates: you can change only startDate, only endDate, or both

        RESPONSE: Returns
          - success, campaign_id, campaign_name, campaign_type, status, status_label
          - channels_updated: list of channel keys that had any edits
          - elements_added: true if anything changed at the campaign or channel level
          - added_summary: per-channel counts of what was ACTUALLY attached (audiences,
            target_groups, ad_groups, individual_ads, offers, keyword_groups,
            negative_keyword_lists) — not just what was requested
          - changes: { renamed, budget_group_reassigned, schedule_updated }
            reporting which campaign-level edits actually fired
          - optimization_group: { id, tag_name } after the edit
          - start_date, end_date, campaign_url, full_response (complete wizard state)
          - errors[]: populated on partial failures; success=false if present

        BID STRATEGY FOR NEWLY-ENABLED CHANNELS:
        When a channel transitions from disabled → enabled as part of this edit, the
        tool automatically applies the same auto-bid default used on create_campaign
        (AUTO_BID on LI/FB/IG, TARGET_SPEND on Google, objective-driven on Reddit:
        Lead Gen → CLICKS + AUTO_BID, Brand Awareness → IMPRESSIONS + MANUAL_BID)
        so the channel is launch-ready.
        Already-enabled channels keep their existing bid strategy untouched.

        SMART-UPDATE BEHAVIOUR:
        - name and budgetGroup are only pushed to the platform when different from
          current values (prevents the UniqueWizardName validator from rejecting a
          no-op rename, and avoids pointless tag churn).
        - startDate / endDate are partial: supply either or both.

        ERROR HANDLING: Validates campaign exists, verifies all asset IDs and audience
        names. Failures on individual operations are collected into errors[] and the
        rest of the edit proceeds — the campaign is not rolled back on partial errors.

CRITICAL: PARTIAL EDITS ONLY. Only campaignId is required. Supply other fields only for the user's requested changes, never by copying the whole campaign read result. A budget-group-only move uses campaign_data={"campaignId": 12345, "budgetGroup": "Destination"}. Omit name, startDate, endDate and channel blocks unless the user also requested those edits. Campaign-level startDate/endDate writes apply to every channel, including switched-off channels, so replaying a campaign's aggregate dates can overwrite distinct channel dates. For a budget-only move, read the campaign before and after and verify each channel's startDate/endDate and enabled state are unchanged, alongside the new budget group. The handler returns budget_move_verification for a completed move without date or channel edits. verified=true confirms every channel's identity, dates and switch state and the destination group. verified=false also populates errors: stop further moves and report the changed fields or incomplete readback, even when success=true because the budget group already changed. No schedule rollback is attempted. Do not report dates preserved without that readback; report any mismatch explicitly.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_dataYesCampaign data with fields to edit and/or elements to add

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / campaign_data / properties / endDate / description
      Previous value: -"Campaign end date in YYYY-MM-DD format — REPLACES existing end date"New value: +"Optional new end date (YYYY-MM-DD). Omit unless the user requested a schedule change; supplied dates overwrite that date on every channel, including switched-off channels."
    • changedInput schema / properties / campaign_data / properties / startDate / description
      Previous value: -"Campaign start date in YYYY-MM-DD format — REPLACES existing start date"New value: +"Optional new start date (YYYY-MM-DD). Omit unless the user requested a schedule change; supplied dates overwrite that date on every channel, including switched-off channels."
    • changedInput schema / properties / campaign_data / required
      Previous value: -[
      -  "campaignId",
      -  "campaignType",
      -  "name",
      -  "startDate",
      -  "endDate",
      -  "budgetGroup"
      -]New value: +[
      +  "campaignId"
      +]
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already flag destructiveHint=true, and the description goes well beyond that: it discloses full-replacement vs append semantics per field, silent-failure offer/channel locking, channel-activation OR logic, auto-bid defaults on newly enabled channels, smart no-op filtering for name/budgetGroup, and partial-error handling with no rollback. This is unusually rich behavioral context.

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

Conciseness3/5

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

Front-loads the critical scoping rule well and uses headers, but it is heavily bloated: the offer-channel locking rule appears in the body and again in every channel's schema, and the ADD/EDIT capability lists duplicate the per-channel element lists. The trailing 'PARTIAL EDITS ONLY' block reads as appended rather than integrated.

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?

For a large nested-object tool with no output schema, the description covers validation, response fields, error behavior, bid-strategy defaults, channel activation, and post-edit verification requirements. Nothing an agent needs to invoke it correctly is missing.

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 real meaning beyond it: worked examples, the audiences-vs-target_groups distinction, ads.list default vs ads.groups opt-in, and the partial-edit rule (only campaignId required). It largely restates the schema's offer-channel rules, but the examples and cross-field guidance push it above baseline.

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

Purpose5/5

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

States a specific verb pair (add/edit) plus the exact resource (Precision Optimization / METADATA campaign elements) and explicitly names the sibling it is not (add_and_edit_native_campaign_elements). An agent can route correctly without opening either schema.

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

Usage Guidelines5/5

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

Enumerates when to use it (rename, budget move, schedule change, offer replacement, channel enable, element addition), when NOT to use it (Native campaigns, structure changes), and the exact alternative tools to use instead (create_campaign, create_native_structure_campaign, update_reddit_channel_settings). Also notes the self-correcting error behavior so a wrong guess is recoverable.

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