Skip to main content
Glama

Compare brands

compare_brands
Read-only

Compare two brands over the same window

Each side is specified independently, in precedence order group_* > ids_* > canonical_* > names_* > brand_*. A side may be a merchant group (group_a=ai-providers; find_groups lists them), against a brand or another group: its members are read as one set, unique purchasers counted once across it, and the side echoes merchant_group. Both sides share one window and one set of filters. Exactly two sides. To rank a longer peer set, use breakdown with group_by=merchant_id.

An ids_*, canonical_* or resolved brand_* side reads its merchants' sub-brands, as the merchant query does; include_children=false drops them from both sides. Merged rows are always read. The side's merchant_ids echo the expanded set.

Exactly two sides. Name each with brand_a and brand_b; no search first. To rank more brands, call breakdown grouped by merchant_id.

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": "compare_brands"
  }
}

Input Schema

NameRequiredDescriptionDefault
ids_aNoCanonical merchant UUID(s) for side A.
ids_bNoCanonical merchant UUID(s) for side B.
brand_aNoBrand token for side A, matched like the merchant query's `merchant`: the directory merchant it names (exact canonical/alias/DBA, then whole-word), read by id; descriptor substring only when no directory merchant matches it. The side echoes `matched_by` and, when resolved, `merchant_ids` and `matched_names` — the canonical names the figure is for, which the caller must show when they differ from the token. A token naming several merchants, or something more specific than any merchant in the directory (`Walmart+` over Walmart; `+` is the word "plus"), is 400 `…/problems/brand-a-ambiguous` with `candidates`.
brand_bNoBrand token for side B. Same form as `brand_a`; ambiguity is `brand-b-ambiguous`.
group_aNoMerchant group for side A, by slug or UUID. An unknown group is 400 `…/problems/group-a-unknown`.
group_bNoMerchant group for side B. Same form as `group_a`.
names_aNoRaw descriptor(s) for side A. Max 50.
names_bNoRaw descriptor(s) for side B. Max 50.
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.
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.
canonical_aNoCanonical name(s) for side A.
canonical_bNoCanonical name(s) for side B.
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.4/5.0
Behavior4/5

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

Annotations already establish read-only, non-destructive, closed-world behavior, and the description adds real context beyond them: both sides share one window and one filter set, resolved sides expand to sub-brands with merged rows always included, and `include_children=false` drops sub-brands from both sides. It also surfaces concrete failure modes (400 with candidates on ambiguous brand tokens) and what the side echoes, though the finer behavioral detail on expansion lives mostly in 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.

Conciseness3/5

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

"Exactly two sides" appears three times and the `brand_a`/`brand_b` naming instruction is repeated, so the definition wastes space on restatement. The precedence rule and the alternative-tool routing are well front-loaded, but the closing paragraph on plain-word phrasing is style guidance rather than tool-selection content.

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 tool with no output schema, the definition covers side specification, precedence, shared window/filters, sub-brand expansion, ambiguity errors, and the echo fields a caller must surface. What remains thin is the returned comparison payload itself (e.g., the metric fields per side), which the agent must infer from the schema's echo descriptions.

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; the description earns above that by documenting the precedence rule `group_*` > `ids_*` > `canonical_*` > `names_*` > `brand_*`, which tells the agent what happens when more than one side parameter is supplied for a side. The cross-parameter constraint that both sides must share one date window and filter set is likewise not derivable from 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?

"Compare two brands over the same window" gives a specific verb, resource and scope, and the description immediately separates it from the nearest sibling by steering ranking tasks to `breakdown` with `group_by=merchant_id`. It also defines what a "side" can be (group, id, canonical, name, brand token), so the agent knows exactly what this tool compares.

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?

It states when to use this tool (exactly two sides, no prior search needed) and when not to (rank a longer peer set with `breakdown` grouped by merchant_id), naming the alternative explicitly along with `find_groups` for group slugs. The "no search first" instruction pre-empts a likely wrong sequencing by the agent.

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.