comtrade_top_commodities
Pack: comtrade · Endpoint: https://gateway.pipeworx.io/comtrade/mcp
Find top commodities traded between two countries ranked by value. Returns product categories and trade volumes.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
reporter_code | string | yes | ISO numeric country code for the reporting country |
partner_code | string | yes | ISO numeric country code for the partner country |
year | string | yes | Trade year (e.g., “2024”) |
flow | string | yes | Trade flow: “M” for imports, “X” for exports |
limit | number | no | Number of top commodities to return (default 20) |
Example call
Arguments
{
"reporter_code": "840",
"partner_code": "156",
"year": "2024",
"flow": "M",
"limit": 15
}
curl
curl -X POST https://gateway.pipeworx.io/comtrade/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"comtrade_top_commodities","arguments":{"reporter_code":"840","partner_code":"156","year":"2024","flow":"M","limit":15}}}'
TypeScript (@pipeworx/sdk)
import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();
const result = await pipeworx.call('comtrade_top_commodities', {
"reporter_code": "840",
"partner_code": "156",
"year": "2024",
"flow": "M",
"limit": 15
});
More examples
{
"reporter_code": "392",
"partner_code": "840",
"year": "2023",
"flow": "X"
}
Response shape
Always returns: reporter, partner, year, flow, total_commodities, top_commodities
| Field | Type | Description |
|---|---|---|
reporter | string | Reporting country name |
partner | string | Partner country name |
year | string | Trade year queried |
flow | string | Trade flow type (Imports or Exports) |
total_commodities | number | Total number of top commodities returned |
top_commodities | array | List of top traded commodities ranked by value |
Full JSON Schema
{
"type": "object",
"properties": {
"reporter": {
"type": "string",
"description": "Reporting country name"
},
"partner": {
"type": "string",
"description": "Partner country name"
},
"year": {
"type": "string",
"description": "Trade year queried"
},
"flow": {
"type": "string",
"description": "Trade flow type (Imports or Exports)"
},
"total_commodities": {
"type": "number",
"description": "Total number of top commodities returned"
},
"top_commodities": {
"type": "array",
"description": "List of top traded commodities ranked by value",
"items": {
"type": "object",
"properties": {
"rank": {
"type": "number",
"description": "Commodity rank by trade value"
},
"hs_code": {
"type": "string",
"description": "HS commodity code"
},
"commodity": {
"type": "string",
"description": "Commodity description"
},
"trade_value_usd": {
"type": "number",
"description": "Trade value for this commodity in USD"
},
"net_weight_kg": {
"type": "number",
"description": "Net weight in kilograms"
}
}
}
}
},
"required": [
"reporter",
"partner",
"year",
"flow",
"total_commodities",
"top_commodities"
]
}
Connect
Add this to your MCP client config, or use one-click install buttons:
{
"mcpServers": {
"comtrade": {
"url": "https://gateway.pipeworx.io/comtrade/mcp"
}
}
}
See Getting Started for client-specific install steps.