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

NameTypeRequiredDescription
reporter_codestringyesISO numeric country code (e.g., “842” for US)
yearstringyesTrade year (e.g., “2024”)
flowstringyesTrade flow: “M” for imports, “X” for exports
hs_codestringnoOptional HS commodity code to filter by specific product
limitnumbernoNumber 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

FieldTypeDescription
reporterstringReporting country name
yearstringTrade year queried
flowstringTrade flow type (Imports or Exports)
total_partnersnumberTotal number of top partners returned
top_partnersarrayList 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.

Regenerated from source · build May 9, 2026