Skip to main content
Glama

Add, remove or exclude Microsoft Advertising campaign locations

msads_set_locations
DestructiveIdempotent

Change where a campaign's ads can show. action 'remove' stops targeting locations the campaign has now (pass targetIds from msads_get_targeting, or locationIds); action 'add' starts targeting new Microsoft location ids; action 'exclude' blocks a location even when a wider one is targeted (e.g. exclude a country inside a region). It refuses to remove the last targeted location, because a campaign with none shows everywhere. Removing a location cuts reach and its spend; adding one widens it. Location ids are Microsoft's, from learn.microsoft.com/advertising/guides/geographical-location-codes (US 190). Returns what changed so it can be reversed with the opposite action. Edits the campaign's own locations only: an ad group with its own location targeting overrides them (check msads_get_targeting with adGroupId). Use dryRun first when unsure.

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": {
      "campaignId": "<campaignId>",
      "action": "<action>"
    },
    "name": "msads_set_locations"
  }
}

Input Schema

NameRequiredDescriptionDefault
actionYesremove = stop targeting; add = start targeting; exclude = block.
dryRunNoPreview only. Microsoft has no validate-only mode, so Caybl reads the current value and shows exactly what would change (before and after) without sending anything. Free, and cannot affect spend.
accountIdNoMicrosoft Advertising account id or account number (e.g. 'F123ABCD'), as listed by msads_list_accounts. Only needed when the sign-in can reach more than one account.
targetIdsNoFor remove: location criterion ids (the `id` in msads_get_targeting).
campaignIdYesCampaign id, from msads_get_campaigns.
locationIdsNoMicrosoft location ids. Required for add and exclude; for remove an alternative to targetIds.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and idempotentHint=true, but the description adds substantive behavior beyond them: the refusal to remove the last targeted location (because an empty campaign shows everywhere), the reach/spend consequences of each action, and that results are returned in a form reversible with the opposite action. These are non-obvious operational constraints an agent cannot get from the schema.

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

Conciseness4/5

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

Front-loaded with the core action semantics, then caveats, then dryRun guidance. Sentences are dense and information-bearing, though a couple of the parentheticals (spend impact, reversal) could be tightened without loss.

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 6-parameter mutation with no output schema, the description covers the mutation semantics, the override interaction with ad groups, the hard failure mode, the id source, and what is returned. Nothing an agent needs to call it safely 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 coverage is 100%, so baseline is 3, but the description adds cross-parameter rules the schema states only locally: targetIds must come from msads_get_targeting's criterion id, locationIds is required for add/exclude but is an alternative for remove, and it explains what a Microsoft location id is with a concrete example (US 190). That is meaningful meaning beyond the field-level docs.

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?

Opens with a concrete verb+resource ('Change where a campaign's ads can show') and immediately disambiguates the three action modes (remove/add/exclude) with a concrete example for exclude. It also names the sibling msads_get_targeting as the source of targetIds, so an agent can place it in the workflow.

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?

Explicitly routes the agent: use msads_get_targeting (or locationIds) for removals, check msads_get_targeting with adGroupId because ad-group targeting overrides campaign targeting, and 'Use dryRun first when unsure.' It states a when-not implicitly by warning about the last-location removal refusal.

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