Comtrade Top Commodities
comtrade_top_commoditiesRank the products a country actually trades, largest value first, "what are Thailand's biggest exports", "what does Brazil import most", "what does the US import most from China". Works for any country as reporter (a name or UN code); the partner is optional and defaults to World (all trading partners), so a one-country question needs no second country. Returns HS categories with trade value and net weight. Defaults to HS 2-digit chapters (~97 categories, e.g. 85 Electrical machinery); pass hs_level 4 or 6 for finer product detail.
Example tool call
This call uses example arguments supplied in the tool’s input schema.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"flow": "M",
"year": "2024",
"limit": 15,
"partner_code": "156",
"reporter_code": "842"
},
"name": "comtrade_top_commodities"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flow | Yes | Trade flow, REQUIRED because it decides what the answer MEANS: "X" for exports (what a country SELLS / ships abroad) or "M" for imports (what it BUYS / receives). Deliberately not defaulted, guessing returns imports for an export question, which reads as a confident wrong answer instead of an error. | |
| year | Yes | Trade period. For frequency="annual" (default): a year, e.g. "2024". For frequency="monthly": year+month as YYYYMM, e.g. "202401". | |
| limit | No | Number of top commodities to return (default 20) | |
| hs_level | No | HS aggregation level: 2 for chapters (default, ~97 broad categories), 4 for headings, 6 for subheadings. Higher numbers give finer product detail and many more rows. | |
| frequency | No | Data frequency: "annual" (default) or "monthly". Monthly coverage is thinner, not every reporter files monthly, and recent months lag. When "monthly", pass `year` as YYYYMM. | |
| partner_code | No | Partner country name or UN code (0=World). Optional, defaults to World. Names resolved automatically. | |
| reporter_code | Yes | Country name (e.g. "USA", "China") or UN numeric code (842=US). Names resolved automatically. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flow | Yes | Trade flow type (Imports or Exports) | |
| year | Yes | Trade year queried | |
| partner | Yes | Partner country name | |
| reporter | Yes | Reporting country name | |
| top_commodities | Yes | ||
| total_commodities | Yes | Total number of top commodities returned |