Skip to main content
Glama

un-comtrade-mcp-server

Check Data Availability

comtrade_get_data_availability
Read-only

Check which reporter/period/classification combinations have published data before querying trade. Returns datasets ordered by reporter code, newest period first within each reporter, with classification, record count and release dates where available. Annual data is typically published 3–12 months after the reference year and some reporters skip years. Omit filters to browse the index, 50 rows by default. Continue with nextOffset using the same filters and limit.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "comtrade_get_data_availability"
  }
}

Input Schema

NameRequiredDescriptionDefault
freqNoFrequency: A=annual YYYY, M=monthly YYYYMM (01–12). Omit to infer it from period, or annual when period is omitted too; an explicit value must match period.
limitNoMaximum datasets returned per page; defaults to 50.
offsetNoNumber of matching datasets to skip; use nextOffset to continue.
periodNoPeriod to check: YYYY (annual) or YYYYMM (monthly). Omit to see all available periods for the reporter.
type_codeNoTrade type: C=commodities (goods), S=services.C
reporter_codeNoM49 reporter code to check. Omit to browse availability across all reporters.
classificationNoClassification code filter (e.g. "HS", "H6", "EB10"). Omitted or blank defaults to HS for goods and EB10 for services.

Output Schema

NameRequiredDescriptionDefault
errorNoPresent when the call failed. Absent on success.
shownNoNumber of datasets returned on this page.
noticeNoRecovery hint when no records match or the offset is past the end.
offsetNoNumber of matching datasets skipped for this page.
datasetsNoAvailable datasets matching the query.
truncatedNoWhether this page contains only part of the matching dataset list.
nextOffsetNoOffset for the next page; absent when no rows remain.
totalDatasetsNoTotal number of available dataset records.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • removedInput schema / properties / classification / allOf
      Removed value: -[
      -  {
      -    "pattern": "^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$"
      -  },
      -  {
      -    "pattern": "^(?:[A-Z][A-Z0-9]*)?$"
      -  }
      -]
    • addedInput schema / properties / classification / pattern
      Added value: +"^(?:[A-Z][A-Z0-9]*)?$"
    • changedOutput schema / properties / notice / description
      Previous value: -"Recovery hint when no availability records are found."New value: +"Recovery hint when no records match or the offset is past the end."
  2. Changed2 schema fields changed
    • removedInput schema / properties / freq / default
      Removed value: -"A"
    • changedInput schema / properties / freq / description
      Previous value: -"Frequency: A=annual YYYY, M=monthly YYYYMM (01–12)."New value: +"Frequency: A=annual YYYY, M=monthly YYYYMM (01–12). Omit to infer it from period, or annual when period is omitted too; an explicit value must match period."
  3. Changed16 schema fields changed
    • addedInput schema / properties / classification / allOf
      Added value: +[
      +  {
      +    "pattern": "^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$"
      +  },
      +  {
      +    "pattern": "^(?:[A-Z][A-Z0-9]*)?$"
      +  }
      +]
    • changedInput schema / properties / freq / description
      Previous value: -"Frequency: A=annual, M=monthly."New value: +"Frequency: A=annual YYYY, M=monthly YYYYMM (01–12)."
    • removedInput schema / properties / freq / enum
      Removed value: -[
      -  "A",
      -  "M"
      -]
    • addedInput schema / properties / limit
      Added value: +{
      +  "default": 50,
      +  "description": "Maximum datasets returned per page; defaults to 50.",
      +  "exclusiveMinimum": 0,
      +  "maximum": 9007199254740991,
      +  "type": "integer"
      +}
    • addedInput schema / properties / offset
      Added value: +{
      +  "default": 0,
      +  "description": "Number of matching datasets to skip; use nextOffset to continue.",
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedInput schema / properties / period / pattern
      Added value: +"^[0-9]{4}(?:0[1-9]|1[0-2])?$"
    • changedInput schema / properties / reporter_code / maximum
      Previous value: -9007199254740991New value: +999
    • changedInput schema / properties / reporter_code / minimum
      Previous value: --9007199254740991New value: +0
    • removedInput schema / properties / type_code / enum
      Removed value: -[
      -  "C",
      -  "S"
      -]
    • changedOutput schema / anyOf
      Previous value: -[
      -  {
      -    "not": {
      -      "required": [
      -        "error"
      -      ]
      -    },
      -    "required": [
      -      "datasets",
      -      "totalDatasets"
      -    ]
      -  },
      -  {
      -    "required": [
      -      "error"
      -    ]
      -  }
      -]New value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "datasets",
      +      "totalDatasets",
      +      "truncated",
      +      "offset",
      +      "shown"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • 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: `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."
    • addedOutput schema / properties / error / properties / data / properties / reason / examples
      Added value: +[
      +  "upstream_validation",
      +  "invalid_upstream_response"
      +]
    • addedOutput schema / properties / nextOffset
      Added value: +{
      +  "description": "Offset for the next page; absent when no rows remain.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / offset
      Added value: +{
      +  "description": "Number of matching datasets skipped for this page.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / shown
      Added value: +{
      +  "description": "Number of datasets returned on this page.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / truncated
      Added value: +{
      +  "description": "Whether this page contains only part of the matching dataset list.",
      +  "type": "boolean"
      +}
  4. First observed

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the readOnlyHint/openWorldHint annotations, it discloses result ordering (by reporter code, newest period first), the pagination contract ('Continue with nextOffset using the same filters and limit'), default page size, and real-world timing expectations including publication lag of 3–12 months and reporters that skip years. That is exactly the kind of operational context an agent needs to interpret sparse or empty results.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Five short sentences, front-loaded with purpose, then return shape, timing caveat, and pagination mechanics. No filler, and the pragmatic caveats come after the core statement so the agent can stop reading early if needed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so the description rightly skips return-value enumeration and instead covers what the schema cannot: ordering, publish lag, year gaps, and offset continuation. For a seven-parameter read-only discovery tool this is complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already explains each parameter, and the description's main additive value is the combination semantics — that omitting filters browses the whole index and that offset must be re-used with identical filters and limit. The default-50 detail largely repeats the schema default.

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?

The description opens with a specific verb and resource ('Check which reporter/period/classification combinations have published data') and explicitly positions the tool as a pre-flight step 'before querying trade', which distinguishes it from the data-fetching siblings such as 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?

It gives clear when-to-use context ('before querying trade') and an explicit browsing mode ('Omit filters to browse the index'), plus continuation guidance. It stops short of naming a specific alternative tool to call once availability is confirmed, so the routing guidance is inferential rather than explicit.

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.