Skip to main content
Glama

un-comtrade-mcp-server

Get Trade Balance

comtrade_get_trade_balance
Read-only

Compute the trade balance for a country over one or more periods — total exports minus total imports — with optional HS or SITC commodity filter. Preview makes two paced requests per served period; authenticated calls batch periods. Returns the signed balance (USD), export value, import value, and coverage ratio (exports / imports). Note: mirror asymmetry is common — balance reflects values as reported by this country; the same flow may be recorded differently by the partner. Uses comtrade_lookup_countries to resolve reporter codes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
freqNoFrequency: A=annual, M=monthly.A
periodYesAnnual periods (YYYY) or monthly periods (YYYYMM). Serves the first 12 and discloses the remainder; input ceiling 120.
cmd_codeNoHS or SITC commodity codes to restrict the balance calculation. Serves the first 20 and discloses the remainder; input ceiling 200. Omit to compute the overall trade balance across all commodities.
reporter_codeYesM49 numeric code of the reporting country.
classificationNoGoods classification: HS/H0–H6 or SITC S1–S4/SS.HS

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorNoPresent when the call failed. Absent on success.
noticeNoPossible incompleteness of the balance when a preview response reaches its cap.
periodsNoBalance computation per period.
cmdCodesNoCommodity codes used in the query (absent when querying all commodities).
mirrorCaveatNoStandard caveat about mirror asymmetry — balance reflects this country's reported values.
reporterCodeNoM49 reporter code used.
reporterDescNoReporter country name.
referenceNoticeNoReference descriptions unavailable; codes and trade values retained.
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.