Comtrade Top Partners
comtrade_top_partnersRank the partner COUNTRIES a country trades with, largest value first: "which countries does the US import the most electrical machinery from", "who supplies Japan with crude oil", "Germany's biggest export markets for cars", "Brazil's top soybean buyers", "the US's top trading partners". Pass hs_code (an HS chapter or heading, e.g. "85" electrical machinery and electronics, "84" machinery, "27" mineral fuels and oil, "30" pharmaceuticals, "87" vehicles, "8542" integrated circuits) to rank the partners for ONE product; omit it to rank them on all goods. flow "M" ranks the countries the reporter imports from (its suppliers), "X" the countries it exports to (its markets). Returns each partner country with its UN code and trade value in USD. Defaults to ANNUAL; pass frequency="monthly" for a single month's ranking instead of the last full year's.
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": "X",
"year": "2024",
"limit": 10,
"reporter_code": "842"
},
"name": "comtrade_top_partners"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hs | No | Alias for hs_code, HS commodity code. Use this OR hs_code, not both. | |
| flow | Yes | Trade flow: "M" for imports, "X" for exports | |
| 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 partners to return (default 20) | |
| hs_code | No | Optional HS commodity code to filter by specific product (e.g. "2603" for copper ores), omit for all commodities (TOTAL). Aliases accepted: commodity_code, commodity, hs, cmd_code (pass exactly one). | |
| cmd_code | No | Alias for hs_code, HS commodity code. Use this OR hs_code, not both. | |
| commodity | No | Alias for hs_code, HS commodity code. Use this OR hs_code, not both. | |
| frequency | No | Data frequency: "annual" (default) or "monthly". Monthly coverage is thinner, not every reporter files monthly, and recent months lag; a reporter with no filing for the requested month is absent from the ranking, not shown at zero. When "monthly", pass `year` as YYYYMM. | |
| reporter_code | Yes | Country name (e.g. "USA", "China") or UN numeric code (842=US). Names resolved automatically. | |
| commodity_code | No | Alias for hs_code, HS commodity code (e.g. "2603" for copper ores). Use this OR hs_code, not both. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flow | Yes | Trade flow type (Imports or Exports) | |
| year | Yes | Trade year queried | |
| reporter | Yes | Reporting country name | |
| top_partners | Yes | ||
| total_partners | Yes | Total number of top partners returned |