Skip to main content
Glama

TradeStats - customs trade statistics

get_series

Monthly time series for one product (HS2/4/6 or national code) of one reporter and partner country (default: world total). Per month: value and value_usd, quantity, kilograms, unit price (per unit and per kg), year-over-year and month-over-month change, share of the country total and trailing-12-month share, flags for months whose changes are not comparable because of a reclassification or definition change. When available it also includes precomputed signals: 3- and 6-month moving averages, deviation from them, acceleration, 12-month volatility and a 36-month anomaly score, each with the number of months used. Use from/to (YYYY-MM, or just YYYY for a whole year) to choose the range; the latest 200 months are returned at most. A monthly answer also carries totals, the sums over the rows returned (months_with_value, value, value_usd, quantity only when every row has one in a single unit, kg, unit_price = value / quantity and unit_price_kg as ratios of sums; complete says whether every month of the range has a row and nothing was cut by the 200-row limit). When quantity, kg or unit_price is null the row says why (quantity_unavailable_reason, kg_unavailable_reason, unit_price_unavailable_reason; for mixed_units also child_units, the units below the code). freq "year" returns calendar-year totals instead (value, quantity, unit price, year-over-year changes; the current year is flagged ytd). Use it for history, trends and quantity or unit-price questions (e.g. frozen shrimp 030617 by year, or lithium-ion batteries 850760 from one country by month). For a quick overview of the latest figures use get_item_summary instead; for the busy and slow months use get_seasonality. Not included: forecasts, partner detail (see get_partners). Customs trade statistics of several reporting countries (Japan JP, United States US, United Kingdom GB, European Union (27 member states) EU) from their official customs data, monthly, by HS product code and partner country. value fields are in the reporter's currency (currency: JPY, USD, GBP or EUR) and _usd fields in US dollars; ratios and shares are fractions precomputed from the full dataset; every answer carries reporter, currency, data_through (latest published month), the reporter's attribution, and notes. Maximum 200 rows per answer. Numbers in answers are rounded once, at the end: amounts (value, _usd, v12 ...) to 2 decimals, quantity and kg to 3, unit prices (unit_price) to 4 significant digits below 100 and 2 decimals from 100 up (never rounded to 0), and ratios, shares and growth rates (yoy, mom*, share*, hhi*, chg3y) to 6; whole numbers and null are left as they are. A null quantity, kg or unit price comes with a *_unavailable_reason (mixed_units, weight_only, no_quantity_in_source, no_weight_in_source, source_gap, withheld; get_catalog lists them in null_reasons), and a missing seasonality with seasonality_unavailable_reason. The national level (JP 9-digit, US 10-digit, GB 8-digit codes) differs between reporters and between import and export; EU has no national level (HS6 only); HS6, HS4 and HS2 are shared. Import and export are separate datasets, so reporter and flow are always required for product figures. Rankings (limit) are limited to the top 20 without an API key (more is refused with out_of_scope) and to 100 with a free API key. Start with get_catalog (coverage, your access limits, which tool to use) or, when you already know the code, get_item_summary for a one-call overview of a product.

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>"
    },
    "name": "get_series"
  }
}

Input Schema

NameRequiredDescriptionDefault
toNoLast month, YYYY-MM, or a year, YYYY (e.g. "2025", read as YYYY-12). Default: latest published month.
codeYesHS product code with 2, 4 or 6 digits, or the reporter's national code (JP 9 digits, US 10, GB 8; a reporter without a national level, such as EU, has HS6 as its finest level); dots are ignored (e.g. "85", "8507", "850760" or "8507.60"). National codes differ between reporters and between import and export; find codes with search_items. On a build that serves HS6 and above a national code without a series answers fine_digits_not_served: retry with its 6-digit parent.
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.
freqNomonth (default): one row per month. year: calendar-year totals (value, quantity, unit price, year-over-year changes; the current year is flagged ytd); from/to select the years.
fromNoFirst month, YYYY-MM (e.g. "2024-01"), or a year, YYYY (e.g. "2000", read as YYYY-01). With freq "year" the year of this month is the first year. Default: the first month with data.
limitNoOptional, monthly rows only. Number of NEWEST months to return (default and maximum 200); earlier months are cut off and complete is false. Use from/to to choose a range instead.
countryNoPartner country: ISO 3166 alpha-2 code (e.g. "CN", "DE", "VN") or the name as published; omit for the world total (WLD).
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.
include_signalsNoInclude precomputed signals (moving averages, acceleration, volatility, anomaly score) for monthly rows (default true). Set false for a smaller answer.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden and mostly does so: it discloses the 200-row/200-month cap, currency versus *_usd fields, data_through and attribution metadata, rounding rules, null-reason codes, and that import and export are separate datasets with no combined view. The deduction is for a stray paragraph about ranking access limits ("top 20 without an API key... 100 with a free API key") that has no bearing on this tool's `limit` (months) and could mislead an agent into thinking its row cap is key-dependent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

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

It is front-loaded with what gets returned, but it runs well past 400 words with visible repetition: the null/unavailable_reason explanation appears twice in near-identical form, and rounding plus access-limit boilerplate is appended in the middle of product-specific guidance. Whole clauses (rankings, hhi*, chg3y) do not apply to this tool at all and dilute the routing message.

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 nine-parameter tool with no output schema, the description does the heavy lifting well: it enumerates returned fields, totals semantics, `complete`, freq "year" behavior, national-level digit differences per reporter, and null-reason codes. The only real gap is the ambiguous ranking/API-key limit sentence, which leaves the effective row cap for keyless callers unclear.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all nine parameters, including from/to patterns, code digit rules, flow enum and include_signals default. The description adds only marginal meaning beyond it — the YYYY-reads-as-December convention and the interaction between the 200-row cap and `complete` — while much of its parameter talk restates 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 sentence states a specific verb and resource: monthly time series for one product code, one reporter and one partner country. It immediately names the unit of return (rows per month) and the default (world total), so an agent can tell this apart from get_item_summary, get_seasonality and get_partners without opening the 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?

It gives explicit when-to-use framing ("history, trends and quantity or unit-price questions" with concrete examples) and names concrete alternatives with their selecting conditions: get_item_summary for a quick overview, get_seasonality for busy/slow months, get_partners for partner detail, get_catalog when starting out. It also states what is out of scope (forecasts, partner detail), which is exactly the routing information an agent needs.

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