Skip to main content
Glama

TradeStats - customs trade statistics

get_ranking

Rankings of one reporter for a month. kind "items_for_country": the largest products (at the chosen level) for a partner country (default: world total). kind "countries_for_item": the largest partner countries for one product code. kind "movers_up" / "movers_down": the products with the largest US-dollar increase / decrease versus the same month a year earlier (for a partner, default world; kept for the world total and some partners), with previous-year value, change and year-over-year percent. month defaults to the latest. Results are precomputed ranks; limit is capped by your key tier (default top 20 without a key). Use it for "what does Japan buy from Vietnam?" (items_for_country) or "which products from China jumped this month?" (movers_up with country). get_ranking looks at a single month; for one product's partners over the latest 12 months, with growth and concentration, use get_partners instead; for one product's overview use get_item_summary. 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, EU 8-digit codes) differs between reporters and between import and export; 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>",
      "level": "<level>",
      "kind": "<kind>"
    },
    "name": "get_ranking"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeNoProduct code with the number of digits of level (e.g. "8542" with level hs4, "300490" with hs6). Required for kind countries_for_item; ignored otherwise.
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.
kindYesWhat to rank. items_for_country: largest products for country (or the world). countries_for_item: largest partner countries for code. movers_up / movers_down: products with the largest US-dollar increase / decrease versus the same month a year earlier, for country (or the world).
levelYesLevel of the products being ranked: the reporter's national level (JP hs9, US hs10, GB cn8, EU cn8), hs6, hs4 or hs2; with countries_for_item it is the level of code.
limitNoRows to return (default 20). Without an API key the maximum is 20 (more is refused with out_of_scope); with a free API key 100; never more than 200 rows per answer.
monthNoMonth YYYY-MM. Default: latest.
countryNoPartner country for items_for_country and the movers kinds: ISO 3166 alpha-2 code (e.g. "VN") or the name as published. Omit for the world total. Ignored for countries_for_item.
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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / level / description
      Previous value: -"Level of the products being ranked: the reporter's national level (JP hs9, US hs10, GB cn8; EU has none), hs6, hs4 or hs2; with countries_for_item it is the level of code."New value: +"Level of the products being ranked: the reporter's national level (JP hs9, US hs10, GB cn8, EU cn8), hs6, hs4 or hs2; with countries_for_item it is the level of code."
  2. 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"
      +]
  3. 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"
      +]
  4. 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), \"GB\" (United Kingdom) or \"EU\" (European Union (27 member states)). Partners are the other countries."New value: +"Required. The reporting country whose customs statistics are read: \"JP\" (Japan) or \"GB\" (United Kingdom). Partners are the other countries."
    • changedInput schema / properties / reporter / enum
      Previous value: -[
      -  "JP",
      -  "US",
      -  "GB",
      -  "EU"
      -]New value: +[
      +  "JP",
      +  "GB"
      +]
  5. First observed

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden and does so: it discloses that ranks are precomputed, that limit is capped at 20 without a key / 100 with a free key / 200 rows max and that over-limit requests are refused with `out_of_scope`. It also explains null handling with `*_unavailable_reason`, currency semantics for value vs *_usd fields, and that answers carry reporter, data_through and attribution.

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 ranking semantics are front-loaded, but the description is heavily padded with dataset-wide boilerplate (rounding rules down to significant-digit counts, null_reason enumerations, national-level digit differences) that is not needed to select or invoke this tool. Several sentences would be better placed in a shared dataset note.

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 an 8-parameter, four-mode tool with no output schema, the definition covers mode semantics, defaults, caps, refusal behavior, currency, and null semantics — an agent has enough to call it correctly on the first attempt.

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 every parameter including defaults (month→latest, country→world total, code required only for countries_for_item). The description mostly restates those facts and adds little beyond the schema, so baseline 3 applies.

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?

States a specific verb+resource ("Rankings of one reporter for a month") and then disambiguates all four modes of the `kind` parameter with concrete semantics. It explicitly names sibling tools it is not (get_partners, get_item_summary) and the conditions that distinguish them, so an agent can select it 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?

Gives direct when-to-use examples ("what does Japan buy from Vietnam?" → items_for_country; "which products from China jumped this month?" → movers_up), plus explicit exclusion routing to get_partners for 12-month partner analysis and get_item_summary for a single-product overview. The only weakness is that these examples appear after a dense block of prose rather than at the top.

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