Skip to main content
Glama

TradeStats - customs trade statistics

decompose_change

Splits the change in the value of a named indicator or of an HS code into a unit-value (price) effect and a volume effect: the latest window of 1, 3 or 12 months (default 12) is compared with the same months a year earlier, with the log-mean (LMDI) method, so the two effects add up to the change in value exactly (check shows the residual). The answer gives value, quantity and unit value for both windows in the reporter currency and in US dollars. Give either "indicator" (an id or alias from list_indicators; only indicators that have a quantity measure can be split, others answer decomposition_not_applicable) or "reporter", "flow" and "code" (HS code of 2, 4 or 6 digits or the national code; "country" for one partner). Use it for questions such as how much of a change in imports or exports came from a higher unit value and how much from a larger quantity. The unit value is value divided by quantity, a calculation that also reflects product mix, not a price index; in US dollars the exchange-rate movement is part of the price effect; the split describes the numbers and does not show causes. A window with a missing month, a missing weight or a zero quantity is returned as null with a reason, never as a zero effect. Reference information computed mechanically from public statistics; not investment advice, a credit rating or a trading recommendation.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "decompose_change"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeNoHS product code of 2, 4 or 6 digits or the national code of the reporter; dots are ignored (for example "850760"). Give this (with reporter and flow) or indicator, not both.
flowNoimport or export. Required with code; not used with indicator.
monthNoOptional. The last month of the window, YYYY-MM; default the latest month. The window and the year-earlier window must lie inside your history.
windowNoMonths in the window compared with the same months a year earlier: 1, 3 or 12 (default 12).
countryNoOptional, codes only. Partner country as an ISO alpha-2 code or a name; omit for the world total.
quantityNoThe quantity that the unit value divides by: "kg" (weight, default) or "qty" (the unit of the product, only where it is a single unit; otherwise null with mixed_units). Indicators answer quantity from kg only; "qty" applies to an HS code.
reporterNoThe reporting country (JP, US, GB or EU). Required with code; not used with indicator.
componentNoOptional, indicators only. The component to split when the indicator has several; the default is the one its definition names.
indicatorNoThe indicator id (for example "jp.naphtha.import_unit_price"), an alias in English or Japanese, or a few distinctive words; see list_indicators. Give this or code, not both.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full behavioral burden and does so well: it discloses the computation method, that the two effects sum exactly to the value change with the residual exposed by "check", both currency views including the exchange-rate component of the price effect, and the null-with-reason policy for missing months, missing weight or zero quantity. It also bounds the interpretation (mix, not a price index; describes numbers, not causes) and flags the mechanical/public-statistics nature of the output.

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 purpose is front-loaded in the first clause, but the body is a single dense paragraph that interleaves method, input routing, interpretation caveats, null handling and a legal disclaimer, making it hard to scan for the parameter rules. The compliance sentence about investment advice/credit rating is defensible boilerplate, but overall the text could be segmented for faster parsing.

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 9-parameter tool with no output schema, the description does explain the return payload (value, quantity and unit value for both windows, in reporter currency and USD) and the null semantics, which is what an agent needs to interpret results. It stops short of describing the response envelope or the "check" field's structure, but nothing essential to calling the tool correctly is absent.

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% with per-parameter descriptions, so the baseline is 3; the description still adds meaning by stating the default window of 12 and, importantly, the cross-parameter constraint that only indicators carrying a quantity measure can be decomposed, otherwise decomposition_not_applicable. It clarifies that the indicator path is id-or-alias from list_indicators and that "country" selects a single partner, though most other parameter rules are restatements of 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 opening clause names a specific operation and object: it splits a change in value into a unit-value (price) effect and a volume effect. It also pins down the comparison basis (latest 1/3/12-month window vs. the same months a year earlier) and the method (log-mean LMDI), which no sibling tool does, so an agent can tell it apart from get_series or get_indicator immediately.

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 an explicit when-to-use trigger ("questions such as how much of a change in imports or exports came from a higher unit value and how much from a larger quantity") and states the two mutually exclusive input routes (indicator, or reporter+flow+code), plus the failure mode (decomposition_not_applicable for indicators without a quantity measure). It does not explicitly say when to prefer a sibling such as get_series for raw values, so not a full 5.

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