Skip to main content
Glama

un-comtrade-mcp-server

Get Services Trade Data

comtrade_get_services_trade
Read-only

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.

Input Schema

NameRequiredDescriptionDefault
periodYesAnnual periods YYYY. Serves the first 12 and discloses the remainder; input ceiling 120. Preview makes one paced request per period.
flow_codeYesTrade flow: M=imports (debits), X=exports (credits).
partner_codeNoM49 partner code. Use 0 for all partners combined. Omit for a disaggregated by-partner breakdown.
service_codeNoEB 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_codeYesM49 numeric code of the reporting country (0–999).

Output Schema

NameRequiredDescriptionDefault
errorNoPresent when the call failed. Absent on success.
shownNoNumber of records returned.
noticeNoRecovery hint when no records are returned.
recordsNoServices trade 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.
referenceNoticeNoReference descriptions unavailable; codes and values retained.
unservedPeriodsNoPeriods beyond the 12-period work cap; query them separately.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed18 schema fields changed
    • changedInput schema / properties / flow_code / description
      Previous value: -"Trade flow: M=imports (credit received by reporter), X=exports (debit paid)."New value: +"Trade flow: M=imports (debits), X=exports (credits)."
    • removedInput schema / properties / flow_code / enum
      Removed value: -[
      -  "M",
      -  "X"
      -]
    • changedInput schema / properties / partner_code / maximum
      Previous value: -9007199254740991New value: +999
    • changedInput schema / properties / partner_code / minimum
      Previous value: --9007199254740991New value: +0
    • changedInput schema / properties / period / description
      Previous 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."
    • removedInput schema / properties / period / items / minLength
      Removed value: -4
    • addedInput schema / properties / period / items / pattern
      Added value: +"^[0-9]{4}$"
    • changedInput schema / properties / reporter_code / description
      Previous value: -"M49 numeric code of the reporting country."New value: +"M49 numeric code of the reporting country (0–999)."
    • changedInput schema / properties / reporter_code / maximum
      Previous value: -9007199254740991New value: +999
    • changedInput schema / properties / reporter_code / minimum
      Previous value: --9007199254740991New value: +0
    • changedInput schema / properties / service_code / description
      Previous 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."
    • addedInput schema / properties / service_code / pattern
      Added value: +"^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$"
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous 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."
    • addedOutput schema / properties / error / properties / data / properties / reason / examples
      Added value: +[
      +  "invalid_reporter_filter",
      +  "upstream_validation",
      +  "invalid_upstream_response"
      +]
    • addedOutput schema / properties / records / items / properties / classificationCode
      Added value: +{
      +  "description": "Actual services classification edition on the returned row.",
      +  "type": "string"
      +}
    • changedOutput schema / properties / records / items / properties / flowCode / description
      Previous value: -"Trade flow: M=import (credit received), X=export (debit paid)."New value: +"Trade flow: M=imports (debits), X=exports (credits)."
    • changedOutput schema / properties / records / items / properties / period / description
      Previous value: -"Period (YYYY or YYYYMM)."New value: +"Annual period YYYY."
    • addedOutput schema / properties / referenceNotice
      Added value: +{
      +  "description": "Reference descriptions unavailable; codes and values retained.",
      +  "type": "string"
      +}
  2. First observed

TDQS

A3.9/5.0
Behavior3/5

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.

Conciseness4/5

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.

Completeness4/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.