comtrade_trade_data
Pack: comtrade · Endpoint: https://gateway.pipeworx.io/comtrade/mcp
Get bilateral trade data between two countries (e.g., “840” for US, “156” for China). Returns trade values, quantities, and commodity details for imports and exports.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
reporter_code | string | yes | ISO numeric country code for the reporting country (e.g., “842” for US, “156” for China) |
partner_code | string | yes | ISO numeric country code for the partner country (e.g., “156” for China, “0” for World) |
year | string | yes | Trade year (e.g., “2024”) |
hs_code | string | no | HS commodity code at 2/4/6 digit level (e.g., “8471” for computers). Optional — omit for all commodities. |
flow | string | no | Trade flow: “M” for imports, “X” for exports. Optional — defaults to both “M,X”. |
Example call
Arguments
{
"reporter_code": "840",
"partner_code": "156",
"year": "2024"
}
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_trade_data","arguments":{"reporter_code":"840","partner_code":"156","year":"2024"}}}'
TypeScript (@pipeworx/sdk)
import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();
const result = await pipeworx.call('comtrade_trade_data', {
"reporter_code": "840",
"partner_code": "156",
"year": "2024"
});
More examples
{
"reporter_code": "840",
"partner_code": "156",
"year": "2023",
"hs_code": "8471",
"flow": "M"
}
Response shape
Always returns: count, year, records
| Field | Type | Description |
|---|---|---|
count | number | Number of trade records returned |
year | string | Trade year queried |
records | array | Array of bilateral trade records |
Full JSON Schema
{
"type": "object",
"properties": {
"count": {
"type": "number",
"description": "Number of trade records returned"
},
"year": {
"type": "string",
"description": "Trade year queried"
},
"records": {
"type": "array",
"description": "Array of bilateral trade records",
"items": {
"type": "object",
"properties": {
"reporter": {
"type": "string",
"description": "Reporting country name"
},
"partner": {
"type": "string",
"description": "Partner country name"
},
"flow": {
"type": "string",
"description": "Trade flow type (Imports, Exports, Re-exports, Re-imports)"
},
"commodity_code": {
"type": "string",
"description": "HS commodity code"
},
"commodity": {
"type": "string",
"description": "Commodity description"
},
"trade_value_usd": {
"type": "number",
"description": "Trade value in USD"
},
"net_weight_kg": {
"type": "number",
"description": "Net weight in kilograms"
},
"quantity": {
"type": "number",
"description": "Quantity traded"
},
"quantity_unit": {
"type": "string",
"description": "Unit of quantity measurement"
}
}
}
}
},
"required": [
"count",
"year",
"records"
]
}
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.