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

NameTypeRequiredDescription
reporter_codestringyesISO numeric country code for the reporting country (e.g., “842” for US, “156” for China)
partner_codestringyesISO numeric country code for the partner country (e.g., “156” for China, “0” for World)
yearstringyesTrade year (e.g., “2024”)
hs_codestringnoHS commodity code at 2/4/6 digit level (e.g., “8471” for computers). Optional — omit for all commodities.
flowstringnoTrade 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

FieldTypeDescription
countnumberNumber of trade records returned
yearstringTrade year queried
recordsarrayArray 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.

Regenerated from source · build May 9, 2026