Skip to main content
Glama

un-comtrade-mcp-server

Get Trade Flow Records

comtrade_get_trade_flows
Read-only

Fetch bilateral trade flow records — the primary data retrieval tool. Returns trade value in USD (primaryValue — FOB for exports, CIF for imports), quantity, net weight, and period/commodity/partner metadata for each row. Accepts multiple periods and commodity codes per call; pass partner_code 0 to get totals aggregated across all partners. Omit cmd_code or pass "TOTAL" to aggregate all commodities. Preview makes one paced request per served period, with a 500-record cap per request. Use comtrade_lookup_countries to resolve reporter/partner codes and comtrade_search_commodities to resolve HS codes. For SITC, supply codes from the selected SITC revision.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
freqNoFrequency: A=annual, M=monthly.A
periodYesOne or more periods to query. Annual: "YYYY" (e.g. ["2022", "2023"]). Monthly: "YYYYMM" (e.g. ["202201", "202202"]). Serves the first 12 periods and discloses the remainder; input ceiling 120.
cmd_codeNoHS or SITC commodity codes to query. Serves the first 20 codes and discloses the remainder; input ceiling 200. Pass ["TOTAL"] or omit to aggregate all commodities. Use comtrade_search_commodities for HS codes only.
flow_codeYesTrade flow direction: M=imports, X=exports, RX=re-exports, RM=re-imports.
partner_codeNoM49 code of the trade partner. Use 0 to aggregate across all partners (World total). Omit to get a disaggregated breakdown by partner country.
reporter_codeYesM49 numeric code of the reporting country. Use comtrade_lookup_countries to resolve names to codes.
classificationNoGoods classification: HS/H0–H6 or SITC S1–S4/SS. Defaults to combined HS.HS

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNoPresent when the call failed. Absent on success.
shownNoNumber of records returned in this response.
noticeNoRecovery hint when no records are returned. Absent on successful responses.
recordsNoTrade flow records.
truncatedNoTrue when any preview response reached 500 and may be incomplete.
totalCountNoSum of upstream response counts before local filtering; not a full match count when capped.
truncationHintNoQuery narrowing and authenticated access guidance when possibly incomplete.
referenceNoticeNoNotice when reference descriptions could not be loaded; codes and trade values remain available.
unservedPeriodsNoPeriods beyond the 12-period work cap; query them separately.
unservedCmdCodesNoCommodity codes beyond the 20-code work cap; query them separately.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.