Skip to main content
Glama

Merchant spend

query_spend
Read-only

Total spend for a merchant or set of merchants over a window: one figure, or a day, week or month series (granularity; omit it for one total). Purchases only. Needs start_date, end_date and a merchant. Name the brand in merchant (merchant=Starbucks): it resolves to the directory merchant, so don't search first. A merchant_id from an earlier result wins over it. If the result says matched_by descriptor, the brand isn't in the directory and the figure is a loose name match: search once and retry with its merchant_id. The window is at most 366 days; a weekly series at most 16 weeks. With partial_panel, quote its full_panel for a level.

How to answer with any American Spend tool:

  • Lead with the finding: the number, ranking or change. Don't narrate the calls you're about to make. No caveats list, no closing offers.

  • Call it the American Spend model or the model, never "panel" or "sample", and never name where its data comes from. Public benchmark series are the exception: name the agency and quote their attribution line.

  • Treat coverage.through as today. Don't say the data "only runs through" a date or that recent days are estimated. If an answer rests on the last few days alone, say in one line they may move.

  • Model dollars are not company revenue or a market size: lead with shares, rankings and changes.

  • A brand's growth: normalize=per_account with growth=true, quoting per_account_change_pct. Shares between groups (metros, ages, income tiers): weighting=population.

  • Never compare a window that starts before coverage.from with one after it.

  • Recheck every number you derive before writing it; show only the final figure.

  • Report what the results show. Don't add causes, seasons or events they don't state. If a figure looks off, say so once, beside it, with the real numbers.

  • If the user says an answer is wrong, offer in that same reply to report it to the American Spend team.

Talk to the user in plain words: no tool, parameter or field names. Say "the American Spend model", never "panel" or a data source.

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": {
      "start_date": "<start_date>",
      "end_date": "<end_date>"
    },
    "name": "query_spend"
  }
}

Input Schema

NameRequiredDescriptionDefault
groupNoA merchant group as the subject, by slug or UUID (`find_groups` lists them, with their members). Members are read as one set: totals add up, unique purchasers count each account once. An unknown group is 400 `…/problems/merchant-group-unknown`.
namesNoRaw descriptor(s), comma-separated or repeated. Max 50.
growthNoAdds a `growth` block comparing the immediately-preceding window of equal length.
deflateNoAdds real (inflation-adjusted) spend in base-month dollars, from CPI-U — the US city average (`cpi_u`) or the row's most specific published area (`cpi_regional`). The CPI item is the one the row's category maps to, all items otherwise.none
end_dateYesInclusive ISO-8601 date. At most 366 days after `start_date`.
locationNoCoded metro. Matches merchant geography OR spender (cardholder) geography by default — narrow with `match_merchant` / `match_spender`. Spender scoping is what lets app-billed merchants (rideshare, whose merchant address is the processor HQ) be analysed by city.
merchantNoA single brand token, matched exactly as `names` with `match=fuzzy` (directory merchant first, descriptor substring only as the fallback; ambiguity is 400 `…/problems/merchant-ambiguous`).
canonicalNoCanonical merchant name(s), as the merchant directory lists them. An exact, case-insensitive match is tried first. A name with no exact match is matched loosely, as `merchant` is: letters and digits only, then whole words, with corporate suffixes ignored (`Jersey Mike's` finds `JERSEY MIKE'S SUBS`). A loose match answers only when it is one merchant, and the response says which (`matched_by: canonical`, `matched_names`). Several matches are refused with 400 `…/problems/canonical-ambiguous`, carrying `candidates` to pick from by `merchant_id`. A name that matches nothing as a whole and contains commas is read as a list (`Kalshi,Polymarket`); a whole name is always tried first, since canonical names may contain commas.
normalizeNoAdds a normalized figure beside the raw ones: `share_of_spend` is the row's share of all spend under the same filters, `per_account` spend per active card. `per_household` and `share_of_income` need `weighting=population` (400 `normalize-requires-population`). `per_account` with `growth=true` is the figure for a brand's growth: every card counts, so it is not moved by which cards the population weights can place.none
weightingNo`raw` (the default): model volume, `weighted_cents` equals `total_cents`. `population`: the weighted fields reweight the model to the mix of US adults (for shares, comparisons and growth, not market size), with `effective_n`, `low_precision`, `suppressed` and a `weighting` object. A month has weights once it has been raked, from 2025-09 on. `same_account`: growth compares one set of accounts, those with spend in the model in both of two months, chained month by month, so accounts arriving or leaving can't move it. It is turnover-adjusted: each month also carries the merchant's or category's own balance of accounts arriving and leaving (the median over 12 months), which shared accounts alone miss. Levels and shares stay raw. A growth block gains `same_account_change_pct` and `same_account_yoy_pct`, or `same_account_unavailable` saying why not, and a monthly series carries chained dollars in `weighted_cents`. It needs whole, settled calendar months, the newest month waits for the month after it on the default `stable` accounts, and it is in validation (403 `same-account-weighting-forbidden` until open to the key). Omit it to get the response shape callers had before it existed.raw
start_dateYesInclusive ISO-8601 date.
facilitatorNoOnly purchases that went through these facilitators, read from the descriptor's prefix: `PayPal`, `Venmo`, `SQUARE`, `Klarna`, and `direct` for a purchase with none. Comma-separated. The names are the ones `breakdown` returns with `group_by=facilitator`. A prefix or the start of a name works too (`PP`, `Toast`). Raw figures only: not with `weighting=population` or `same_account`, `normalize` or `deflate`. A merchant whose order or store numbers give it more than 10 million descriptors is refused with `facilitator_split_too_large`.
granularityNoday, week, or month. Omit for one total over the window. total is not a value. When set, adds a bucketed series array.
merchant_idNoCanonical merchant UUID(s). Comma-separated or repeated.
match_spenderNoInclude spender geography when filtering by `location`. Defaults true.
income_bracketNoRestrict to one cardholder income band. `unknown` selects rows with no income upstream, which is where most spend sits — the dimension is populated for roughly 6% of volume, so an income cut is a slice of that, not of the model.
match_merchantNoInclude merchant geography when filtering by `location`. Defaults true.
include_childrenNoExpand a parent merchant to its sub-brands before matching. **Defaults true.** Merchants merged into the requested one are the same merchant and are always included, whatever this is set to — their history stays under the retired id. Applies to merchants named by id, canonical name, directory brand or group; exact descriptors are matched as given. Expansion fails open: a failed directory lookup expands nothing rather than failing the query.
exclude_subscriptionsNoExclude membership/subscription fee rows (DashPass, Uber One, Instacart+, …). Defaults false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / weighting / description
      Previous value: -"`raw` (the default): model volume, `weighted_cents` equals\n`total_cents`. `population`: the weighted fields reweight the model\nto the mix of US adults (for shares, comparisons and growth, not\nmarket size), with `effective_n`, `low_precision`, `suppressed` and\na `weighting` object. A month has weights once it has been raked,\nfrom 2025-09 on. `same_account`: growth compares one set of accounts,\nthose with spend in the model in both of two months, chained month by\nmonth, so accounts arriving or leaving can't move it. Levels and\nshares stay raw. A growth block gains `same_account_change_pct` and\n`same_account_yoy_pct`, or `same_account_unavailable` saying why not,\nand a monthly series carries chained dollars in `weighted_cents`. It\nneeds whole, settled calendar months, the newest month waits for the\nmonth after it on the default `stable` accounts, and it is in validation (403\n`same-account-weighting-forbidden` until open to the key). Omit it to\nget the response shape callers had before it existed."New value: +"`raw` (the default): model volume, `weighted_cents` equals\n`total_cents`. `population`: the weighted fields reweight the model\nto the mix of US adults (for shares, comparisons and growth, not\nmarket size), with `effective_n`, `low_precision`, `suppressed` and\na `weighting` object. A month has weights once it has been raked,\nfrom 2025-09 on. `same_account`: growth compares one set of accounts,\nthose with spend in the model in both of two months, chained month by\nmonth, so accounts arriving or leaving can't move it. It is\nturnover-adjusted: each month also carries the merchant's or\ncategory's own balance of accounts arriving and leaving (the median\nover 12 months), which shared accounts alone miss. Levels and shares stay raw. A growth block gains `same_account_change_pct` and\n`same_account_yoy_pct`, or `same_account_unavailable` saying why not,\nand a monthly series carries chained dollars in `weighted_cents`. It\nneeds whole, settled calendar months, the newest month waits for the\nmonth after it on the default `stable` accounts, and it is in validation (403\n`same-account-weighting-forbidden` until open to the key). Omit it to\nget the response shape callers had before it existed."
  2. First observed

TDQS

A4.1/5.0
Behavior5/5

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

Annotations only declare read-only and non-destructive; the description adds substantive constraints the agent could not otherwise know: a 366-day maximum window, a 16-week cap on weekly series, the partial_panel/full_panel quoting rule, and the merchant-resolution precedence order. It also discloses the degradations (loose name match, ambiguity refusing with candidates) in a way that directly changes how an agent should retry.

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?

The first paragraph is dense, front-loaded and earns its place, but roughly half the text is cross-tool answer-formatting guidance (leading with findings, never saying "panel," escalation phrasing) that is not specific to this tool. It also instructs the agent to avoid using parameter and field names while itself being full of them, which is structurally confusing inside a tool definition.

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 19-parameter read tool with no output schema, the description covers the window limits, the subject resolution order, the normalization and weighting selection, and the shape of the series output. It is close to complete for invocation; the main gap is that it never sketches what the response payload looks like, which matters given there is no output schema.

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, and the description earns above that by explaining the interaction between parameters: `normalize=per_account` with `growth=true` as the brand-growth figure, and `weighting=population` for shares between groups. These pairings are not derivable from the schema alone. Minor deduction because it references `partial_panel`/`full_panel`, which do not appear in the supplied schema.

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 states a specific verb and resource: total spend for a merchant or set of merchants over a window, with an optional day/week/month series. That is unambiguous about what the tool returns. It does not, however, distinguish itself from siblings like breakdown or category_summary, so an agent must infer the boundary from names alone.

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?

It gives concrete routing rules: name the brand directly in `merchant` and "don't search first," and prefer a `merchant_id` from an earlier result. It also specifies the retry path when `matched_by descriptor` comes back. What is missing is any statement of when a different tool (breakdown, category_summary, compare_brands) would be the better choice.

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.