Skip to main content
Glama

Set segment costs

set_segment_costs
Destructive

Book a known spend onto a traffic SEGMENT — period + any analytics filters, across campaigns ("I spent $500 on offer 3 / zone 1234 last week, lay it out"). 'set' makes the segment's total cost exactly amount (other clicks in the segment zeroed), 'add' puts it on top. 'even' spreads per click; 'proportional' scales each click's current cost so an ad-network sync's shape survives and only the total moves. Bots never carry cost unless include_bots; unique_only restricts carriers to unique clicks; landing-exit clicks never carry cost. Applied asynchronously (result 'queued'), 90-day editable window. Works like per-campaign cost booking, for arbitrary segments.

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": {
      "amount": "<amount>"
    },
    "name": "set_segment_costs"
  }
}

Input Schema

NameRequiredDescriptionDefault
osNo
ispNo
cityNo
modeNo'set' (default) makes the segment total exactly `amount`; 'add' increments it
siteNoPlacement / zone id as passed by the ad network
sub1NoFilter by sub1
sub2NoFilter by sub2
sub3NoFilter by sub3
sub4NoFilter by sub4
sub5NoFilter by sub5
sub6NoFilter by sub6
sub7NoFilter by sub7
sub8NoFilter by sub8
sub9NoFilter by sub9
userNoWorkspace member id(s), comma-separated — the campaign owner at click time (needs the "See statistics per team member" permission; ignored otherwise)
offerNoOffer id
sub10NoFilter by sub10
sub11NoFilter by sub11
sub12NoFilter by sub12
sub13NoFilter by sub13
sub14NoFilter by sub14
sub15NoFilter by sub15
amountYesUSD
deviceNomobile / tablet / desktop
periodNoReporting period (default 7days). Use 'custom' with date_from/date_to.
sourceNoTraffic source id
browserNo
countryNoCountry ISO alpha-2 code, e.g. ES
date_toNoYYYY-MM-DD (with period=custom)
landingNoLanding id
campaignNoCampaign ALIAS(es), comma-separated for several
creativeNoCreative id from the click URL
languageNo
pwa_tagsNoComma-separated tag ids — pwas carrying any of them
referrerNo
utm_termNoExact utm_term value from the click URL
date_fromNoYYYY-MM-DD (with period=custom)
pwa_groupNoPwa group id
smartlinkNoSmartlink id
source_idNoSource id as passed by the ad network
offer_tagsNoComma-separated tag ids — offers carrying any of them
utm_mediumNoExact utm_medium value from the click URL
utm_sourceNoExact utm_source value from the click URL
ad_campaignNoThe ad network's own campaign id (external_campaign_id)
aff_networkNoAffiliate network id
offer_groupNoOffer group id
source_tagsNoComma-separated tag ids — sources carrying any of them
unique_onlyNoOnly unique clicks carry cost; repeat visits in the segment are zeroed by a set
utm_contentNoExact utm_content value from the click URL
distributionNo'even' (default) per click; 'proportional' to each click's current cost
include_botsNoLet bot clicks carry cost too (default false — networks never bill crawlers)
landing_tagsNoComma-separated tag ids — landings carrying any of them
source_groupNoSource group id
utm_campaignNoExact utm_campaign value from the click URL
campaign_tagsNoComma-separated tag ids — campaigns carrying any of them
landing_groupNoLanding group id
campaign_groupNoCampaign group id
smartlink_tagsNoComma-separated tag ids — smartlinks carrying any of them
connection_typeNo
smartlink_groupNoSmartlink group id

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / period / enum
      Previous value: -[
      -  "today",
      -  "yesterday",
      -  "7days",
      -  "30days",
      -  "this_month",
      -  "last_month",
      -  "custom"
      -]New value: +[
      +  "today",
      +  "yesterday",
      +  "7days",
      +  "30days",
      +  "60days",
      +  "90days",
      +  "this_month",
      +  "last_month",
      +  "custom"
      +]
  2. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only give the coarse profile (destructive, non-idempotent, closed-world); the description adds the operational details that actually matter: the call is applied asynchronously and returns 'queued', there is a 90-day editable window, 'set' zeroes other clicks in the segment, bots and landing-exit clicks are excluded unless include_bots, and unique_only restricts which clicks may carry cost. That is substantial context beyond the annotations and correctly warns about the destructive overwrite.

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?

The core action and the mode/distribution distinctions are front-loaded, and the parenthetical example makes the intent concrete without padding. The paragraph is dense and packs several distinct behaviors into a single block, which slightly impedes scanning, but no sentence is filler.

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 60-parameter destructive mutation with no output schema, the description covers the pieces an agent cannot infer: async 'queued' result, the 90-day edit window, and which clicks are excluded from costing. It omits permission requirements (e.g. the team-member permission noted in the schema) and does not describe what the queued job ultimately returns, leaving a small gap for a tool of this complexity.

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 already 88%, so the baseline is 3, but the description earns above baseline by explaining the semantics of the three nontrivial knobs: 'proportional' scales each click's existing cost to preserve an ad-network sync's shape, include_bots overrides the default network-billing behavior, and unique_only zeroes repeat visits on a set. It does not explain the 45+ filter fields, but those are self-documented in the schema.

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?

The first sentence states a specific verb and resource ('Book a known spend onto a traffic SEGMENT'), scopes it ('period + any analytics filters, across campaigns'), and gives a concrete usage example. The closing line 'Works like per-campaign cost booking, for arbitrary segments' positions it against the sibling set_campaign_costs without the agent needing to compare schemas.

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 clearly explains the mode semantics ('set' replaces the segment total, 'add' stacks on top) and the two distribution strategies, so an agent knows which configuration to pick for a given intent. What is missing is explicit routing guidance against the closest siblings preview_segment_costs and set_campaign_costs — it characterizes the relationship but never says 'preview first' or 'use the other tool when the scope is a single campaign'.

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