comtrade_top_partners
Pack: comtrade · Endpoint: https://gateway.pipeworx.io/comtrade/mcp
Find a country’s top trading partners ranked by trade volume. Returns partner countries and total trade values.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
reporter_code | string | yes | ISO numeric country code (e.g., “842” for US) |
year | string | yes | Trade year (e.g., “2024”) |
flow | string | yes | Trade flow: “M” for imports, “X” for exports |
hs_code | string | no | Optional HS commodity code to filter by specific product |
limit | number | no | Number of top partners to return (default 20) |
Example call
Arguments
{
"reporter_code": "840",
"year": "2024",
"flow": "X",
"limit": 10
}
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_partners","arguments":{"reporter_code":"840","year":"2024","flow":"X","limit":10}}}'
TypeScript (@pipeworx/sdk)
import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();
const result = await pipeworx.call('comtrade_top_partners', {
"reporter_code": "840",
"year": "2024",
"flow": "X",
"limit": 10
});
More examples
{
"reporter_code": "156",
"year": "2023",
"flow": "M"
}
Response shape
Always returns: reporter, year, flow, total_partners, top_partners
| Field | Type | Description |
|---|---|---|
reporter | string | Reporting country name |
year | string | Trade year queried |
flow | string | Trade flow type (Imports or Exports) |
total_partners | number | Total number of top partners returned |
top_partners | array | List of top trading partners ranked by trade value |
Full JSON Schema
{
"type": "object",
"properties": {
"reporter": {
"type": "string",
"description": "Reporting country name"
},
"year": {
"type": "string",
"description": "Trade year queried"
},
"flow": {
"type": "string",
"description": "Trade flow type (Imports or Exports)"
},
"total_partners": {
"type": "number",
"description": "Total number of top partners returned"
},
"top_partners": {
"type": "array",
"description": "List of top trading partners ranked by trade value",
"items": {
"type": "object",
"properties": {
"rank": {
"type": "number",
"description": "Partner rank by trade value"
},
"partner": {
"type": "string",
"description": "Partner country name"
},
"partner_code": {
"type": "number",
"description": "ISO numeric country code"
},
"trade_value_usd": {
"type": "number",
"description": "Trade value with this partner in USD"
},
"commodity": {
"type": "string",
"description": "Commodity code or description"
}
}
}
}
},
"required": [
"reporter",
"year",
"flow",
"total_partners",
"top_partners"
]
}
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.