Skip to main content
Glama

TradeStats - customs trade statistics

get_trade_shift

Trade around a month you name (a tariff, a quota or another policy date; this service keeps no list of policies): for one HS code of 2, 4 or 6 digits, the months before the event month and the months from it (the event month included) are each compared with the same months a year earlier, so the season is the same on both sides. Returns each month (value in US dollars, weight in kg and their year-on-year changes), pre_yoy and post_yoy of the two windows, a front_loading status, the partners whose value rose most after the event, and with "country" a diversion block: the change of that partner, the change of all other partners (the two add up to total_change_usd) and how much of its fall the gains of the others make up (offset_ratio). front_loading is "consistent" when pre_yoy is at least +20% and post_yoy at most -10%; diversion is "consistent" when the partner fell and the gains of the others make up at least 50% of the fall. Use it for questions such as whether imports or exports of a product rose before a tariff date and fell after it, or whether a fall towards one partner was matched by gains elsewhere. These are our own convenience thresholds, not a standard; the statuses say whether the figures form a pattern consistent with front-loading or with a shift between partners, never that it happened. Front-loading, diversion, exchange rates, stocks, seasonality and classification changes cannot be told apart by these figures. The judgement uses the weight in kg (basis quantity_kg) when every month of the windows has a weight covering all of its value; otherwise it uses US-dollar values (basis value_usd), which include price and exchange-rate effects, and says so. A window that crosses a change in the source definition or the HS classification, or has a missing month, is null with a reason (definition_break, source_gap, withheld for an amount withheld by the publishing authority, or non_positive when the year-earlier total is zero), never zero. A partner month with no row counts as no trade only when the month is published, neither the code nor its HS2 chapter has a source gap that month, and there is no withheld (undisclosed) amount that month for the chapter or with an unknown chapter; otherwise that partner, and any partner with a row without a US-dollar value, is left out of top_gainers (gains_complete false; the gains summed are then only the known ones, a lower bound), and for the partner given in "country" the diversion is not_assessed with the reason. "country" cannot be the world total. Give "reporter", "flow", "code" and "event_month"; "before" and "after" are 1 to 12 months (default 6 each); "country" is the partner to look at (optional). The figures are our own calculation from public customs statistics, not official figures. Reference information computed mechanically from public statistics; not investment advice, a credit rating or a trading recommendation.

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": {
      "reporter": "<reporter>",
      "flow": "<flow>",
      "code": "<code>",
      "event_month": "<event_month>"
    },
    "name": "get_trade_shift"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesRequired. HS code of 2, 4 or 6 digits; dots are ignored (for example "8703"). National codes are not accepted.
flowYesRequired. "import" (goods entering the reporting country) or "export" (goods leaving it); there is no combined view: "both" does not exist. For a comparison across countries use compare_countries, for exports minus imports use get_balance.
afterNoOptional. Months from the event month on, the event month included (1 to 12, default 6). Shortened to the latest published month.
beforeNoOptional. Months before the event month (1 to 12, default 6).
countryNoOptional. The partner country to look at for a shift to other partners, as an ISO alpha-2 code or a name (for example "US"). Omit it for the partner gains only.
reporterYesRequired. The reporting country whose customs statistics are read: "JP" (Japan), "US" (United States), "GB" (United Kingdom) or "EU" (European Union (27 member states)). Partners are the other countries.
event_monthYesRequired. The month of the policy or event, YYYY-MM. It is the first month of the after-window and must not be after the latest published month.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / reporter / description
      Previous value: -"Required. The reporting country whose customs statistics are read: \"JP\" (Japan), \"US\" (United States) or \"GB\" (United Kingdom). Partners are the other countries."New value: +"Required. The reporting country whose customs statistics are read: \"JP\" (Japan), \"US\" (United States), \"GB\" (United Kingdom) or \"EU\" (European Union (27 member states)). Partners are the other countries."
    • changedInput schema / properties / reporter / enum
      Previous value: -[
      -  "JP",
      -  "US",
      -  "GB"
      -]New value: +[
      +  "JP",
      +  "US",
      +  "GB",
      +  "EU"
      +]
  2. Changed2 schema fields changed
    • changedInput schema / properties / reporter / description
      Previous value: -"Required. The reporting country whose customs statistics are read: \"JP\" (Japan) or \"GB\" (United Kingdom). Partners are the other countries."New value: +"Required. The reporting country whose customs statistics are read: \"JP\" (Japan), \"US\" (United States) or \"GB\" (United Kingdom). Partners are the other countries."
    • changedInput schema / properties / reporter / enum
      Previous value: -[
      -  "JP",
      -  "GB"
      -]New value: +[
      +  "JP",
      +  "US",
      +  "GB"
      +]
  3. Added

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations, the description carries the full disclosure burden, and it does: it explains which basis is used (kg when every month's weight covers its value, otherwise USD with price and FX effects), the exact thresholds for 'consistent' front_loading and diversion, and that these are convenience thresholds rather than a standard. It also discloses that nulls carry reasons (definition_break, source_gap, withheld, non_positive), that missing partner months are only treated as no-trade under stated conditions, that top_gainers can be a lower bound with gains_complete false, and that country cannot be the world total.

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 core definition is front-loaded, which is good, but the body is a handful of very long, heavily subordinated sentences that pack thresholds, null rules, and completness caveats into run-ons. Most content is substantive rather than filler, but the density and lack of paragraph or bullet structure make it slow to parse for the fields an agent needs at call time.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with seven parameters, no output schema, and a fairly complex computation, the description covers everything an agent needs: inputs, defaults, the basis used, what each returned field means, the null/degradation cases, and the caveat about non-causality. Return values are explained in text in lieu of an output schema, so nothing essential is missing.

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 schema already documents each parameter, and the closing sentence largely restates required fields and defaults. The description still adds real meaning the schema lacks — most notably that country cannot be the world total, and how country drives the diversion block and its not_assessed outcome. That is meaningful additional semantics, though not enough to fully escape repetition.

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 description names a specific operation: comparing the months before a named event month and the months from it (inclusive) with the same months a year earlier, for one HS code, per reporter and flow. It spells out exactly what is returned (monthly values and YoY changes, pre_yoy/post_yoy, front_loading, top_gainers, offset_ratio), so an agent knows the resource and computation precisely. It does not name a sibling to contrast with, but the scope statement is unambiguous on its own.

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 explicit use cases: whether imports or exports of a product rose before a tariff date and fell after, or whether a fall toward one partner was matched by gains elsewhere. It also rules out some misreadings by saying the statuses never prove that front-loading or diversion happened. It stops short of saying when to use a different tool or what conditions argue against this one.

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