comtrade_get_world_trade
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
| Name | Required | Description | Default |
|---|---|---|---|
| flow | Yes | ||
| period | Yes | ||
| cl_code | No | HS | |
| commodity | Yes |