Skip to main content
Glama

comtrade_get_world_trade

Read-onlyIdempotent

Fetches each reporter’s trade with the World for a chosen commodity, period, and flow, sorted by value descending.

Instructions

Every reporter's trade in one product with the World for one period, largest first.

One data/v1/get call for goods (typeCode C) without reporterCode (every reporter) and with partner 0, World, pinned to the total of every breakdown (partner2Code 0, customsCode C00, motCode 0, breakdownMode classic), with descriptions (includeDesc): one row per reporter that reported the period (167 for 2023 imports of HS chapter 27 when recorded), sorted by primary_value, largest first. Bounded by construction at one row per reporter (255 in the packaged Reporters.json), so there is no count call. Arguments are checked before the call; a mistake raises InvalidRequestError naming the closest valid value. meta.request holds the get_data arguments that were sent.

Args: commodity: One product code of cl_code: "TOTAL" all goods, an HS chapter "27", heading "2709" or subheading "270900". list_commodities("HS", search="crude") finds codes. period: One year "2023" (annual data) or month "202305" (monthly data). Recent periods fill as reporters publish; get_data_availability tells who has. flow: One trade flow: "X" exports, "M" imports, "RX" re-exports, "RM" re-imports. cl_code: Product classification, "HS" by default: all HS editions as each reporter reported them (rows name the edition in classification_code, e.g. "H6"); an edition "H0" to "H5", SITC "SS" or "S1" to "S4", BEC "B4", "B5" also work. "H6" is valid but upstream answered HTTP 500 to every try on 2026-10-23, so "HS" stays the default. EBOPS "EB", "EB02", "EB10", "EB10S" (services), "BE" and "TM" are accepted but untested with the pinned typeCode C.

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": {
      "commodity": "<commodity>",
      "period": "<period>",
      "flow": "<flow>"
    },
    "name": "comtrade_get_world_trade"
  }
}

Input Schema

NameRequiredDescriptionDefault
flowYes
periodYes
cl_codeNoHS
commodityYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, but the description adds substantial unrepeatable detail: it pins the exact upstream call shape, states the row bound (one row per reporter, 255 max) so no count call is needed, discloses sorting order, and explains error behavior (InvalidRequestError naming the closest valid value) plus the meta.request echo.

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

Conciseness4/5

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

The summary line is front-loaded and the Args block is well structured. However, the internal plumbing paragraph (partner2Code 0, customsCode C00, motCode 0, breakdownMode classic, typeCode C) and the oddly specific '167 for 2023 imports of HS chapter 27' aside are more implementation trivia than the agent needs, diluting an otherwise tight definition.

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?

With no output schema, the description still tells the agent the return shape: one row per reporter, includes descriptions, rows name the classification edition in classification_code, sorted by primary_value. Combined with the documented argument constraints and error semantics, an agent can call this correctly without further information.

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 0%, so the description actually carries the full burden and does so well for all four params: commodity code levels (TOTAL/chapter/heading/subheading), period formats (annual vs monthly), the four flow codes, and cl_code editions. The baseline-3 rule for high-coverage schemas does not technically apply here, but the description supplies concrete valid values, so it clearly compensates; still, 'H6 is valid but untested/HTTP 500' and the untested service classifications could confuse value selection, keeping it from the top.

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 names a specific verb+resource+scope: trade with the World (partner 0), all reporters, one product, one period, sorted largest first. This is instantly distinguishable from siblings like comtrade_get_bilateral_data or comtrade_get_top_partners, which involve non-World partners or subsets of reporters.

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 strong supporting-tool routing: list_commodities("HS", search=...) for finding codes and get_data_availability for learning who has reported. It also implicitly delimits scope as 'every reporter, World only.' It never names an explicit alternative (e.g. use get_top_partners for a ranked subset) or says when NOT to use it, so it stops short of 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.