un-comtrade-mcp-server
Server Details
UN Comtrade international trade statistics via MCP. Country/HS lookups, flows, balances, rankings.
- Status
- Healthy
- Uptime
- 99.8% over 22 days
- Last Tested
- Transport
- Streamable HTTP · MCP 2025-11-25
- URL
- Repository
- cyanheads/un-comtrade-mcp-server
- GitHub Stars
- 4
- Server Listing
- @cyanheads/un-comtrade-mcp-server
- ChatGPT
- –
- Claude
- –
TDQS
Scored across 9 tools
Each tool has a distinct role: flows are the raw retrieval, top_commodities/top_partners are ranking helpers, balance is a derived metric, and services trade is a separate domain. The only mild overlap is between get_trade_flows and get_trade_balance (which could be computed from flows) and between the two 'top' tools, but descriptions make the boundaries clear.
All nine tools use the same comtrade_ prefix followed by a verb_noun pattern (get_data_availability, list_service_categories, lookup_countries, search_commodities). Verb choices are consistent with intent—get for data, list/search/lookup for reference resolution.
Nine tools is well within the ideal range and each earns its place: two reference lookups plus one service catalog, an availability pre-check, a core flows retriever, and three convenience analytics. Nothing appears redundant or padding.
The surface covers the full workflow: resolve codes, check availability, fetch flows/services, and derive rankings and balances. Minor gaps remain—no reporter/partner enumeration tool, no metadata endpoint for classification editions or units, and services ranking is absent—but agents can work around these with the lookup tools.
Available Tools
9 toolscomtrade_get_data_availabilityCheck Data AvailabilityARead-onlyInspect
Check which reporter/period/classification combinations have published data before constructing expensive trade queries. Returns dataset records with period, classification, record count, and first/latest release dates. Call this before querying recent periods — annual data is typically published 3–12 months after the reference year and not all countries report every year. Omit filters to browse the availability index, 50 rows by default. Continue with nextOffset using the same filters and limit.
| Name | Required | Description | Default |
|---|---|---|---|
| freq | No | Frequency: A=annual YYYY, M=monthly YYYYMM (01–12). | A |
| limit | No | Maximum datasets returned per page; defaults to 50. | |
| offset | No | Number of matching datasets to skip; use nextOffset to continue. | |
| period | No | Period to check: YYYY (annual) or YYYYMM (monthly). Omit to see all available periods for the reporter. | |
| type_code | No | Trade type: C=commodities (goods), S=services. | C |
| reporter_code | No | M49 reporter code to check. Omit to browse availability across all reporters. | |
| classification | No | Classification code filter (e.g. "HS", "H6", "EB10"). Omitted or blank defaults to HS for goods and EB10 for services. |
Output Schema
| Name | Required | Description |
|---|---|---|
| error | No | Present when the call failed. Absent on success. |
| shown | No | Number of datasets returned on this page. |
| notice | No | Recovery hint when no availability records are found. |
| offset | No | Number of matching datasets skipped for this page. |
| datasets | No | Available datasets matching the query. |
| truncated | No | Whether this page contains only part of the matching dataset list. |
| nextOffset | No | Offset for the next page; absent when no rows remain. |
| totalDatasets | No | Total number of available dataset records. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint and openWorldHint, so the safety profile is covered. The description adds real behavioral context beyond them: publication-lag characteristics and pagination semantics ('Continue with nextOffset using the same filters and limit'). The list of returned fields is partly redundant with the existing output schema, which keeps this from a 5.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Four dense sentences, front-loaded with the purpose, then the return shape, then the timing rationale, then pagination. No filler or restatement of the name.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-required-parameter index browser with an output schema and read-only annotations, the description covers purpose, motivation, default page size, and continuation procedure. An agent has everything needed to call it correctly and to chain pages.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so freq, period, reporter_code, classification, limit and offset are already documented, including the 'omit to browse' behavior. The description only restates omission and pagination at a high level, adding little syntax or meaning beyond the schema; baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource: 'Check which reporter/period/classification combinations have published data'. The framing as a pre-flight index check clearly separates it from the sibling query tools (comtrade_get_trade_flows, comtrade_get_top_partners, etc.).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives explicit when-to-use guidance ('Call this before querying recent periods') plus the underlying reason (annual data published 3–12 months after reference year, not all countries report every year), and an alternative mode ('Omit filters to browse the availability index'). Nothing is left to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
comtrade_get_services_tradeGet Services Trade DataARead-onlyInspect
Fetch annual international trade-in-services data through the combined EB classification; each row identifies its actual classification edition. Same bilateral structure as goods trade: returns flow value in USD, period, and reporter/partner/category metadata for each row. Use comtrade_list_service_categories to find the right service code before querying. Preview makes one paced request per served period, capped at 500 records per request. Services coverage is more limited than goods trade.
| Name | Required | Description | Default |
|---|---|---|---|
| period | Yes | Annual periods YYYY. Serves the first 12 and discloses the remainder; input ceiling 120. Preview makes one paced request per period. | |
| flow_code | Yes | Trade flow: M=imports (debits), X=exports (credits). | |
| partner_code | No | M49 partner code. Use 0 for all partners combined. Omit for a disaggregated by-partner breakdown. | |
| service_code | No | EB service category code (e.g. "SA" for manufacturing services or "3" for transport). Use comtrade_list_service_categories to find available codes. Omit to get totals across all service categories. | |
| reporter_code | Yes | M49 numeric code of the reporting country (0–999). |
Output Schema
| Name | Required | Description |
|---|---|---|
| error | No | Present when the call failed. Absent on success. |
| shown | No | Number of records returned. |
| notice | No | Recovery hint when no records are returned. |
| records | No | Services trade flow records. |
| truncated | No | True when any preview response reached 500 and may be incomplete. |
| totalCount | No | Sum of upstream response counts before local filtering; not a full match count when capped. |
| truncationHint | No | Query narrowing and authenticated access guidance when possibly incomplete. |
| referenceNotice | No | Reference descriptions unavailable; codes and values retained. |
| unservedPeriods | No | Periods beyond the 12-period work cap; query them separately. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=true, so the safety profile is covered. The description adds real value with the preview behavior: one paced request per served period, 500-record cap per request. It says less about pagination beyond the cap, error behavior, or how 'disclosed remainder' periods are handled.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with the core action and classification detail, then the category-lookup routing, then a workload warning. Nearly every sentence earns its place, though listing the returned fields (flow value in USD, period, reporter/partner/category metadata) is largely redundant when an output schema exists.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given annotations, a full-coverage schema, and an output schema, the description covers the main agent-relevant extras: classification editions, category lookup prerequisite, per-period request pacing and 500-record cap, and limited services coverage. It leaves only minor gaps such as behavior when a reporter lacks services data.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so every parameter is already documented in the schema. The description reinforces the service_code lookup workflow and the per-period request cost but adds no syntax or edge-case meaning beyond the schema. Baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('Fetch annual international trade-in-services data') plus the classification scheme (combined EB) and the fact that each row carries its actual edition. It also implicitly contrasts with the goods trade tool by noting the 'same bilateral structure as goods trade,' so an agent can tell it apart from comtrade_get_trade_flows.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives a concrete prerequisite: use comtrade_list_service_categories to resolve the service code before querying. It also warns that services coverage is narrower than goods, which sets expectations. It stops short of saying when to prefer this over the general goods flow tool or what to do when a reporter has no services data.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
comtrade_get_top_commoditiesGet Top Trade CommoditiesARead-onlyInspect
Rank HS chapters (2-digit) or headings (4-digit) by trade value for one reporter, flow, and annual or monthly period. Retrieves matching TOTAL and the reporter’s HS edition, then queries explicit commodity codes in chunks; capped chunks are subdivided. Shares use matching TOTAL. Incomplete coverage returns available categories without ranks or shares and identifies unresolved codes. Defaults to World; optionally select one bilateral partner. Counterpart to comtrade_get_top_partners.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of top commodity categories to return; above 50 returns all retrieved categories. | |
| period | Yes | Single period: annual (YYYY) or monthly (YYYYMM, month 01–12). | |
| flow_code | Yes | Trade flow: M=imports, X=exports. | |
| aggr_level | No | HS aggregation level: 2 = chapter (broader), 4 = heading (more specific). | |
| partner_code | No | M49 partner code for a bilateral relationship; omit for World aggregate (0). | |
| reporter_code | Yes | M49 numeric code of the reporting country. |
Output Schema
| Name | Required | Description |
|---|---|---|
| error | No | Present when the call failed. Absent on success. |
| notice | No | Recovery hint when no data is returned. |
| period | No | Period queried. |
| flowCode | No | Flow direction queried. |
| aggrLevel | No | HS aggregation level used. |
| truncated | No | True when complete commodity-code coverage could not be established. |
| commodities | No | Top commodity categories sorted by descending trade value. |
| missingCodes | No | Codes whose retrieval failed or remained capped; empty when the code universe is unavailable. |
| reporterCode | No | M49 reporter code. |
| reporterDesc | No | Reporter country name. |
| totalValueUsd | No | Sum of primary values across all returned categories (before limit). |
| coverageNotice | No | Explanation of coverage and ranking availability. |
| coverageComplete | No | Whether every code in the matching HS edition was queried without a capped response. |
| totalCommodities | No | Total commodity categories returned by API. |
| classificationCode | No | HS edition identified by matching TOTAL. |
| denominatorValueUsd | No | Matching TOTAL value used as the share denominator, separate from the retrieved-category sum. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the readOnlyHint and openWorldHint annotations, the description discloses meaningful internals: matching TOTAL retrieval, chunked code queries, subdivision of capped chunks, and shares computed from the matching TOTAL. It also discloses degraded behavior (unranked categories and unresolved codes on incomplete coverage). Minor gap: no indication of failure or rate-limit behavior for the multi-chunk fan-out.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The primary action is front-loaded in sentence one and each subsequent sentence adds distinct operational detail. It is dense to the point of being terse in the middle clauses, but no sentence is redundant filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 6 parameters, partial-coverage risk, and chunked retrieval, the description covers inputs, ranking semantics, and partial-result behavior; the output schema carries return shape, so nothing essential is missing. An agent can call it correctly and interpret degraded responses from the description alone.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3; the description adds value by clarifying that reporter, flow, and period define a single ranking context and that omitting the bilateral reporter selects World. The limit/truncation interaction with chunking is also implied by the coverage caveat, though the exact threshold lives only in the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The first sentence states a specific verb (rank), resource (HS chapters/headings), and scope (one reporter, flow, and annual or monthly period). Naming comtrade_get_top_partners as the counterpart lets an agent separate this tool from its closest sibling without opening either schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage context is clear: default to World unless a single bilateral partner is supplied, and the counterpart pointer implicitly routes partner-level ranking to comtrade_get_top_partners. It stops short of explicit when-not guidance against the other siblings such as comtrade_search_commodities, so it is not a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
comtrade_get_top_partnersGet Top Trading PartnersARead-onlyInspect
Rank trading partners for a reporter by trade value for a given commodity and flow direction. Returns the top N partners sorted by descending value — answers "who does country X mainly export product Y to?" or "where does country X mainly import product Z from?" for a single period. Fetches a disaggregated breakdown across all partners then sorts locally. Omit cmd_code to rank partners for total trade.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of top partners to return; above 50 returns all retrieved partners. | |
| period | Yes | Single period: annual YYYY or monthly YYYYMM, month 01–12; frequency is inferred. | |
| cmd_code | No | Single HS commodity code (e.g. "84", "8471"). Omit or pass "TOTAL" to rank partners for total merchandise trade. | |
| flow_code | Yes | Trade flow: M=imports, X=exports. | |
| reporter_code | Yes | M49 numeric code of the reporting country (0–999). |
Output Schema
| Name | Required | Description |
|---|---|---|
| error | No | Present when the call failed. Absent on success. |
| notice | No | Recovery hint when no data is returned. |
| period | No | Period queried. |
| cmdCode | No | Commodity code queried (TOTAL when omitted). |
| flowCode | No | Flow direction queried. |
| partners | No | Top partners sorted by descending trade value. |
| truncated | No | True when API returned 500 records and results may be incomplete. |
| reporterCode | No | M49 reporter code. |
| reporterDesc | No | Reporter country name. |
| totalPartners | No | Total partners with non-zero trade value returned by API. |
| totalValueUsd | No | Sum of primary values across all returned partners (before limit truncation). |
| referenceNotice | No | Reference descriptions unavailable; codes and values retained. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint and openWorldHint, so the safety profile is covered. The description adds genuinely useful behavior beyond them: it fetches a disaggregated breakdown across all partners and sorts locally, which warns about data volume and implies the limit is applied client-side. It stops short of stating rate limits or what happens when no partners exist.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three sentences, front-loaded with the action and purpose, then the concrete question framing, then the execution note. No filler and nothing important buried.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists so return values need no explanation, and all five parameters are schema-documented at full coverage. The only meaningful gap is that it does not clarify how ties or missing partner data are handled, which for a ranking tool is a minor omission.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so both the limit and cmd_code semantics ('Omit or pass TOTAL') are already fully documented in the schema. The description's 'top N' and 'Omit cmd_code' remarks largely restate that, adding little meaning beyond structured fields. Baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb (rank) and resource (trading partners) with the scoping dimensions (reporter, commodity, flow), and the two quoted example questions make the output shape unambiguous. It is clearly distinguished from sibling comtrade_get_top_commodities, which does the inverse ranking.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage context is clear: single-period ranking, and 'Omit cmd_code to rank partners for total trade' gives a concrete decision rule. However, no sibling is named as an alternative, so an agent comparing this against comtrade_get_trade_flows or comtrade_get_top_commodities must infer the routing itself.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
comtrade_get_trade_balanceGet Trade BalanceARead-onlyInspect
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.
| Name | Required | Description | Default |
|---|---|---|---|
| freq | No | Frequency: A=annual YYYY, M=monthly YYYYMM (01–12). | A |
| period | Yes | Annual periods (YYYY) or monthly periods (YYYYMM). Serves the first 12 and discloses the remainder; input ceiling 120. | |
| cmd_code | No | HS 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. | |
| partner_code | No | M49 partner code (0–999); defaults to World (0). The balance uses the reporter’s values. | |
| reporter_code | Yes | M49 numeric code of the reporting country (0–999). | |
| classification | No | Goods classification: HS/H0–H6 or SITC S1–S4/SS. | HS |
Output Schema
| Name | Required | Description |
|---|---|---|
| error | No | Present when the call failed. Absent on success. |
| notice | No | Possible incompleteness of the balance when a preview response reaches its cap. |
| periods | No | Balance computation per period. |
| cmdCodes | No | Commodity codes used in the query (absent when querying all commodities). |
| partnerCode | No | M49 partner code used. |
| partnerDesc | No | Partner name supplied by the returned records, or its numeric code when unavailable. |
| mirrorCaveat | No | Standard caveat about mirror asymmetry — balance reflects this country's reported values. |
| reporterCode | No | M49 reporter code used. |
| reporterDesc | No | Reporter country name. |
| referenceNotice | No | Reference descriptions unavailable; codes and trade values retained. |
| unservedPeriods | No | Periods beyond the 12-period work cap; query them separately. |
| unservedCmdCodes | No | Commodity codes beyond the 20-code work cap; query them separately. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Goes well beyond the readOnlyHint/openWorldHint annotations by disclosing the request cost model ('preview makes two paced requests per served period; authenticated calls batch periods') and the truncation behavior for periods and commodity codes. It also flags the mirror-asymmetry caveat that the balance reflects only the reporter's own values, which is a substantive data-quality warning an agent could not infer from structured fields.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with the computation and formula, then progressively adds cost model, return shape, and caveat. It is dense with four long sentences but nearly every clause carries operational value; the enumerated return fields are the only part that mildly duplicates the output schema.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given a six-parameter tool with a full input schema, an output schema, and safety annotations, the description covers the remaining gaps: request cost, batching, truncation, return composition, and the mirror-asymmetry interpretation risk. Nothing an agent needs to call or interpret the result correctly is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so every parameter is already documented with defaults and formats. The description adds only a light gloss on the commodity filter and reporter-code resolution, which is the expected baseline when the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('Compute the trade balance for a country over one or more periods') and defines the metric inline ('total exports minus total imports'), which distinguishes it from the raw-flow sibling comtrade_get_trade_flows. The optional commodity filter scope is also named.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Implies the correct usage context via the commodity-filter option and explicitly points to comtrade_lookup_countries for resolving reporter codes. It does not explicitly state when to prefer this over comtrade_get_trade_flows or comtrade_get_top_partners, so the routing guidance is inferred rather than stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
comtrade_get_trade_flowsGet Trade Flow RecordsARead-onlyInspect
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.
| Name | Required | Description | Default |
|---|---|---|---|
| freq | No | Frequency: A=annual YYYY, M=monthly YYYYMM (01–12). | A |
| period | Yes | One 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_code | No | HS 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 codes in the selected HS or SITC edition. | |
| flow_code | Yes | Trade flow direction: M=imports, X=exports, RX=re-exports, RM=re-imports. | |
| partner_code | No | M49 code of the trade partner. Use 0 to aggregate across all partners (World total). Omit to get a disaggregated breakdown by partner country. | |
| reporter_code | No | M49 reporter code or nonempty array (input ceiling 200). Deduplicates and serves the first 20 reporters, disclosing the remainder. Omit only with an explicit partner_code to query all reporters. | |
| classification | No | Goods classification: HS as reported, H0–H6 with authenticated access, or SITC S1–S4/SS. | HS |
Output Schema
| Name | Required | Description |
|---|---|---|
| error | No | Present when the call failed. Absent on success. |
| shown | No | Number of records returned in this response. |
| notice | No | Recovery hint when no records are returned. Absent on successful responses. |
| records | No | Trade flow records. |
| truncated | No | True when any preview response reached 500 and may be incomplete. |
| totalCount | No | Sum of upstream response counts before local filtering; not a full match count when capped. |
| truncationHint | No | Query narrowing and authenticated access guidance when possibly incomplete. |
| referenceNotice | No | Notice when reference descriptions could not be loaded; codes and trade values remain available. |
| unservedPeriods | No | Periods beyond the 12-period work cap; query them separately. |
| unservedCmdCodes | No | Commodity codes beyond the 20-code work cap; query them separately. |
| unservedReporters | No | Reporter codes beyond the 20-reporter work cap; query them separately. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint and openWorldHint, yet the description adds substantive behavior: return fields and their valuation basis (FOB for exports, CIF for imports), the paced one-request-per-period pattern in Preview mode, and a 500-record cap per request. The truncation behavior (first 12 periods, first 20 codes, first 20 reporters with the remainder disclosed) is also surfaced rather than left buried in the schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with purpose and return shape before moving into calling conventions and helper tools, and each sentence carries information. There is minor redundancy, such as restating that multiple periods and commodity codes can be accepted per call, which the array schema already conveys.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 7-parameter, open-world retrieval tool with an output schema, this is close to complete: it covers aggregation semantics, code resolution, classification caveats, and request pacing limits. The remaining gap is the unexplained 'Preview' mode and the cap/truncation interplay across parameters, which an agent may still misjudge in combination.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so a baseline of 3 applies, but the description adds real meaning on top: the FOB/CIF interpretation of primaryValue, the World-total shortcut of partner_code 0, the disaggregated default when partner_code is omitted, and the TOTAL/omit convention for cmd_code. It does not clarify the freq defaults or the 'Preview' notion that has no corresponding schema parameter, which keeps it short of a 5.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The first sentence names a specific verb and resource (fetch bilateral trade flow records) and frames it as the primary data retrieval tool, which pairs well with the read-only annotations. It does not explicitly contrast itself with the closest siblings that could be confused with it (comtrade_get_services_trade, comtrade_get_top_commodities), so the agent must infer that this tool covers goods flows rather than services or rankings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It gives concrete operational guidance: pass partner_code 0 to aggregate across all partners, omit cmd_code or pass TOTAL to aggregate commodities, and use comtrade_lookup_countries and comtrade_search_commodities to resolve codes before calling. It also notes the SITC revision dependency. What's missing is an explicit when-not clause or a direct pointer to the services/rankings siblings for those use cases.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
comtrade_list_service_categoriesList Service Trade Categories (EB)ARead-onlyInspect
List service trade categories from the combined EB catalog, including numeric EBOPS and SDMX codes. Returns category codes, descriptions, and parent codes. Filter by keyword (e.g. "transport", "financial", "travel") or browse direct children of a parent code. Use the returned id as service_code in comtrade_get_services_trade. Code 3 is transport; SA is manufacturing services.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of categories to return; above 500 returns all matching categories. | |
| query | No | Keyword or category code prefix to filter results. Examples: "transport", "SA", "financial services". Omit to list all EB categories. | |
| parent_code | No | Return direct children of this EB category code. Example: "3" for transport sub-categories, or "3.1" for sea transport sub-categories. |
Output Schema
| Name | Required | Description |
|---|---|---|
| error | No | Present when the call failed. Absent on success. |
| shown | No | Number of categories returned. |
| notice | No | Recovery hint when no results found or results are truncated. |
| truncated | No | True when categories were capped at the limit (totalMatches exceeds shown). |
| categories | No | EB service categories matching the query. |
| totalMatches | No | Total matching categories before limit truncation. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The readOnlyHint/openWorldHint annotations already establish a safe, local read, so the description only needs to add context — which it does by disclosing the catalog's provenance (combined EB), the returned fields (codes, descriptions, parent codes), and domain anchors like "Code 3 is transport; SA is manufacturing services." It does not discuss exhaustiveness or whether the catalog is static, a minor remaining gap for a lookup tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The definition is front-loaded with purpose, then filtering behavior, then the downstream handoff — a sensible order with no filler sentences. A small amount of space is spent repeating limit/query behavior already covered by the schema.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a three-optional-parameter, read-only catalog tool with a 100%-covered schema and an output schema, this is nearly complete: usage modes, downstream linkage, and code semantics are all present. Return-value explanation is slightly redundant given the output schema, and catalog exhaustiveness remains unstated.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so limit, query, and parent_code are already fully documented; the description's filter/browse sentences largely restate those schema descriptions. The one piece of genuinely added meaning is the mapping of a returned id to the service_code parameter of comtrade_get_services_trade, which the schema cannot express.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
"List service trade categories from the combined EB catalog" gives a specific verb and resource, and the mention of numeric EBOPS and SDMX codes plus keyword/parent filtering separates it cleanly from siblings like comtrade_search_commodities and comtrade_lookup_countries.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It states the two usage modes (keyword filter vs. browsing direct children of a parent code) and explicitly routes the agent onward: "Use the returned id as service_code in comtrade_get_services_trade." It stops short of an explicit exclusion naming comtrade_search_commodities as the alternative for commodity lookups.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
comtrade_lookup_countriesLookup Countries / AreasARead-onlyInspect
Resolve country and area names to Comtrade M49 numeric codes used in all data queries. Accepts a partial name, full name, or ISO alpha-2/alpha-3 code (e.g. "United States", "USA", "US"). Returns matching entries with their numeric code, ISO identifiers, and a validAsReporter flag — regional groupings like "World" (code 0) are valid partners but not valid reporters. Use this before any trade data tool that requires reporter_code or partner_code. To aggregate across all partners, use partner code 0 (World) — no lookup needed.
| Name | Required | Description | Default |
|---|---|---|---|
| role | No | Filter by role: "reporter" returns only codes valid for the reporterCode parameter, "partner" returns only partner areas (includes regional groupings), "any" returns all matches regardless of role. | any |
| query | Yes | Country or area name fragment, full name, or ISO alpha-2/alpha-3 code to search for. Case-insensitive. Examples: "Germany", "DEU", "DE", "united states", "china". | |
| include_groups | No | Whether to include regional and economic groupings (e.g. EU, ASEAN). Set to false to return only individual countries. |
Output Schema
| Name | Required | Description |
|---|---|---|
| error | No | Present when the call failed. Absent on success. |
| notice | No | Recovery hint when no matches are found — echoes the query and suggests alternatives. Absent when results are non-empty. |
| matches | No | Matching entries ordered by exact ISO identity, reporter validity, then name. |
| totalMatches | No | Total number of matching entries. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=false, and an output schema exists, so the bar is lower. The description's genuinely additive piece is the domain semantics of validAsReporter — regional groupings such as 'World' (code 0) are valid partners but not valid reporters — which warns the agent off a plausible misuse; the rest largely restates the return payload and the schema's case-insensitivity.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Four short sentences, front-loaded with the core action and then the invocation prerequisite. Every sentence carries information an agent needs: input forms, return fields, the validAsReporter caveat, and the partner-0 shortcut.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple, the schema is fully documented, and an output schema covers return values, so the description only needed to add the sequencing rule and the reporter/partner distinction — it does both. Nothing required to call this correctly before a trade-data call is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, including an inline enum explanation for `role` and a documented default for `include_groups`, so the baseline is 3. The description reinforces input flexibility and adds the aggregation shortcut (partner code 0), but it does not explain how `role` and `include_groups` interact or what happens with an ambiguous partial name.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource: 'Resolve country and area names to Comtrade M49 numeric codes used in all data queries.' It also names the accepted input forms and the returned fields, so an agent can distinguish this pure-lookup tool from every sibling data-retrieval tool without opening a schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly routes usage: 'Use this before any trade data tool that requires reporter_code or partner_code,' and gives an exclusion — aggregation across all partners needs no lookup, just partner code 0. Both the when and the when-not are stated.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
comtrade_search_commoditiesSearch Commodity CodesARead-onlyInspect
Find HS or SITC commodity codes by keyword, partial description, or code prefix in the selected classification. Returns descriptions, native aggregation levels, parents, leaf status, and recommendedQueryCode for subsequent trade queries. HS uses levels 2 (chapter), 4 (heading), and 6 (subheading); SITC uses levels 1–5. Select the edition matching the trade records when interpreting historical codes.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of results to return; above 200 returns all matching codes. | |
| query | Yes | Keyword, partial description, or commodity code prefix. Examples: "motor vehicles", "8471", "coffee", "84" (HS chapter 84 = machinery). | |
| aggr_level | No | Native aggregation level: HS uses 2 (chapter), 4 (heading), 6 (subheading); SITC uses 1–5. Omit to return all matching levels. | |
| classification | No | Goods reference catalog: HS uses the default HS.json discovery catalog, whose total identifies H6; it is not an authoritative historical-edition reference. Select H0–H6 for an explicit HS edition, or SS/S1–S4 for SITC. | HS |
Output Schema
| Name | Required | Description |
|---|---|---|
| error | No | Present when the call failed. Absent on success. |
| shown | No | Number of codes returned in this response. |
| notice | No | Recovery hint when no matches are found or results are truncated. Absent when results are non-empty and not truncated. |
| matches | No | Commodity codes matching the query in the selected classification. |
| truncated | No | True when matches were capped at the limit (totalMatches exceeds shown). |
| totalMatches | No | Total matching codes (before limit truncation). |
| classification | No | Reference catalog used for the search. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint=true and openWorldHint=false, so safety is covered. The description adds genuinely new context: the caveat that the default HS catalog is a discovery catalog rather than an authoritative historical-edition reference, and the hierarchy/leaf-status semantics that shape interpretation of results.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three tight sentences with the core capability front-loaded and the caveat placed last where it belongs. Some content (the HS 2/4/6 and SITC 1–5 level mapping) duplicates the schema verbatim and could be trimmed.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With an output schema present and full parameter documentation, the description need not explain return values, and it correctly focuses on classification-edition semantics. It could go one step further by stating the explicit handoff to comtrade_get_trade_flows using recommendedQueryCode, but nothing essential for correct invocation is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all four parameters, including the aggr_level level mapping and the classification enum caveats. The description restates the level scheme and adds only the edition-matching heuristic, so it adds marginal meaning beyond structured fields.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ("Find HS or SITC commodity codes") plus the three search modes (keyword, partial description, code prefix) and the scoping constraint ("in the selected classification"). This is clearly distinguishable from siblings like comtrade_lookup_countries or comtrade_get_top_commodities.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Implies the workflow position by noting it returns "recommendedQueryCode for subsequent trade queries," and gives edition-selection guidance ("Select the edition matching the trade records when interpreting historical codes"). It stops short of explicit when-not guidance or naming a specific sibling as an alternative.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
9 tool updates
- Changed
comtrade_get_data_availability16 fields changed- added
Input schema / properties / classification / allOfAdded value: +[ + { + "pattern": "^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$" + }, + { + "pattern": "^(?:[A-Z][A-Z0-9]*)?$" + } +] - changed
Input schema / properties / freq / descriptionPrevious value: -"Frequency: A=annual, M=monthly."New value: +"Frequency: A=annual YYYY, M=monthly YYYYMM (01–12)." - removed
Input schema / properties / freq / enumRemoved value: -[ - "A", - "M" -] - added
Input schema / properties / limitAdded value: +{ + "default": 50, + "description": "Maximum datasets returned per page; defaults to 50.", + "exclusiveMinimum": 0, + "maximum": 9007199254740991, + "type": "integer" +} - added
Input schema / properties / offsetAdded value: +{ + "default": 0, + "description": "Number of matching datasets to skip; use nextOffset to continue.", + "maximum": 9007199254740991, + "minimum": 0, + "type": "integer" +} - added
Input schema / properties / period / patternAdded value: +"^[0-9]{4}(?:0[1-9]|1[0-2])?$" - changed
Input schema / properties / reporter_code / maximumPrevious value: -9007199254740991New value: +999 - changed
Input schema / properties / reporter_code / minimumPrevious value: --9007199254740991New value: +0 - removed
Input schema / properties / type_code / enumRemoved value: -[ - "C", - "S" -] - changed
Output schema / anyOfPrevious value: -[ - { - "not": { - "required": [ - "error" - ] - }, - "required": [ - "datasets", - "totalDatasets" - ] - }, - { - "required": [ - "error" - ] - } -]New value: +[ + { + "not": { + "required": [ + "error" + ] + }, + "required": [ + "datasets", + "totalDatasets", + "truncated", + "offset", + "shown" + ] + }, + { + "required": [ + "error" + ] + } +] - changed
Output schema / properties / error / properties / data / properties / reason / descriptionPrevious value: -"Machine-readable failure mode."New value: +"Machine-readable failure mode. Declared by this tool: `upstream_validation`: UN Comtrade rejects the availability query dimensions. `invalid_upstream_response`: UN Comtrade returns malformed availability data. Other values are possible when a failure originates below the handler." - added
Output schema / properties / error / properties / data / properties / reason / examplesAdded value: +[ + "upstream_validation", + "invalid_upstream_response" +] - added
Output schema / properties / nextOffsetAdded value: +{ + "description": "Offset for the next page; absent when no rows remain.", + "type": "number" +} - added
Output schema / properties / offsetAdded value: +{ + "description": "Number of matching datasets skipped for this page.", + "type": "number" +} - added
Output schema / properties / shownAdded value: +{ + "description": "Number of datasets returned on this page.", + "type": "number" +} - added
Output schema / properties / truncatedAdded value: +{ + "description": "Whether this page contains only part of the matching dataset list.", + "type": "boolean" +}
- Changed
comtrade_get_services_trade18 fields changed- changed
Input schema / properties / flow_code / descriptionPrevious value: -"Trade flow: M=imports (credit received by reporter), X=exports (debit paid)."New value: +"Trade flow: M=imports (debits), X=exports (credits)." - removed
Input schema / properties / flow_code / enumRemoved value: -[ - "M", - "X" -] - changed
Input schema / properties / partner_code / maximumPrevious value: -9007199254740991New value: +999 - changed
Input schema / properties / partner_code / minimumPrevious value: --9007199254740991New value: +0 - changed
Input schema / properties / period / descriptionPrevious value: -"Periods (YYYY or YYYYMM). Serves the first 12 and discloses the remainder; input ceiling 120. Preview makes one paced request per period."New value: +"Annual periods YYYY. Serves the first 12 and discloses the remainder; input ceiling 120. Preview makes one paced request per period." - removed
Input schema / properties / period / items / minLengthRemoved value: -4 - added
Input schema / properties / period / items / patternAdded value: +"^[0-9]{4}$" - changed
Input schema / properties / reporter_code / descriptionPrevious value: -"M49 numeric code of the reporting country."New value: +"M49 numeric code of the reporting country (0–999)." - changed
Input schema / properties / reporter_code / maximumPrevious value: -9007199254740991New value: +999 - changed
Input schema / properties / reporter_code / minimumPrevious value: --9007199254740991New value: +0 - changed
Input schema / properties / service_code / descriptionPrevious value: -"EBOPS 2010 service category code (e.g. \"SA\" for transport). Use comtrade_list_service_categories to find available codes. Omit to get totals across all service categories."New value: +"EB service category code (e.g. \"SA\" for manufacturing services or \"3\" for transport). Use comtrade_list_service_categories to find available codes. Omit to get totals across all service categories." - added
Input schema / properties / service_code / patternAdded value: +"^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$" - changed
Output schema / properties / error / properties / data / properties / reason / descriptionPrevious value: -"Machine-readable failure mode."New value: +"Machine-readable failure mode. Declared by this tool: `invalid_reporter_filter`: Reporter omission lacks an explicit partner. `upstream_validation`: UN Comtrade rejects the query dimensions. `invalid_upstream_response`: UN Comtrade returns malformed services data. Other values are possible when a failure originates below the handler." - added
Output schema / properties / error / properties / data / properties / reason / examplesAdded value: +[ + "invalid_reporter_filter", + "upstream_validation", + "invalid_upstream_response" +] - added
Output schema / properties / records / items / properties / classificationCodeAdded value: +{ + "description": "Actual services classification edition on the returned row.", + "type": "string" +} - changed
Output schema / properties / records / items / properties / flowCode / descriptionPrevious value: -"Trade flow: M=import (credit received), X=export (debit paid)."New value: +"Trade flow: M=imports (debits), X=exports (credits)." - changed
Output schema / properties / records / items / properties / period / descriptionPrevious value: -"Period (YYYY or YYYYMM)."New value: +"Annual period YYYY." - added
Output schema / properties / referenceNoticeAdded value: +{ + "description": "Reference descriptions unavailable; codes and values retained.", + "type": "string" +}
- Changed
comtrade_get_top_commodities17 fields changed- removed
Input schema / properties / flow_code / enumRemoved value: -[ - "M", - "X" -] - changed
Input schema / properties / partner_code / descriptionPrevious value: -"M49 partner code to filter to a specific bilateral relationship. Omit to rank commodities across all partners."New value: +"M49 partner code for a bilateral relationship; omit for World aggregate (0)." - changed
Input schema / properties / period / descriptionPrevious value: -"Single period: annual (YYYY) or monthly (YYYYMM)."New value: +"Single period: annual (YYYY) or monthly (YYYYMM, month 01–12)." - removed
Input schema / properties / period / minLengthRemoved value: -4 - added
Input schema / properties / period / patternAdded value: +"^[0-9]{4}(?:0[1-9]|1[0-2])?$" - changed
Output schema / anyOfPrevious value: -[ - { - "not": { - "required": [ - "error" - ] - }, - "required": [ - "commodities", - "reporterCode", - "reporterDesc", - "period", - "flowCode", - "aggrLevel", - "totalCommodities", - "truncated" - ] - }, - { - "required": [ - "error" - ] - } -]New value: +[ + { + "not": { + "required": [ + "error" + ] + }, + "required": [ + "commodities", + "reporterCode", + "reporterDesc", + "period", + "flowCode", + "aggrLevel", + "totalCommodities", + "truncated", + "coverageComplete", + "coverageNotice", + "missingCodes" + ] + }, + { + "required": [ + "error" + ] + } +] - added
Output schema / properties / classificationCodeAdded value: +{ + "description": "HS edition identified by matching TOTAL.", + "type": "string" +} - changed
Output schema / properties / commodities / items / properties / rank / descriptionPrevious value: -"Rank (1 = largest trade value)."New value: +"Rank (1 = largest trade value), only with complete code coverage and known values." - changed
Output schema / properties / commodities / items / properties / sharePercent / descriptionPrevious value: -"Share of total trade value among returned commodities, as a percentage."New value: +"Share of matching TOTAL trade value, only with complete code coverage." - changed
Output schema / properties / commodities / items / requiredPrevious value: -[ - "rank", - "cmdCode", - "cmdDesc", - "aggrLevel" -]New value: +[ + "cmdCode", + "cmdDesc", + "aggrLevel" +] - added
Output schema / properties / coverageCompleteAdded value: +{ + "description": "Whether every code in the matching HS edition was queried without a capped response.", + "type": "boolean" +} - added
Output schema / properties / coverageNoticeAdded value: +{ + "description": "Explanation of coverage and ranking availability.", + "type": "string" +} - added
Output schema / properties / denominatorValueUsdAdded value: +{ + "description": "Matching TOTAL value used as the share denominator, separate from the retrieved-category sum.", + "type": "number" +} - changed
Output schema / properties / error / properties / data / properties / reason / descriptionPrevious value: -"Machine-readable failure mode."New value: +"Machine-readable failure mode. Declared by this tool: `keyless_hs_edition_unsupported`: An explicit HS edition requires authenticated access. `upstream_validation`: UN Comtrade rejects the supplied query dimensions. `invalid_upstream_response`: UN Comtrade returns a malformed response. `invalid_reporter_filter`: The query omits required reporter filtering. Other values are possible when a failure originates below the handler." - added
Output schema / properties / error / properties / data / properties / reason / examplesAdded value: +[ + "keyless_hs_edition_unsupported", + "upstream_validation", + "invalid_upstream_response", + "invalid_reporter_filter" +] - added
Output schema / properties / missingCodesAdded value: +{ + "description": "Codes whose retrieval failed or remained capped; empty when the code universe is unavailable.", + "items": { + "type": "string" + }, + "type": "array" +} - changed
Output schema / properties / truncated / descriptionPrevious value: -"True when API returned 500 records and results may be incomplete."New value: +"True when complete commodity-code coverage could not be established."
- Changed
comtrade_get_top_partners11 fields changed- added
Input schema / properties / cmd_code / patternAdded value: +"^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$" - removed
Input schema / properties / flow_code / enumRemoved value: -[ - "M", - "X" -] - changed
Input schema / properties / period / descriptionPrevious value: -"Single period: annual (YYYY) or monthly (YYYYMM)."New value: +"Single period: annual YYYY or monthly YYYYMM, month 01–12; frequency is inferred." - removed
Input schema / properties / period / minLengthRemoved value: -4 - added
Input schema / properties / period / patternAdded value: +"^[0-9]{4}(?:0[1-9]|1[0-2])?$" - changed
Input schema / properties / reporter_code / descriptionPrevious value: -"M49 numeric code of the reporting country."New value: +"M49 numeric code of the reporting country (0–999)." - changed
Input schema / properties / reporter_code / maximumPrevious value: -9007199254740991New value: +999 - changed
Input schema / properties / reporter_code / minimumPrevious value: --9007199254740991New value: +0 - changed
Output schema / properties / error / properties / data / properties / reason / descriptionPrevious value: -"Machine-readable failure mode."New value: +"Machine-readable failure mode. Declared by this tool: `invalid_reporter_filter`: Reporter omission lacks an explicit partner. `upstream_validation`: UN Comtrade rejects the query dimensions. `invalid_upstream_response`: UN Comtrade returns malformed trade data. Other values are possible when a failure originates below the handler." - added
Output schema / properties / error / properties / data / properties / reason / examplesAdded value: +[ + "invalid_reporter_filter", + "upstream_validation", + "invalid_upstream_response" +] - added
Output schema / properties / referenceNoticeAdded value: +{ + "description": "Reference descriptions unavailable; codes and values retained.", + "type": "string" +}
- Changed
comtrade_get_trade_balance15 fields changed- removed
Input schema / properties / classification / enumRemoved value: -[ - "HS", - "H0", - "H1", - "H2", - "H3", - "H4", - "H5", - "H6", - "S1", - "S2", - "S3", - "S4", - "SS" -] - added
Input schema / properties / cmd_code / items / patternAdded value: +"^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$" - changed
Input schema / properties / freq / descriptionPrevious value: -"Frequency: A=annual, M=monthly."New value: +"Frequency: A=annual YYYY, M=monthly YYYYMM (01–12)." - removed
Input schema / properties / freq / enumRemoved value: -[ - "A", - "M" -] - added
Input schema / properties / partner_codeAdded value: +{ + "default": 0, + "description": "M49 partner code (0–999); defaults to World (0). The balance uses the reporter’s values.", + "maximum": 999, + "minimum": 0, + "type": "integer" +} - removed
Input schema / properties / period / items / minLengthRemoved value: -4 - added
Input schema / properties / period / items / patternAdded value: +"^[0-9]{4}(?:0[1-9]|1[0-2])?$" - changed
Input schema / properties / reporter_code / descriptionPrevious value: -"M49 numeric code of the reporting country."New value: +"M49 numeric code of the reporting country (0–999)." - changed
Input schema / properties / reporter_code / maximumPrevious value: -9007199254740991New value: +999 - changed
Input schema / properties / reporter_code / minimumPrevious value: --9007199254740991New value: +0 - changed
Output schema / anyOfPrevious value: -[ - { - "not": { - "required": [ - "error" - ] - }, - "required": [ - "periods", - "reporterCode", - "reporterDesc", - "mirrorCaveat" - ] - }, - { - "required": [ - "error" - ] - } -]New value: +[ + { + "not": { + "required": [ + "error" + ] + }, + "required": [ + "periods", + "reporterCode", + "reporterDesc", + "partnerCode", + "partnerDesc", + "mirrorCaveat" + ] + }, + { + "required": [ + "error" + ] + } +] - changed
Output schema / properties / error / properties / data / properties / reason / descriptionPrevious value: -"Machine-readable failure mode. Declared by this tool: `no_data`: No trade data available for the reporter and period combination. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `keyless_hs_edition_unsupported`: Explicit HS editions require authenticated data access. `invalid_reporter_filter`: Reporter omission lacks an explicit partner. `upstream_validation`: UN Comtrade rejects the query dimensions. `invalid_upstream_response`: UN Comtrade returns malformed trade data. `no_data`: No trade data available for the reporter and period combination. Other values are possible when a failure originates below the handler." - changed
Output schema / properties / error / properties / data / properties / reason / examplesPrevious value: -[ - "no_data" -]New value: +[ + "keyless_hs_edition_unsupported", + "invalid_reporter_filter", + "upstream_validation", + "invalid_upstream_response", + "no_data" +] - added
Output schema / properties / partnerCodeAdded value: +{ + "description": "M49 partner code used.", + "type": "number" +} - added
Output schema / properties / partnerDescAdded value: +{ + "description": "Partner name supplied by the returned records, or its numeric code when unavailable.", + "type": "string" +}
- Changed
comtrade_get_trade_flows28 fields changed- changed
Input schema / properties / classification / descriptionPrevious value: -"Goods classification: HS/H0–H6 or SITC S1–S4/SS. Defaults to combined HS."New value: +"Goods classification: HS as reported, H0–H6 with authenticated access, or SITC S1–S4/SS." - removed
Input schema / properties / classification / enumRemoved value: -[ - "HS", - "H0", - "H1", - "H2", - "H3", - "H4", - "H5", - "H6", - "S1", - "S2", - "S3", - "S4", - "SS" -] - changed
Input schema / properties / cmd_code / descriptionPrevious value: -"HS 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."New value: +"HS 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 codes in the selected HS or SITC edition." - added
Input schema / properties / cmd_code / items / patternAdded value: +"^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$" - removed
Input schema / properties / flow_code / enumRemoved value: -[ - "M", - "X", - "RX", - "RM" -] - changed
Input schema / properties / freq / descriptionPrevious value: -"Frequency: A=annual, M=monthly."New value: +"Frequency: A=annual YYYY, M=monthly YYYYMM (01–12)." - removed
Input schema / properties / freq / enumRemoved value: -[ - "A", - "M" -] - changed
Input schema / properties / partner_code / maximumPrevious value: -9007199254740991New value: +999 - changed
Input schema / properties / partner_code / minimumPrevious value: --9007199254740991New value: +0 - removed
Input schema / properties / period / items / minLengthRemoved value: -4 - added
Input schema / properties / period / items / patternAdded value: +"^[0-9]{4}(?:0[1-9]|1[0-2])?$" - added
Input schema / properties / reporter_code / anyOfAdded value: +[ + { + "description": "One M49 reporter code.", + "maximum": 999, + "minimum": 0, + "type": "integer" + }, + { + "description": "Reporter codes to query together.", + "items": { + "maximum": 999, + "minimum": 0, + "type": "integer" + }, + "maxItems": 200, + "minItems": 1, + "type": "array" + } +] - changed
Input schema / properties / reporter_code / descriptionPrevious value: -"M49 numeric code of the reporting country. Use comtrade_lookup_countries to resolve names to codes."New value: +"M49 reporter code or nonempty array (input ceiling 200). Deduplicates and serves the first 20 reporters, disclosing the remainder. Omit only with an explicit partner_code to query all reporters." - removed
Input schema / properties / reporter_code / maximumRemoved value: -9007199254740991 - removed
Input schema / properties / reporter_code / minimumRemoved value: --9007199254740991 - removed
Input schema / properties / reporter_code / typeRemoved value: -"integer" - changed
Input schema / requiredPrevious value: -[ - "reporter_code", - "flow_code", - "period" -]New value: +[ + "flow_code", + "period" +] - changed
Output schema / properties / error / properties / data / properties / reason / descriptionPrevious value: -"Machine-readable failure mode."New value: +"Machine-readable failure mode. Declared by this tool: `keyless_hs_edition_unsupported`: Explicit HS editions require authenticated data access. `invalid_reporter_filter`: Reporter omission lacks an explicit partner. `upstream_validation`: UN Comtrade rejects the query dimensions. `invalid_upstream_response`: UN Comtrade returns malformed trade data. Other values are possible when a failure originates below the handler." - added
Output schema / properties / error / properties / data / properties / reason / examplesAdded value: +[ + "keyless_hs_edition_unsupported", + "invalid_reporter_filter", + "upstream_validation", + "invalid_upstream_response" +] - added
Output schema / properties / records / items / properties / altQtyAdded value: +{ + "description": "Alternate quantity, in its own unit.", + "type": "number" +} - added
Output schema / properties / records / items / properties / altQtyUnitAbbrAdded value: +{ + "description": "Alternate quantity unit abbreviation.", + "type": "string" +} - added
Output schema / properties / records / items / properties / altQtyUnitCodeAdded value: +{ + "description": "Alternate quantity unit code.", + "type": "number" +} - added
Output schema / properties / records / items / properties / classificationCodeAdded value: +{ + "description": "Actual classification edition supplied by the row.", + "type": "string" +} - added
Output schema / properties / records / items / properties / isNetWgtEstimatedAdded value: +{ + "description": "Whether net weight is estimated.", + "type": "boolean" +} - added
Output schema / properties / records / items / properties / isQtyEstimatedAdded value: +{ + "description": "Whether quantity is estimated.", + "type": "boolean" +} - added
Output schema / properties / records / items / properties / qtyUnitAbbrAdded value: +{ + "description": "Quantity unit abbreviation supplied or resolved from the unit catalog.", + "type": "string" +} - added
Output schema / properties / records / items / properties / qtyUnitCodeAdded value: +{ + "description": "Quantity unit code; -1 means unavailable.", + "type": "number" +} - added
Output schema / properties / unservedReportersAdded value: +{ + "description": "Reporter codes beyond the 20-reporter work cap; query them separately.", + "items": { + "type": "number" + }, + "type": "array" +}
- Changed
comtrade_list_service_categories4 fields changed- changed
Input schema / properties / parent_code / descriptionPrevious value: -"Return only sub-categories of this parent EBOPS code. Example: \"SA\" to see all transport service sub-categories."New value: +"Return direct children of this EB category code. Example: \"3\" for transport sub-categories, or \"3.1\" for sea transport sub-categories." - changed
Input schema / properties / query / descriptionPrevious value: -"Keyword or category code prefix to filter results. Examples: \"transport\", \"SA\", \"financial services\". Omit to list all EBOPS categories."New value: +"Keyword or category code prefix to filter results. Examples: \"transport\", \"SA\", \"financial services\". Omit to list all EB categories." - changed
Output schema / properties / categories / descriptionPrevious value: -"EBOPS 2010 service categories matching the query."New value: +"EB service categories matching the query." - changed
Output schema / properties / categories / items / descriptionPrevious value: -"An EBOPS 2010 service trade category."New value: +"A service trade category from the combined EB catalog."
- Changed
comtrade_lookup_countries1 field changed- changed
Output schema / properties / matches / descriptionPrevious value: -"Country/area entries matching the query, sorted by name."New value: +"Matching entries ordered by exact ISO identity, reporter validity, then name."
- Changed
comtrade_search_commodities15 fields changed- changed
Input schema / properties / aggr_level / anyOfPrevious value: -[ - { - "const": 2, - "type": "number" - }, - { - "const": 4, - "type": "number" - }, - { - "const": 6, - "type": "number" - } -]New value: +[ + { + "const": 1, + "type": "number" + }, + { + "const": 2, + "type": "number" + }, + { + "const": 3, + "type": "number" + }, + { + "const": 4, + "type": "number" + }, + { + "const": 5, + "type": "number" + }, + { + "const": 6, + "type": "number" + } +] - changed
Input schema / properties / aggr_level / descriptionPrevious value: -"Aggregation level: 2 = HS chapter (most general), 4 = heading, 6 = subheading (most specific). Omit to return all matching levels."New value: +"Native aggregation level: HS uses 2 (chapter), 4 (heading), 6 (subheading); SITC uses 1–5. Omit to return all matching levels." - changed
Input schema / properties / classification / descriptionPrevious value: -"HS classification version. \"HS\" covers the combined dataset across all editions (H0–H6). Use a specific edition (e.g. \"H6\") for version-specific lookups."New value: +"Goods reference catalog: HS uses the default HS.json discovery catalog, whose total identifies H6; it is not an authoritative historical-edition reference. Select H0–H6 for an explicit HS edition, or SS/S1–S4 for SITC." - changed
Input schema / properties / classification / enumPrevious value: -[ - "HS", - "H0", - "H1", - "H2", - "H3", - "H4", - "H5", - "H6" -]New value: +[ + "HS", + "H0", + "H1", + "H2", + "H3", + "H4", + "H5", + "H6", + "SS", + "S1", + "S2", + "S3", + "S4" +] - changed
Input schema / properties / query / descriptionPrevious value: -"Keyword, partial description, or HS code prefix to search for. Examples: \"motor vehicles\", \"8471\", \"coffee\", \"84\" (chapter 84 = machinery)."New value: +"Keyword, partial description, or commodity code prefix. Examples: \"motor vehicles\", \"8471\", \"coffee\", \"84\" (HS chapter 84 = machinery)." - changed
Output schema / anyOfPrevious value: -[ - { - "not": { - "required": [ - "error" - ] - }, - "required": [ - "matches", - "totalMatches", - "shown", - "truncated" - ] - }, - { - "required": [ - "error" - ] - } -]New value: +[ + { + "not": { + "required": [ + "error" + ] + }, + "required": [ + "classification", + "matches", + "totalMatches", + "shown", + "truncated" + ] + }, + { + "required": [ + "error" + ] + } +] - added
Output schema / properties / classificationAdded value: +{ + "description": "Reference catalog used for the search.", + "type": "string" +} - changed
Output schema / properties / error / properties / data / properties / reason / descriptionPrevious value: -"Machine-readable failure mode."New value: +"Machine-readable failure mode. Declared by this tool: `invalid_aggregation_level`: The requested level does not belong to the selected classification family. Other values are possible when a failure originates below the handler." - added
Output schema / properties / error / properties / data / properties / reason / examplesAdded value: +[ + "invalid_aggregation_level" +] - changed
Output schema / properties / matches / descriptionPrevious value: -"HS codes matching the query."New value: +"Commodity codes matching the query in the selected classification." - changed
Output schema / properties / matches / items / descriptionPrevious value: -"A single HS commodity code entry."New value: +"A commodity entry from the selected catalog." - changed
Output schema / properties / matches / items / properties / aggrLevel / descriptionPrevious value: -"Aggregation level: 2 (chapter), 4 (heading), 6 (subheading)."New value: +"Native aggregation level in the selected HS or SITC catalog." - changed
Output schema / properties / matches / items / properties / id / descriptionPrevious value: -"HS code string (e.g. \"84\", \"8471\", \"847130\")."New value: +"Commodity code in the selected classification, preserving leading zeros." - changed
Output schema / properties / matches / items / properties / parent / descriptionPrevious value: -"Parent HS code (chapter for headings; heading for subheadings)."New value: +"Parent commodity code in the selected classification." - changed
Output schema / properties / matches / items / properties / recommendedQueryCode / descriptionPrevious value: -"Best code to pass as cmd_code in trade data queries for this commodity. Uses the most specific level that returns meaningful data."New value: +"Code to pass as cmd_code with the same classification in trade data queries."
9 tool updates
- First observed
comtrade_get_data_availability - First observed
comtrade_get_services_trade - First observed
comtrade_get_top_commodities - First observed
comtrade_get_top_partners - First observed
comtrade_get_trade_balance - First observed
comtrade_get_trade_flows - First observed
comtrade_list_service_categories - First observed
comtrade_lookup_countries - First observed
comtrade_search_commodities
Related MCP Connectors
Comtrade MCP — UN Comtrade API for international bilateral trade data
Trade Intel MCP — Compound tools that chain Comtrade, Census, Treasury,
Brazil Comex Stat MCP — Brazilian foreign trade statistics from MDIC (Ministério do…
Japan export and import customs statistics (Ministry of Finance) by code. No API key required.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceProvides access to UN Comtrade international bilateral trade data via an MCP server, enabling AI agents to query trade statistics through natural language.424 npmMIT
- AlicenseAqualityDmaintenanceAn MCP server for the U.S. Census Bureau's International Trade Data API, enabling queries of monthly export and import statistics by HS, NAICS, end-use, and other classifications, with tools for trade balance, top partners, and country code lookup.7Creative Commons Zero v1.0 Universal
- AlicenseNot gradedqualityBmaintenanceRead-only MCP tools for querying USDA FAS Global Agricultural Trade System census export and import records by partner country, year, month and HS10 code prefix, plus the release-date lists for each flow. Results are capped with notes on omitted rows, and responses carry release vintages and retrieval metadata.227 PyPIApache 2.0
- AlicenseAqualityBmaintenanceEnables querying Brazilian foreign trade data through MCP tools for trade flows, freight costs, code resolution, and dataset caveats, with known data defects corrected in responses.4MIT
Glama MCP Gateway
Add one secure layer between your agents and this server.