census_trade_trends

Pack: census-trade · Endpoint: https://gateway.pipeworx.io/census-trade/mcp

Monthly US trade trends with ONE trading partner — month-by-month imports and exports for a country, optionally narrowed to an HS commodity, to show seasonality and shifts. A country is required: an unfiltered monthly query spans every partner and the Census API cannot return it in time. For all-countries totals use census_imports / census_exports instead.

Parameters

NameTypeRequiredDescription
hs_codestringnoHS commodity code. Optional — omit for aggregate trade.
countrystringnoCountry name in plain English (e.g., “Mexico”). Preferred — resolved for you. REQUIRED unless you pass country_code.
country_codestringnoCensus Schedule C country code (e.g. “5700” China, “2010” Mexico). NOT an ISO code. Prefer country. Satisfies the country requirement.
start_yearstringnoStart year (e.g., “2022”). Optional — defaults to the same year as end_year, i.e. a single year. Maximum span 3 years.
end_yearstringnoEnd year (e.g., “2024”). Optional — defaults to the last fully-published year (last calendar year; Census publishes on a lag).

Example call

Arguments

{
  "country": "China",
  "start_year": "2024",
  "end_year": "2024"
}

curl

curl -X POST https://gateway.pipeworx.io/census-trade/mcp \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"census_trade_trends","arguments":{"country":"China","start_year":"2024","end_year":"2024"}}}'

TypeScript (@pipeworx/sdk)

import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();

const result = await pipeworx.call('census_trade_trends', {
  "country": "China",
  "start_year": "2024",
  "end_year": "2024"
});

More examples

{
  "country": "China",
  "hs_code": "85",
  "start_year": "2025",
  "end_year": "2025"
}

Response shape

Always returns: start_year, end_year, hs_code, country, country_code, months, trends

FieldTypeDescription
start_yearstringStart year of trend range
end_yearstringEnd year of trend range
hs_codestringHS commodity code or ‘all’ for aggregate
countrystringResolved country name as Census reports it, or ‘all’ for all countries
country_codestringCensus country code or ‘all’ for all countries
monthsnumberNumber of monthly data points
trendsarray
Full JSON Schema
{
  "type": "object",
  "properties": {
    "start_year": {
      "type": "string",
      "description": "Start year of trend range"
    },
    "end_year": {
      "type": "string",
      "description": "End year of trend range"
    },
    "hs_code": {
      "type": "string",
      "description": "HS commodity code or 'all' for aggregate"
    },
    "country": {
      "type": "string",
      "description": "Resolved country name as Census reports it, or 'all' for all countries"
    },
    "country_code": {
      "type": "string",
      "description": "Census country code or 'all' for all countries"
    },
    "months": {
      "type": "number",
      "description": "Number of monthly data points"
    },
    "trends": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "period": {
            "type": "string",
            "description": "Month-year period"
          },
          "imports_usd": {
            "type": "number",
            "description": "Import value in USD for period"
          },
          "exports_usd": {
            "type": "number",
            "description": "Export value in USD for period"
          },
          "balance_usd": {
            "type": "number",
            "description": "Trade balance in USD for period"
          }
        },
        "required": [
          "period",
          "imports_usd",
          "exports_usd",
          "balance_usd"
        ]
      }
    }
  },
  "required": [
    "start_year",
    "end_year",
    "hs_code",
    "country",
    "country_code",
    "months",
    "trends"
  ]
}

Connect

Add this to your MCP client config, or use one-click install buttons:

{
  "mcpServers": {
    "census-trade": {
      "url": "https://gateway.pipeworx.io/census-trade/mcp"
    }
  }
}

See Getting Started for client-specific install steps.

Regenerated from source · build September 10, 2026