Skip to main content
Glama

un-comtrade-mcp-server

Get Trade Flow Records

comtrade_get_trade_flows
Read-only

Fetch bilateral trade flow records — the primary data retrieval tool. Returns trade value in USD (primaryValue — FOB for exports, CIF for imports), quantity, net weight, and period/commodity/partner metadata for each row. Accepts multiple periods and commodity codes per call; pass partner_code 0 to get totals aggregated across all partners. Omit cmd_code or pass "TOTAL" to aggregate all commodities. Follow nextOffset for remaining records; each page repeats the upstream period requests. Keyless preview makes one request per served period, at least 4 seconds apart, 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.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "flow_code": "<flow_code>",
      "period": "<period>"
    },
    "name": "comtrade_get_trade_flows"
  }
}

Input Schema

NameRequiredDescriptionDefault
freqNoFrequency: A=annual YYYY, M=monthly YYYYMM (01–12). Omit to infer it from the periods; an explicit value must match them.
limitNoRecords per page (default 25). Larger requests are limited to 1000 with a notice.
offsetNoNumber of retrieved records to skip.
periodYesOne or more periods to query, all annual "YYYY" (e.g. ["2022", "2023"]) or all monthly "YYYYMM" (e.g. ["202201", "202202"]); mixed lengths are rejected. Serves the first 8 distinct periods keyless (12 with authenticated access); the rest, and any period whose request is rate limited, fails on a UN Comtrade server error or network failure, or runs out of time, are listed in unservedPeriods. Input ceiling 120.
cmd_codeNoHS or SITC commodity codes to query. Serves the first 20 distinct 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_codeYesTrade flow direction: M=imports, X=exports, RX=re-exports, RM=re-imports.
partner_codeNoM49 code of the trade partner. Use 0 to aggregate across all partners (World total). Omitting it can return World alongside the partner breakdown.
reporter_codeNoM49 reporter code or nonempty array (input ceiling 200). Deduplicates and serves the first 20 reporters, disclosing the remainder; served codes of an array that return no records are listed in reportersWithoutRecords. Some codes are partners only (0 World, 250 Metropolitan France, 158 Taiwan, Province of China): France reports as 251, and UN Comtrade publishes the trade of 158 under 490 (Other Asia, nes). Omit only with an explicit partner_code to query all reporters.
classificationNoGoods classification: HS as reported, H0–H6 with authenticated access, or SITC S1–S4/SS.HS

Output Schema

NameRequiredDescriptionDefault
errorNoPresent when the call failed. Absent on success.
shownNoNumber of records on this page.
noticeNoWorld overlap warnings, commodity edition guidance, period failures, and recovery for empty results, including counterpart codes for reporter or partner filters.
offsetNoNumber of retrieved records skipped for this page.
recordsNoTrade flow records.
truncatedNoTrue when any preview response reached 500 and may be incomplete.
limitClampNoRequested and applied page sizes when the limit was clamped.
nextOffsetNoOffset for the next page when more records remain.
totalCountNoSum of upstream response counts before local filtering; not a full match count when capped.
truncationHintNoQuery narrowing and authenticated access guidance when possibly incomplete.
referenceNoticeNoNotice when reference descriptions could not be loaded; codes and trade values remain available.
unservedPeriodsNoPeriods not served: past the period cap (8 keyless, 12 authenticated) or whose requests were rate limited, failed on a UN Comtrade server error or network failure, or ran out of time; query them separately.
unservedCmdCodesNoCommodity codes beyond the 20-code work cap; query them separately.
unservedReportersNoReporter codes beyond the 20-reporter work cap; query them separately.
cmdCodesWithoutRecordsNoServed commodity selectors without records in any completed period. Omitted when the result is truncated.
reportersWithoutRecordsNoServed codes from a reporter_code array with no records in any served period. Omitted when truncated, since a capped response can hide a reporter’s rows.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changed
    • addedInput schema / properties / limit
      Added value: +{
      +  "default": 25,
      +  "description": "Records per page (default 25). Larger requests are limited to 1000 with a notice.",
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / offset
      Added value: +{
      +  "default": 0,
      +  "description": "Number of retrieved records to skip.",
      +  "maximum": 9007199254740991,
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • changedOutput schema / anyOf
      Previous value: -[
      -  {
      -    "not": {
      -      "required": [
      -        "error"
      -      ]
      -    },
      -    "required": [
      -      "records",
      -      "totalCount",
      -      "shown",
      -      "truncated"
      -    ]
      -  },
      -  {
      -    "required": [
      -      "error"
      -    ]
      -  }
      -]New value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "records",
      +      "totalCount",
      +      "offset",
      +      "shown",
      +      "truncated"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / limitClamp
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Requested and applied page sizes when the limit was clamped.",
      +  "properties": {
      +    "applied": {
      +      "description": "Applied records per page.",
      +      "type": "number"
      +    },
      +    "requested": {
      +      "description": "Requested records per page.",
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "requested",
      +    "applied"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / nextOffset
      Added value: +{
      +  "description": "Offset for the next page when more records remain.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / offset
      Added value: +{
      +  "description": "Number of retrieved records skipped for this page.",
      +  "type": "number"
      +}
    • changedOutput schema / properties / records / items / properties / altQtyUnitCode / description
      Previous value: -"Alternate quantity unit code."New value: +"Alternate unit code; omitted when -1 and alternate quantity is absent."
    • changedOutput schema / properties / records / items / properties / qtyUnitCode / description
      Previous value: -"Quantity unit code; -1 means unavailable."New value: +"Quantity unit code; omitted when -1 and quantity is absent."
    • changedOutput schema / properties / shown / description
      Previous value: -"Number of records returned in this response."New value: +"Number of records on this page."
  2. Changed3 schema fields changed
    • changedInput schema / properties / partner_code / description
      Previous value: -"M49 code of the trade partner. Use 0 to aggregate across all partners (World total). Omit to get a disaggregated breakdown by partner country."New value: +"M49 code of the trade partner. Use 0 to aggregate across all partners (World total). Omitting it can return World alongside the partner breakdown."
    • addedOutput schema / properties / cmdCodesWithoutRecords
      Added value: +{
      +  "description": "Served commodity selectors without records in any completed period. Omitted when the result is truncated.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / notice / description
      Previous value: -"Why data is missing: periods that were rate limited (with the wait), failed on a UN Comtrade server error (with the HTTP status) or network failure, or ran out of time, and a recovery hint when no records are returned, naming the code to query instead of a partner-only reporter_code (250 → 251, 158 → 490) or of a partner_code with a reporter-valid counterpart (840 → 842, 158 → 490)."New value: +"World overlap warnings, commodity edition guidance, period failures, and recovery for empty results, including counterpart codes for reporter or partner filters."
  3. Changed8 schema fields changed
    • changedInput schema / properties / cmd_code / description
      Previous 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."New value: +"HS or SITC commodity codes to query. Serves the first 20 distinct 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."
    • changedInput schema / properties / period / description
      Previous value: -"One or more periods to query, all annual \"YYYY\" (e.g. [\"2022\", \"2023\"]) or all monthly \"YYYYMM\" (e.g. [\"202201\", \"202202\"]); mixed lengths are rejected. Serves the first 8 periods keyless (12 with authenticated access); the rest, and any period whose request is rate limited or runs out of time, are listed in unservedPeriods. Input ceiling 120."New value: +"One or more periods to query, all annual \"YYYY\" (e.g. [\"2022\", \"2023\"]) or all monthly \"YYYYMM\" (e.g. [\"202201\", \"202202\"]); mixed lengths are rejected. Serves the first 8 distinct periods keyless (12 with authenticated access); the rest, and any period whose request is rate limited, fails on a UN Comtrade server error or network failure, or runs out of time, are listed in unservedPeriods. Input ceiling 120."
    • changedInput schema / properties / reporter_code / description
      Previous value: -"M49 reporter code or nonempty array (input ceiling 200). Deduplicates and serves the first 20 reporters, disclosing the remainder; served codes of an array that return no records are listed in reportersWithoutRecords. Some codes are partners only (0 World, 250 Metropolitan France; France reports as 251). Omit only with an explicit partner_code to query all reporters."New value: +"M49 reporter code or nonempty array (input ceiling 200). Deduplicates and serves the first 20 reporters, disclosing the remainder; served codes of an array that return no records are listed in reportersWithoutRecords. Some codes are partners only (0 World, 250 Metropolitan France, 158 Taiwan, Province of China): France reports as 251, and UN Comtrade publishes the trade of 158 under 490 (Other Asia, nes). Omit only with an explicit partner_code to query all reporters."
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous 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. `rate_limited`: No served period completed and UN Comtrade rate-limited at least one through its retries. `deadline_exceeded`: No served period completed within the call's time budget. 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. `rate_limited`: No served period completed and UN Comtrade rate-limited at least one through its retries. `upstream_unavailable`: No requested period completed and at least one request failed on a UN Comtrade server error or network failure after retries. `deadline_exceeded`: No served period completed within the call's time budget. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "keyless_hs_edition_unsupported",
      -  "invalid_reporter_filter",
      -  "upstream_validation",
      -  "invalid_upstream_response",
      -  "rate_limited",
      -  "deadline_exceeded"
      -]New value: +[
      +  "keyless_hs_edition_unsupported",
      +  "invalid_reporter_filter",
      +  "upstream_validation",
      +  "invalid_upstream_response",
      +  "rate_limited",
      +  "upstream_unavailable",
      +  "deadline_exceeded"
      +]
    • changedOutput schema / properties / notice / description
      Previous value: -"Why data is missing: periods that were rate limited (with the wait) or ran out of time, and a recovery hint when no records are returned, naming the reporter-valid counterpart of a partner-only reporter_code."New value: +"Why data is missing: periods that were rate limited (with the wait), failed on a UN Comtrade server error (with the HTTP status) or network failure, or ran out of time, and a recovery hint when no records are returned, naming the code to query instead of a partner-only reporter_code (250 → 251, 158 → 490) or of a partner_code with a reporter-valid counterpart (840 → 842, 158 → 490)."
    • changedOutput schema / properties / reportersWithoutRecords / items / properties / suggestedReporterCode / description
      Previous value: -"Reporter-valid code sharing a partner_only code’s ISO-3 identity (250 → 251); query it instead."New value: +"Reporter-valid code to query instead of a partner_only code: the one sharing its ISO-3 identity (250 → 251), or the one UN Comtrade publishes its trade under (158 → 490)."
    • changedOutput schema / properties / unservedPeriods / description
      Previous value: -"Periods not served: past the period cap (8 keyless, 12 authenticated) or whose requests were rate limited or ran out of time; query them separately."New value: +"Periods not served: past the period cap (8 keyless, 12 authenticated) or whose requests were rate limited, failed on a UN Comtrade server error or network failure, or ran out of time; query them separately."
  4. Changed15 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 the periods; an explicit value must match them."
    • changedInput schema / properties / period / description
      Previous value: -"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."New value: +"One or more periods to query, all annual \"YYYY\" (e.g. [\"2022\", \"2023\"]) or all monthly \"YYYYMM\" (e.g. [\"202201\", \"202202\"]); mixed lengths are rejected. Serves the first 8 periods keyless (12 with authenticated access); the rest, and any period whose request is rate limited or runs out of time, are listed in unservedPeriods. Input ceiling 120."
    • changedInput schema / properties / reporter_code / description
      Previous 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."New value: +"M49 reporter code or nonempty array (input ceiling 200). Deduplicates and serves the first 20 reporters, disclosing the remainder; served codes of an array that return no records are listed in reportersWithoutRecords. Some codes are partners only (0 World, 250 Metropolitan France; France reports as 251). Omit only with an explicit partner_code to query all reporters."
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous 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."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. `rate_limited`: No served period completed and UN Comtrade rate-limited at least one through its retries. `deadline_exceeded`: No served period completed within the call's time budget. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "keyless_hs_edition_unsupported",
      -  "invalid_reporter_filter",
      -  "upstream_validation",
      -  "invalid_upstream_response"
      -]New value: +[
      +  "keyless_hs_edition_unsupported",
      +  "invalid_reporter_filter",
      +  "upstream_validation",
      +  "invalid_upstream_response",
      +  "rate_limited",
      +  "deadline_exceeded"
      +]
    • changedOutput schema / properties / notice / description
      Previous value: -"Recovery hint when no records are returned. Absent on successful responses."New value: +"Why data is missing: periods that were rate limited (with the wait) or ran out of time, and a recovery hint when no records are returned, naming the reporter-valid counterpart of a partner-only reporter_code."
    • changedOutput schema / properties / records / items / properties / altQty / description
      Previous value: -"Alternate quantity, in its own unit."New value: +"Alternate quantity, in its own unit. Absent when not reported."
    • changedOutput schema / properties / records / items / properties / cifvalue / description
      Previous value: -"Cost-insurance-freight value in USD (imports only)."New value: +"Cost-insurance-freight value in USD. Absent when not reported."
    • changedOutput schema / properties / records / items / properties / fobvalue / description
      Previous value: -"Free-on-board value in USD (exports only)."New value: +"Free-on-board value in USD. Absent when not reported."
    • changedOutput schema / properties / records / items / properties / grossWgt / description
      Previous value: -"Gross weight in kg."New value: +"Gross weight in kg. Absent when not reported."
    • changedOutput schema / properties / records / items / properties / netWgt / description
      Previous value: -"Net weight in kg. Often null for aggregated rows."New value: +"Net weight in kg. Absent when not reported."
    • changedOutput schema / properties / records / items / properties / qty / description
      Previous value: -"Quantity in commodity-specific units. Often null for aggregated rows."New value: +"Quantity in commodity-specific units. Absent when not reported."
    • addedOutput schema / properties / reportersWithoutRecords
      Added value: +{
      +  "description": "Served codes from a reporter_code array with no records in any served period. Omitted when truncated, since a capped response can hide a reporter’s rows.",
      +  "items": {
      +    "additionalProperties": false,
      +    "description": "A served reporter with no records, classified by the reference catalogs.",
      +    "properties": {
      +      "name": {
      +        "description": "Reference catalog name; absent when the code is in neither catalog.",
      +        "type": "string"
      +      },
      +      "referenceStatus": {
      +        "description": "reporter: a reporting entity with nothing published here; partner_only: a code UN Comtrade lists only as a partner; unknown: in neither reference catalog.",
      +        "enum": [
      +          "reporter",
      +          "partner_only",
      +          "unknown"
      +        ],
      +        "type": "string"
      +      },
      +      "reporterCode": {
      +        "description": "Served reporter code that returned no records.",
      +        "type": "number"
      +      },
      +      "suggestedReporterCode": {
      +        "description": "Reporter-valid code sharing a partner_only code’s ISO-3 identity (250 → 251); query it instead.",
      +        "type": "number"
      +      }
      +    },
      +    "required": [
      +      "reporterCode",
      +      "referenceStatus"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / unservedPeriods / description
      Previous value: -"Periods beyond the 12-period work cap; query them separately."New value: +"Periods not served: past the period cap (8 keyless, 12 authenticated) or whose requests were rate limited or ran out of time; query them separately."
  5. Changed28 schema fields changed
    • changedInput schema / properties / classification / description
      Previous 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."
    • removedInput schema / properties / classification / enum
      Removed value: -[
      -  "HS",
      -  "H0",
      -  "H1",
      -  "H2",
      -  "H3",
      -  "H4",
      -  "H5",
      -  "H6",
      -  "S1",
      -  "S2",
      -  "S3",
      -  "S4",
      -  "SS"
      -]
    • changedInput schema / properties / cmd_code / description
      Previous 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."
    • addedInput schema / properties / cmd_code / items / pattern
      Added value: +"^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$"
    • removedInput schema / properties / flow_code / enum
      Removed value: -[
      -  "M",
      -  "X",
      -  "RX",
      -  "RM"
      -]
    • 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"
      -]
    • changedInput schema / properties / partner_code / maximum
      Previous value: -9007199254740991New value: +999
    • changedInput schema / properties / partner_code / minimum
      Previous value: --9007199254740991New value: +0
    • removedInput schema / properties / period / items / minLength
      Removed value: -4
    • addedInput schema / properties / period / items / pattern
      Added value: +"^[0-9]{4}(?:0[1-9]|1[0-2])?$"
    • addedInput schema / properties / reporter_code / anyOf
      Added 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"
      +  }
      +]
    • changedInput schema / properties / reporter_code / description
      Previous 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."
    • removedInput schema / properties / reporter_code / maximum
      Removed value: -9007199254740991
    • removedInput schema / properties / reporter_code / minimum
      Removed value: --9007199254740991
    • removedInput schema / properties / reporter_code / type
      Removed value: -"integer"
    • changedInput schema / required
      Previous value: -[
      -  "reporter_code",
      -  "flow_code",
      -  "period"
      -]New value: +[
      +  "flow_code",
      +  "period"
      +]
    • 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: `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."
    • addedOutput schema / properties / error / properties / data / properties / reason / examples
      Added value: +[
      +  "keyless_hs_edition_unsupported",
      +  "invalid_reporter_filter",
      +  "upstream_validation",
      +  "invalid_upstream_response"
      +]
    • addedOutput schema / properties / records / items / properties / altQty
      Added value: +{
      +  "description": "Alternate quantity, in its own unit.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / records / items / properties / altQtyUnitAbbr
      Added value: +{
      +  "description": "Alternate quantity unit abbreviation.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / records / items / properties / altQtyUnitCode
      Added value: +{
      +  "description": "Alternate quantity unit code.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / records / items / properties / classificationCode
      Added value: +{
      +  "description": "Actual classification edition supplied by the row.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / records / items / properties / isNetWgtEstimated
      Added value: +{
      +  "description": "Whether net weight is estimated.",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / records / items / properties / isQtyEstimated
      Added value: +{
      +  "description": "Whether quantity is estimated.",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / records / items / properties / qtyUnitAbbr
      Added value: +{
      +  "description": "Quantity unit abbreviation supplied or resolved from the unit catalog.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / records / items / properties / qtyUnitCode
      Added value: +{
      +  "description": "Quantity unit code; -1 means unavailable.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / unservedReporters
      Added value: +{
      +  "description": "Reporter codes beyond the 20-reporter work cap; query them separately.",
      +  "items": {
      +    "type": "number"
      +  },
      +  "type": "array"
      +}
  6. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint; the description adds substantially more — pagination via nextOffset, keyless preview behavior (one request per served period, ≥4 seconds apart, 500-record cap), the unservedPeriods and reportersWithoutRecords disclosure mechanisms, and that each page repeats the upstream period requests. This is exactly the operational context an agent cannot get from the 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.

Conciseness4/5

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

Front-loads the identity and return shape before mechanics, and nearly every sentence carries operational content. A few clauses are compressed into long run-on sentences (the period-serving and rate-limit sentence especially), costing some readability but not wasting space.

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?

For a 9-parameter, paginated, rate-limited data tool with an output schema, the description covers all the decision-relevant surface: aggregation shortcuts, code resolution, paging, and the keyless limits that determine whether a call will return a complete result. Return-value details are correctly left to the output schema.

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 baseline is 3, and much of the description's parameter talk (partner_code 0, cmd_code "TOTAL") restates the schema. It still earns a bump by adding usage framing across parameters — multiple periods and commodity codes per call, and pairing SITC codes with the selected SITC revision rather than the default HS classification.

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?

Opens with a specific verb and resource ("Fetch bilateral trade flow records") and stakes its position as "the primary data retrieval tool," which separates it from siblings like comtrade_get_top_commodities or comtrade_get_trade_balance. It also enumerates the returned measures (trade value USD, quantity, net weight, metadata), so an agent knows exactly what comes back.

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 concrete routing instructions: use comtrade_lookup_countries to resolve reporter/partner codes and comtrade_search_commodities to resolve HS codes, plus scenario rules (partner_code 0 for world totals, omit cmd_code or use "TOTAL" to aggregate commodities). It stops short of stating when to prefer this over aggregation siblings such as comtrade_get_trade_balance, so it is strong but not fully exhaustive.

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.