Skip to main content
Glama

TradeStats - customs trade statistics

compare_countries

One product (HS2, HS4 or HS6 code, e.g. "850760" lithium-ion batteries, "8708" auto parts, "72" iron and steel, "030617" frozen shrimp) side by side across several reporting countries (default: every reporter currently available, as listed by get_catalog) for one flow. Every country is measured over the same 12 months, ending at common_month (the latest month all compared countries have published, normally the earliest of their latest months). Per country: the 12-month value in US dollars on a comparable basis (imports CIF, exports FOB; the US export value is FAS and the notes say so), the previous 12 months and year-over-year change, kilograms, the unit price in US dollars per kg (only where weights exist; kg_coverage says what share of the value has a weight) and the 3 largest partners with their shares. A country without the code is status "no_code" and one with a missing month status "no_data"; they are never shown as 0. Partner definitions differ between countries (origin, consignment, destination); the notes explain it. Use it for "which country trades more of X" or "how do unit prices compare"; national codes (JP 9 digits, US 10, GB 8, EU 8) are rejected. Use get_mirror_trade instead to put one country's exports to another next to that country's imports from it, and get_item_summary for the full detail of one country. 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": {
      "code": "<code>",
      "flow": "<flow>"
    },
    "name": "compare_countries"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesHS product code with 2, 4 or 6 digits (e.g. "85", "8708" or "850760"; dots are ignored). National codes are not comparable across countries and are rejected; find the HS6 code with search_items.
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.
reportersNoOptional. The reporting countries to compare, at least two of "JP", "US", "GB" or "EU" (e.g. ["JP","GB"]); in a query string a comma-separated list (JP,GB). Default: every available reporter.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / reporters / description
      Previous value: -"Optional. The reporting countries to compare, at least two of \"JP\", \"US\" or \"GB\" (e.g. [\"JP\",\"GB\"]); in a query string a comma-separated list (JP,GB). Default: every available reporter."New value: +"Optional. The reporting countries to compare, at least two of \"JP\", \"US\", \"GB\" or \"EU\" (e.g. [\"JP\",\"GB\"]); in a query string a comma-separated list (JP,GB). Default: every available reporter."
    • changedInput schema / properties / reporters / items / enum
      Previous value: -[
      -  "JP",
      -  "US",
      -  "GB"
      -]New value: +[
      +  "JP",
      +  "US",
      +  "GB",
      +  "EU"
      +]
  2. Changed2 schema fields changed
    • changedInput schema / properties / reporters / description
      Previous value: -"Optional. The reporting countries to compare, at least two of \"JP\" or \"GB\" (e.g. [\"JP\",\"GB\"]); in a query string a comma-separated list (JP,GB). Default: every available reporter."New value: +"Optional. The reporting countries to compare, at least two of \"JP\", \"US\" or \"GB\" (e.g. [\"JP\",\"GB\"]); in a query string a comma-separated list (JP,GB). Default: every available reporter."
    • changedInput schema / properties / reporters / items / enum
      Previous value: -[
      -  "JP",
      -  "GB"
      -]New value: +[
      +  "JP",
      +  "US",
      +  "GB"
      +]
  3. Changed2 schema fields changed
    • changedInput schema / properties / reporters / description
      Previous value: -"Optional. The reporting countries to compare, at least two of \"JP\", \"US\", \"GB\" or \"EU\" (e.g. [\"JP\",\"GB\"]); in a query string a comma-separated list (JP,GB). Default: every available reporter."New value: +"Optional. The reporting countries to compare, at least two of \"JP\" or \"GB\" (e.g. [\"JP\",\"GB\"]); in a query string a comma-separated list (JP,GB). Default: every available reporter."
    • changedInput schema / properties / reporters / items / enum
      Previous value: -[
      -  "JP",
      -  "US",
      -  "GB",
      -  "EU"
      -]New value: +[
      +  "JP",
      +  "GB"
      +]
  4. 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, the description carries the entire burden and does so: it defines the comparable basis (imports CIF, exports FOB, US exports FAS), the common_month window logic, the status vocabulary (no_code, no_data – never zero), the differential partner definitions (origin/consignment/destination), the 200-row cap and the 20/100 ranking limits with the out_of_scope refusal, and the exact rounding policy including the never-round-to-zero rule for unit prices.

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 correctly front-loaded in the first sentence, but the body balloons into one undifferentiated block covering null-reason vocabularies, rounding digits per field type, rate limits and API-key tiers – much of which belongs in get_catalog or a reference section. An agent scanning for the essentials must wade through material that is accurate but not decision-relevant 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 three-parameter comparison tool with no output schema and no annotations, the description pre-empts the failure modes an agent would otherwise hit: incompatible national code lengths, missing months silently read as zero, differing partner definitions, and truncated result sets. Return fields are described per country, which compensates for the absent output schema.

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 coverage is 100%, so the schema already documents all three parameters including the flow enum and the reporters enum. The description adds real meaning around defaults ("every reporter currently available, as listed by get_catalog") and the all-countries-same-12-months constraint, but it also repeats schema facts such as which national code lengths are rejected, so the baseline-3 is appropriate rather than a clear upgrade.

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?

Opens with a specific verb and resource: one HS product code compared side by side across several reporting countries for one flow, over a common 12-month window. Concrete code examples ("850760", "8708", "72", "030617") leave no ambiguity about the input shape, and the first paragraph ends by naming get_mirror_trade and get_item_summary as the alternatives for other shapes of question.

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 explicit when-to-use triggers ("which country trades more of X" or "how do unit prices compare"), explicit when-not (national-level codes are rejected; use get_mirror_trade to place one country's exports next to another's imports; get_item_summary for a single country's full detail) and an entry-point recommendation (start with get_catalog). The schema's flow description corroborates the routing advice, so nothing is left to inference.

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