Skip to main content
Glama

Spend breakdown

breakdown
Read-only

Spend split by one or two dimensions: top categories, spend by state, income mix, top merchants, a category by month. "Q3 vs Q2 by category" is two calls, one per window. The window is at most 366 days. Each group key comes back in its own named field.

Covers ALL transaction types (purchases, refunds, transfers, income), unlike query_spend, category_trends and compare_brands, which are purchase-only. Pass transaction_type=purchase to compare with them.

Filter a merchant by name with merchant (no search first), or by merchant_id; grouping by merchant_id rolls sub-brands up to the brand, and each row names its merchant in merchant_name (null when the directory has no name for it). A store ZIP split is group_by=merchant_postal_code with merchant_id on the same call. State is spender_state (cardholder) or merchant_state (store); there is no location dimension, and location is a metro name such as Pittsburgh. spender_cbsa / merchant_cbsa are metro codes. area_income_tier Q1 (lowest) to Q5 describes the cardholder's neighbourhood; income_bracket covers about 6% of volume, so prefer area_income_tier. payment_method is debit, credit and named rails such as PayPal; Apple Pay and buy-now-pay-later are not here.

In raw mode, compare shares within a dimension, not dollar totals across places, or pass weighting=population. Rows are by total spend, largest first, 25 by default; truncated: true means page with next_offset. Not foot traffic, rent or SKU sales. At most two dimensions.

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

Input Schema

NameRequiredDescriptionDefault
groupNoRestrict to a merchant group by slug or UUID (`find_groups` lists them), such as a basket like `big-grocery` or a collection like `ai-providers`. Resolved server-side to the group's flat membership (with each member's sub-brands) and echoed under `merchant_group`; an unknown group is a 400 `merchant-group-unknown`. ANDs with `merchant_id`.
limitNoGroups per response.
offsetNoGroups to skip, for paging.
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
age_bandNoRestrict to these cardholder age bands: `18-24`, `25-34`, `35-44`, `45-54`, `55-64`, `65+`. `unknown` selects rows with no age upstream.
categoryNoRestrict to these categories. Comma-separated or repeated, max 50. Category keys are lower-case and exact: `automotive`, `delivery`, `education`, `entertainment`, `financial_services`, `gifts_donations`, `government`, `grocery`, `healthcare`, `home_services`, `personal_care`, `pets`, `professional_services`, `restaurants`, `retail`, `subscriptions`, `tax_services`, `technology`, `travel`, `utilities`, `uncategorized`, plus older keys the data still carries (list every key with the breakdown, `group_by=category`). Any other name is a 400 `…/problems/category-unknown` whose `candidates` are the closest keys (`Groceries` → `grocery`).
end_dateYesInclusive ISO-8601 date. At most 366 days after `start_date`.
group_byYesOne or two dimensions, comma-separated or repeated. State is spender_state (cardholder) or merchant_state (store); there is no location. payment_method is the card (debit, credit, prepaid, health_benefit). PayPal is facilitator. Apple Pay and buy-now-pay-later are not values. facilitator is who billed the purchase, read from the descriptor's prefix (`PayPal`, `Venmo`, `SQUARE`, `Klarna`, a payment app or a measured processor, and `direct` for none); it needs `merchant`, `merchant_id` or `group`, counts purchases only (the response says `transaction_type: purchase`), and pairs with day, week, month, category, subcategory, income_bracket, merchant_metro, spender_metro, merchant_cbsa or merchant_id. Its rows sum to the merchant's purchase total. Two is the maximum: a three-way split multiplies group cardinality past what a single response should carry.
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 brand by name — "top categories at Starbucks" with no search first. Resolved to the directory merchant like the merchant query's `merchant` (exact canonical/alias/DBA, then whole-word) and echoed under `merchant` with `merchant_ids` and `matched_names`. A name the directory does not hold is 400 `…/problems/merchant-not-found`; one naming several merchants is 400 `…/problems/merchant-ambiguous` with `candidates`. `merchant_id` wins when both are given.
order_byNoSort key, descending for the measures. `group_key` sorts by the dimensions ascending instead — the stable order for paging through a full enumeration.total_cents
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.
merchant_idNoRestrict to these canonical merchant UUIDs (comma-separated or repeated, max 50) — "top categories at Walmart". A parent id also matches its children.
subcategoryNoRestrict to these subcategories. Comma-separated or repeated, max 50. Subcategory keys are lower-case and exact (`supermarket`, `fast_food`; list them with the breakdown, `group_by=subcategory`). Any other name is a 400 `…/problems/subcategory-unknown` whose `candidates` are the closest keys. Three `retail` keys: `wholesale_clubs` is warehouse clubs & supercenters (Costco, Sam's Club, BJ's, Walmart); `department_stores` is Macy's, Kohl's, Nordstrom and Target; `marketplaces` is eBay, Temu and TikTok Shop.
spender_cbsaNoRestrict to cardholders living in these metropolitan areas. Each value is a 5-digit CBSA code (`19100`), a non-metro bucket (`NM-TX`), or a name — the full OMB title or a principal city, optionally with its state (`Dallas`, `Portland, OR`). Names are resolved server-side and echoed under `resolved_filters`; a name that fits several metros is a 400 listing them as `candidates`, an unknown one is a 400 `cbsa-unknown`. Comma-separated or repeated, max 50; a single value that is itself a name with a comma (`Portland, OR`, a full OMB title) is matched whole first.
match_spenderNoInclude spender geography when filtering by `location`. Defaults true.
merchant_cbsaNoRestrict to stores in these metropolitan areas (from the merchant ZIP). Same values and resolution as `spender_cbsa`.
spender_metroNoRestrict to these coded spender (cardholder) metros.
spender_stateNoRestrict to cardholders in these 2-letter states.
income_bracketNoRestrict to these cardholder income bands. Comma-separated or repeated — unlike the single-value `income_bracket` on the merchant query. `unknown` selects rows with no income upstream.
match_merchantNoInclude merchant geography when filtering by `location`. Defaults true.
merchant_metroNoRestrict to these coded merchant metros. ANDs with `spender_metro` — for a single metro matched on either side, use `location`.
merchant_stateNoRestrict to these 2-letter merchant states.
payment_methodNoRestrict to these card types, the same values breakdown returns for group_by=payment_method: debit, credit, prepaid, health_benefit. PayPal is facilitator. Not Apple Pay, not buy-now-pay-later, and not which account funded the card.
area_income_tierNoRestrict to these area income tiers, `Q1` (lowest) to `Q5` — national quintiles of the median household income of the cardholder's ZIP area. `unknown` selects rows with no tier.
transaction_typeNoRestrict to these transaction types. `purchase` is what makes totals here reconcile with `query_spend` and `category_trends`.
merchant_group_idNoThe older name of `group`. `group` wins when both are given.
merchant_postal_codeNoRestrict to these merchant ZIPs.
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. Changed2 schema fields changed
    • changedInput schema / properties / group_by / description
      Previous value: -"One or two dimensions, comma-separated or repeated. State is\nspender_state (cardholder) or merchant_state (store); there is\nno location. payment_method is the card rail (debit, credit,\nPayPal, and the other rails this tool returns). Apple Pay and\nbuy-now-pay-later are not values. facilitator is who billed the\npurchase, read from the descriptor's prefix (`PayPal`, `Venmo`,\n`SQUARE`, `Klarna`, a payment app or a measured processor, and\n`direct` for none); it needs `merchant`, `merchant_id` or\n`group`, counts purchases only (the response says\n`transaction_type: purchase`), and pairs with day, week, month,\ncategory, subcategory, income_bracket, merchant_metro,\nspender_metro, merchant_cbsa or merchant_id. Its rows sum to the\nmerchant's purchase total. Two is the\nmaximum: a three-way split multiplies group cardinality past\nwhat a single response should carry."New value: +"One or two dimensions, comma-separated or repeated. State is\nspender_state (cardholder) or merchant_state (store); there is\nno location. payment_method is the card (debit, credit, prepaid,\nhealth_benefit). PayPal is facilitator. Apple Pay and\nbuy-now-pay-later are not values. facilitator is who billed the\npurchase, read from the descriptor's prefix (`PayPal`, `Venmo`,\n`SQUARE`, `Klarna`, a payment app or a measured processor, and\n`direct` for none); it needs `merchant`, `merchant_id` or\n`group`, counts purchases only (the response says\n`transaction_type: purchase`), and pairs with day, week, month,\ncategory, subcategory, income_bracket, merchant_metro,\nspender_metro, merchant_cbsa or merchant_id. Its rows sum to the\nmerchant's purchase total. Two is the\nmaximum: a three-way split multiplies group cardinality past\nwhat a single response should carry."
    • changedInput schema / properties / payment_method / description
      Previous value: -"Restrict to these card rails, the same values breakdown returns\nfor group_by=payment_method: debit, credit, PayPal, and the\nother rails that tool returns. Not Apple Pay, not\nbuy-now-pay-later, and not which account funded the card."New value: +"Restrict to these card types, the same values breakdown returns\nfor group_by=payment_method: debit, credit, prepaid,\nhealth_benefit. PayPal is facilitator. Not Apple Pay, not\nbuy-now-pay-later, and not which account funded the card."
  3. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare read-only and non-destructive, yet the description still adds real behavioral payload: the 366-day window cap, 25-row default with truncated/next_offset paging, merchant_name nulls when the directory lacks a name, income_bracket covering only ~6% of volume, and the warning not to compare raw dollar totals across places without weighting=population. It stops short of describing error/permission behavior or rate limits, so it is not exhaustive.

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 purpose and scope before parameter-level detail, and most sentences carry unique operational content. It is long, and the spender_state/merchant_state and payment_method explanations restate what the schema already says, so a little trimming is possible. The closing plain-language instruction is unusual in a tool description but does earn its place by constraining output wording.

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 31-parameter tool with no output schema and no nested objects, the description supplies the key return-shape facts (each group key in its own named field, rows sorted by spend, 25 by default, truncated/next_offset paging) plus the cross-tool reconciliation rule. Remaining gaps are minor and mostly covered by the unusually detailed 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, but the description adds operational meaning beyond the schema: merchant_id grouping rolls sub-brands to the brand, merchant name needs no prior search, area_income_tier is preferred over income_bracket, and payment rails like PayPal live in facilitator rather than payment_method. Some of this duplicates the enum descriptions, keeping it below 5.

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-plus-resource ('Spend split by one or two dimensions') and immediately gives representative outputs (top categories, spend by state, income mix, top merchants, category by month). It explicitly separates itself from query_spend, category_trends and compare_brands by transaction-type coverage, so an agent can pick it without opening another 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?

States when to use alternatives and how to reconcile with them: the three named siblings are purchase-only, and 'Pass transaction_type=purchase to compare with them.' It also supplies task recipes ('Q3 vs Q2 by category is two calls, one per window', store ZIP split = merchant_postal_code with merchant_id) and tells the agent not to search a merchant first.

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.