{
  "notice": "bxzxxr MCP archive: a record of what public MCP servers declared when we listed them (we never call their tools). It is data, not a rating: nothing here says a server is safe, secure, verified or trustworthy, and a server can change after we looked. Secrets we detected are redacted; redacted tool lists are withheld and only their hash is shown.",
  "infrastructure": {
    "host": "un-comtrade.caseyjhand.com",
    "site": "caseyjhand.com",
    "addresses": [
      {
        "address": "104.26.11.117",
        "endpoints": 131,
        "shared_infrastructure": true,
        "network": {
          "asn": 13335,
          "name": "CLOUDFLARENET - Cloudflare, Inc.",
          "prefix": "104.26.0.0/20",
          "country": "US"
        }
      },
      {
        "address": "172.67.72.95",
        "endpoints": 131,
        "shared_infrastructure": true,
        "network": {
          "asn": 13335,
          "name": "CLOUDFLARENET - Cloudflare, Inc.",
          "prefix": "172.67.64.0/20",
          "country": "US"
        }
      },
      {
        "address": "104.26.10.117",
        "endpoints": 131,
        "shared_infrastructure": true,
        "network": {
          "asn": 13335,
          "name": "CLOUDFLARENET - Cloudflare, Inc.",
          "prefix": "104.26.0.0/20",
          "country": "US"
        }
      },
      {
        "address": "2606:4700:20::681a:b75",
        "endpoints": 131,
        "shared_infrastructure": true,
        "network": {
          "asn": 13335,
          "name": "CLOUDFLARENET - Cloudflare, Inc.",
          "prefix": "2606:4700:20::/44",
          "country": "US"
        }
      },
      {
        "address": "2606:4700:20::681a:a75",
        "endpoints": 131,
        "shared_infrastructure": true,
        "network": {
          "asn": 13335,
          "name": "CLOUDFLARENET - Cloudflare, Inc.",
          "prefix": "2606:4700:20::/44",
          "country": "US"
        }
      },
      {
        "address": "2606:4700:20::ac43:485f",
        "endpoints": 131,
        "shared_infrastructure": true,
        "network": {
          "asn": 13335,
          "name": "CLOUDFLARENET - Cloudflare, Inc.",
          "prefix": "2606:4700:20::/44",
          "country": "US"
        }
      }
    ],
    "addresses_recorded": true,
    "address_history": [
      {
        "addresses": [
          "104.26.11.117",
          "172.67.72.95",
          "104.26.10.117",
          "2606:4700:20::681a:b75",
          "2606:4700:20::681a:a75",
          "2606:4700:20::ac43:485f"
        ],
        "first_seen": "2026-11-23T21:38:00.928Z",
        "last_seen": "2026-11-23T21:38:00.928Z",
        "checks": 1
      },
      {
        "addresses": [
          "104.26.10.117",
          "172.67.72.95",
          "104.26.11.117",
          "2606:4700:20::ac43:485f",
          "2606:4700:20::681a:b75",
          "2606:4700:20::681a:a75"
        ],
        "first_seen": "2026-11-22T21:37:01.904Z",
        "last_seen": "2026-11-22T21:37:01.904Z",
        "checks": 1
      },
      {
        "addresses": [
          "172.67.72.95",
          "104.26.10.117",
          "104.26.11.117",
          "2606:4700:20::ac43:485f",
          "2606:4700:20::681a:a75",
          "2606:4700:20::681a:b75"
        ],
        "first_seen": "2026-11-21T17:11:00.975Z",
        "last_seen": "2026-11-21T17:11:00.975Z",
        "checks": 1
      }
    ],
    "hosting": [
      {
        "value": "Cloudflare",
        "evidence": "Server header \"cloudflare\""
      }
    ],
    "software": [],
    "server_info": {
      "name": "un-comtrade-mcp-server",
      "version": "0.5.0",
      "protocol_version": "2025-06-18"
    },
    "headers": {
      "server": "cloudflare",
      "strict-transport-security": "max-age=63072000; includeSubDomains; preload",
      "access-control-allow-origin": "*"
    },
    "auth": null
  },
  "related": {
    "same_address": {
      "total": 130,
      "sample": [
        {
          "id": "6671",
          "url": "https://mcp.amperis.com/mcp",
          "server_name": "com.amperis/catalog",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T07:49:03.164Z"
        },
        {
          "id": "28574",
          "url": "https://art-institute-chicago.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/art-institute-chicago-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:37:01.527Z"
        },
        {
          "id": "28575",
          "url": "https://arxiv.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/arxiv-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:38:00.625Z"
        },
        {
          "id": "28576",
          "url": "https://astronomy.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/astronomy-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:39:01.005Z"
        },
        {
          "id": "28577",
          "url": "https://aviation-weather.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/aviation-weather-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:40:10.861Z"
        },
        {
          "id": "28578",
          "url": "https://biorxiv.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/biorxiv-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:41:00.756Z"
        },
        {
          "id": "28579",
          "url": "https://bls-labor.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/bls-labor-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:42:00.955Z"
        },
        {
          "id": "28580",
          "url": "https://bluesky.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/bluesky-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:43:00.549Z"
        },
        {
          "id": "28581",
          "url": "https://brapi.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/brapi-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:44:00.711Z"
        },
        {
          "id": "28582",
          "url": "https://browser-compat.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/browser-compat-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:45:00.960Z"
        },
        {
          "id": "28583",
          "url": "https://calculator.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/calculator-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:46:00.997Z"
        },
        {
          "id": "28584",
          "url": "https://canada-parliament.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/canada-parliament-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:47:00.399Z"
        },
        {
          "id": "28585",
          "url": "https://cdc.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/cdc-health-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:48:01.098Z"
        },
        {
          "id": "28586",
          "url": "https://census.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/census-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:49:01.578Z"
        },
        {
          "id": "28587",
          "url": "https://cern-inspire.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/cern-inspire-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:50:01.801Z"
        },
        {
          "id": "28588",
          "url": "https://cern-opendata.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/cern-opendata-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:51:01.501Z"
        },
        {
          "id": "28589",
          "url": "https://chembl.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/chembl-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:52:10.758Z"
        },
        {
          "id": "28590",
          "url": "https://cisa-cybersecurity.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/cisa-cybersecurity-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:53:01.929Z"
        },
        {
          "id": "28591",
          "url": "https://clinicaltrials.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/clinicaltrialsgov-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:54:01.031Z"
        },
        {
          "id": "28592",
          "url": "https://college-scorecard.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/college-scorecard-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:55:04.313Z"
        }
      ]
    },
    "same_site": {
      "total": 133,
      "sample": [
        {
          "id": "28574",
          "url": "https://art-institute-chicago.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/art-institute-chicago-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:37:01.527Z"
        },
        {
          "id": "28575",
          "url": "https://arxiv.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/arxiv-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:38:00.625Z"
        },
        {
          "id": "28576",
          "url": "https://astronomy.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/astronomy-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:39:01.005Z"
        },
        {
          "id": "28577",
          "url": "https://aviation-weather.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/aviation-weather-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:40:10.861Z"
        },
        {
          "id": "28578",
          "url": "https://biorxiv.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/biorxiv-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:41:00.756Z"
        },
        {
          "id": "28579",
          "url": "https://bls-labor.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/bls-labor-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:42:00.955Z"
        },
        {
          "id": "28580",
          "url": "https://bluesky.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/bluesky-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:43:00.549Z"
        },
        {
          "id": "28581",
          "url": "https://brapi.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/brapi-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:44:00.711Z"
        },
        {
          "id": "28582",
          "url": "https://browser-compat.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/browser-compat-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:45:00.960Z"
        },
        {
          "id": "28583",
          "url": "https://calculator.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/calculator-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:46:00.997Z"
        },
        {
          "id": "28584",
          "url": "https://canada-parliament.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/canada-parliament-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:47:00.399Z"
        },
        {
          "id": "28585",
          "url": "https://cdc.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/cdc-health-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:48:01.098Z"
        },
        {
          "id": "28586",
          "url": "https://census.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/census-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:49:01.578Z"
        },
        {
          "id": "28587",
          "url": "https://cern-inspire.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/cern-inspire-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:50:01.801Z"
        },
        {
          "id": "28588",
          "url": "https://cern-opendata.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/cern-opendata-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:51:01.501Z"
        },
        {
          "id": "28589",
          "url": "https://chembl.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/chembl-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:52:10.758Z"
        },
        {
          "id": "28590",
          "url": "https://cisa-cybersecurity.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/cisa-cybersecurity-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:53:01.929Z"
        },
        {
          "id": "28591",
          "url": "https://clinicaltrials.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/clinicaltrialsgov-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:54:01.031Z"
        },
        {
          "id": "28592",
          "url": "https://college-scorecard.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/college-scorecard-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:55:04.313Z"
        },
        {
          "id": "28593",
          "url": "https://congressgov.caseyjhand.com/mcp",
          "server_name": "io.github.cyanheads/congressgov-mcp-server",
          "last_state": "listed",
          "last_checked_at": "2026-11-23T19:56:11.093Z"
        }
      ]
    },
    "same_tool_list": {
      "total": 0,
      "sample": []
    },
    "same_publisher": {
      "publisher": "io.github.cyanheads",
      "total": 165,
      "sample": [
        {
          "name": "io.github.cyanheads/anime-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/art-institute-chicago-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/arxiv-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/astronomy-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/attack-surface-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/aviation-weather-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/biorxiv-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/bls-labor-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/bls-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/bluesky-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/brapi-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/browser-compat-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/calculator-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/canada-parliament-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/cdc-health-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/census-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/cern-inspire-mcp-server",
          "title": "cern-inspire-mcp-server"
        },
        {
          "name": "io.github.cyanheads/cern-opendata-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/chembl-mcp-server",
          "title": null
        },
        {
          "name": "io.github.cyanheads/cisa-cybersecurity-mcp-server",
          "title": null
        }
      ]
    },
    "same_repository": {
      "repository_url": "https://github.com/cyanheads/un-comtrade-mcp-server",
      "total": 0,
      "sample": []
    },
    "note": "Shared addresses on big platforms (Cloudflare, Vercel and the like) put unrelated servers together; those are marked shared_infrastructure. A match is a pivot, not a link between operators."
  },
  "endpoint": {
    "id": "28691",
    "server_name": "io.github.cyanheads/un-comtrade-mcp-server",
    "url": "https://un-comtrade.caseyjhand.com/mcp",
    "host": "un-comtrade.caseyjhand.com",
    "transport": "streamable-http",
    "last_checked_at": "2026-11-23T21:38:00.928Z",
    "last_state": "listed",
    "last_detail": null,
    "consecutive_failures": 0,
    "current_sha": "944cf88556b406024ec5fe56aa1a6cab5bda3656507dd072d03e58c5b003293b",
    "first_listed_at": "2026-11-21T17:11:00.975Z",
    "created_at": "2026-11-21T09:30:14.625Z",
    "resolved_addresses": [
      "104.26.11.117",
      "172.67.72.95",
      "104.26.10.117",
      "2606:4700:20::681a:b75",
      "2606:4700:20::681a:a75",
      "2606:4700:20::ac43:485f"
    ]
  },
  "server": {
    "name": "io.github.cyanheads/un-comtrade-mcp-server",
    "title": null,
    "description": "UN Comtrade international trade statistics via MCP. Country/HS lookups, flows, balances, rankings.",
    "version": "0.5.0",
    "registry_status": "active",
    "repository_url": "https://github.com/cyanheads/un-comtrade-mcp-server",
    "website_url": null,
    "published_at": "2026-11-22T01:24:32.586Z",
    "updated_at": "2026-11-22T01:24:32.586Z",
    "first_seen": "2026-11-21T09:30:14.067Z"
  },
  "other_endpoints": [],
  "intel": {
    "capabilities": [],
    "evm_addresses": [],
    "chains": [],
    "tokens": [],
    "computed_at": "2026-11-22T21:37:14.975Z"
  },
  "operator": {
    "key": "caseyjhand.com",
    "name": "caseyjhand.com",
    "platform": false,
    "marketplace": false
  },
  "needs_sign_in": false,
  "reachability": {
    "window_days": 30,
    "checks": 3,
    "answered": 3,
    "answered_percent": 100,
    "avg_listing_latency_ms": 665,
    "first_check_in_window": "2026-11-21T17:11:00.975Z",
    "consecutive_failures_now": 0,
    "days": [
      {
        "day": "2026-11-21",
        "checks": 1,
        "answered": 1,
        "last_state": "listed"
      },
      {
        "day": "2026-11-22",
        "checks": 1,
        "answered": 1,
        "last_state": "listed"
      },
      {
        "day": "2026-11-23",
        "checks": 1,
        "answered": 1,
        "last_state": "listed"
      }
    ]
  },
  "tool_list": {
    "sha256": "944cf88556b406024ec5fe56aa1a6cab5bda3656507dd072d03e58c5b003293b",
    "tools": 11,
    "resources": 5,
    "prompts": 0,
    "first_seen": "2026-11-22T21:37:02.523Z",
    "tool_names": [
      "comtrade_lookup_countries",
      "comtrade_search_commodities",
      "comtrade_list_service_categories",
      "comtrade_get_trade_flows",
      "comtrade_get_trade_balance",
      "comtrade_get_top_partners",
      "comtrade_get_top_services_partners",
      "comtrade_get_top_reporters",
      "comtrade_get_top_commodities",
      "comtrade_get_data_availability",
      "comtrade_get_services_trade"
    ],
    "declared": {
      "tools": [
        {
          "name": "comtrade_lookup_countries",
          "title": "Lookup Countries / Areas",
          "description": "Resolve country and area names to Comtrade M49 numeric codes used in all data queries. Accepts a partial or full name, an official name (e.g. \"Republic of Korea\"), a common name (e.g. \"UK\", \"Turkey\"), or an ISO alpha-2/alpha-3 code (e.g. \"USA\", \"US\"), ignoring case and accents; exact matches are listed before partial ones. Returns matching entries with their numeric code, ISO identifiers, a validAsReporter flag, and validity dates; within the exact and partial groups, historical entities such as Fed. Rep. of Germany (...1990) are listed after current ones. World (code 0) is a valid partner but not a valid reporter, while some groupings, such as the European Union (97), do report — check validAsReporter. 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.",
          "inputSchema": {
            "type": "object",
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "required": [
              "query"
            ],
            "properties": {
              "role": {
                "enum": [
                  "reporter",
                  "partner",
                  "any"
                ],
                "type": "string",
                "default": "any",
                "description": "Filter by role: \"reporter\" returns only codes valid for reporter_code; \"partner\" returns only codes valid for partner_code, which include World (0) but not reporter-only groupings such as the European Union (97) and ASEAN (975); \"any\" returns every match."
              },
              "query": {
                "type": "string",
                "minLength": 1,
                "description": "Country or area to find by name, name fragment, official or common name, or ISO alpha-2/alpha-3 code. Case, accents and surrounding spaces are ignored. Name matching treats St and St. as Saint and accepts straight or curly apostrophes. Examples: \"Germany\", \"DEU\", \"DE\", \"south korea\", \"Turkiye\", \"St. Lucia\"."
              },
              "include_groups": {
                "type": "boolean",
                "default": true,
                "description": "Whether to include regional and economic groupings (e.g. EU, ASEAN). Set to false to return only individual countries and groupings under which a match’s goods trade is published (490 Other Asia, nes for 158 Taiwan, Province of China)."
              }
            },
            "additionalProperties": false
          },
          "outputSchema": {
            "type": "object",
            "anyOf": [
              {
                "not": {
                  "required": [
                    "error"
                  ]
                },
                "required": [
                  "matches",
                  "totalMatches"
                ]
              },
              {
                "required": [
                  "error"
                ]
              }
            ],
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "error": {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "maximum": 9007199254740991,
                    "minimum": -9007199254740991,
                    "description": "JSON-RPC error code for this failure."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "description": "Machine-readable failure mode."
                      },
                      "recovery": {
                        "type": "object",
                        "required": [
                          "hint"
                        ],
                        "properties": {
                          "hint": {
                            "type": "string"
                          }
                        },
                        "description": "Actionable next step for the caller.",
                        "additionalProperties": {}
                      },
                      "retryable": {
                        "type": "boolean",
                        "description": "Whether retrying may succeed."
                      }
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "description": "Human-readable description of what went wrong."
                  }
                },
                "description": "Present when the call failed. Absent on success.",
                "additionalProperties": {}
              },
              "notice": {
                "type": "string",
                "description": "Recovery hint when the query has no matches or role and group filters exclude them, or the goods and services codes to query for Taiwan (490 for goods reporter or partner and 158 for services partner)."
              },
              "matches": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "name",
                    "validAsReporter",
                    "isGroup"
                  ],
                  "properties": {
                    "id": {
                      "type": "number",
                      "description": "M49 numeric code to use in trade data queries."
                    },
                    "iso2": {
                      "type": "string",
                      "description": "ISO 3166-1 alpha-2 code, when available."
                    },
                    "iso3": {
                      "type": "string",
                      "description": "ISO 3166-1 alpha-3 code, when available."
                    },
                    "name": {
                      "type": "string",
                      "description": "Display name of the country or area."
                    },
                    "note": {
                      "type": "string",
                      "description": "The catalog’s long-form name or coverage note, e.g. \"France, Monaco\" for 251 France; a match can come from it. Absent when the catalog gives none or it repeats the name."
                    },
                    "isGroup": {
                      "type": "boolean",
                      "description": "Whether this entry is a geographic or economic grouping rather than a single country."
                    },
                    "validAsReporter": {
                      "type": "boolean",
                      "description": "Whether this code is valid as a reporter_code in trade data queries. Most groupings (isGroup=true) are partner-only, though some report, such as the European Union (97)."
                    },
                    "entryExpiredDate": {
                      "type": "string",
                      "description": "Last day the entity was valid (YYYY-MM-DD), e.g. 1990-12-31 for Fed. Rep. of Germany (...1990); absent when upstream records no expiry."
                    },
                    "entryEffectiveDate": {
                      "type": "string",
                      "description": "First day the entity is valid in UN Comtrade reference data (YYYY-MM-DD), when upstream lists one."
                    }
                  },
                  "description": "A country or area entry with its Comtrade M49 code and identifiers.",
                  "additionalProperties": false
                },
                "description": "Matching entries, plus entries sharing an ISO-3 code with a match and the code under which UN Comtrade publishes a match’s goods trade (490 Other Asia, nes for 158 Taiwan, Province of China). Exact matches (a common name, ISO code, name, or official long-form name equal to the query) come before partial-name matches, and an entry a match pulls in ranks with that match. Within each rank, reporter-valid entries come first, then current before expired (entryExpiredDate before today), then name and code."
              },
              "totalMatches": {
                "type": "number",
                "description": "Total number of matching entries."
              }
            },
            "additionalProperties": false
          },
          "annotations": {
            "readOnlyHint": true,
            "openWorldHint": false
          }
        },
        {
          "name": "comtrade_search_commodities",
          "title": "Search Commodity Codes",
          "description": "Find HS or SITC commodity codes by keyword, description, or code prefix. A code written with dots, spaces, or hyphens (\"0901.11\") matches 090111. Exact codes, code prefixes and contiguous description matches rank first, followed by descriptions containing every query term in any order. Default HS searches include historical codes and report which edition catalogs list each code. Use a trade row’s classificationCode or comtrade_get_data_availability to identify the edition, then search that edition for its descriptions. Keyless goods queries use HS for as-reported data. Continue with nextOffset using the same query, classification, and aggr_level.",
          "inputSchema": {
            "type": "object",
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "required": [
              "query"
            ],
            "properties": {
              "limit": {
                "type": "integer",
                "default": 50,
                "maximum": 9007199254740991,
                "minimum": 1,
                "description": "Maximum matching codes returned per page; defaults to 50."
              },
              "query": {
                "type": "string",
                "minLength": 1,
                "description": "Keyword, partial description, or commodity code prefix. Dots, spaces, and hyphens in a code are ignored, so \"0901.11\" finds 090111. Examples: \"motor vehicles\", \"8471\", \"coffee\", \"84\" (HS chapter 84 = machinery)."
              },
              "offset": {
                "type": "integer",
                "default": 0,
                "maximum": 9007199254740991,
                "minimum": 0,
                "description": "Number of matching codes to skip; use nextOffset to continue."
              },
              "aggr_level": {
                "anyOf": [
                  {
                    "type": "number",
                    "const": 1
                  },
                  {
                    "type": "number",
                    "const": 2
                  },
                  {
                    "type": "number",
                    "const": 3
                  },
                  {
                    "type": "number",
                    "const": 4
                  },
                  {
                    "type": "number",
                    "const": 5
                  },
                  {
                    "type": "number",
                    "const": 6
                  }
                ],
                "description": "Native aggregation level: HS uses 2 (chapter), 4 (heading), 6 (subheading); SITC uses 1–5. Omit to return all matching levels."
              },
              "classification": {
                "type": "string",
                "default": "HS",
                "description": "Goods reference catalog, case-insensitive: 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."
              }
            },
            "additionalProperties": false
          },
          "outputSchema": {
            "type": "object",
            "anyOf": [
              {
                "not": {
                  "required": [
                    "error"
                  ]
                },
                "required": [
                  "classification",
                  "matches",
                  "totalMatches",
                  "shown",
                  "truncated",
                  "offset"
                ]
              },
              {
                "required": [
                  "error"
                ]
              }
            ],
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "error": {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "maximum": 9007199254740991,
                    "minimum": -9007199254740991,
                    "description": "JSON-RPC error code for this failure."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "examples": [
                          "invalid_aggregation_level"
                        ],
                        "description": "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."
                      },
                      "recovery": {
                        "type": "object",
                        "required": [
                          "hint"
                        ],
                        "properties": {
                          "hint": {
                            "type": "string"
                          }
                        },
                        "description": "Actionable next step for the caller.",
                        "additionalProperties": {}
                      },
                      "retryable": {
                        "type": "boolean",
                        "description": "Whether retrying may succeed."
                      }
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "description": "Human-readable description of what went wrong."
                  }
                },
                "description": "Present when the call failed. Absent on success.",
                "additionalProperties": {}
              },
              "shown": {
                "type": "number",
                "description": "Number of codes returned on this page."
              },
              "notice": {
                "type": "string",
                "description": "Recovery hint when no codes match, matches remain past this page, or the offset is past the end. Absent otherwise."
              },
              "offset": {
                "type": "number",
                "description": "Number of matching codes skipped for this page."
              },
              "matches": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "description",
                    "aggrLevel",
                    "isLeaf",
                    "recommendedQueryCode"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Commodity code in the selected classification, preserving leading zeros."
                    },
                    "isLeaf": {
                      "type": "boolean",
                      "description": "Whether this code has no sub-codes (leaf node in the HS hierarchy)."
                    },
                    "parent": {
                      "type": "string",
                      "description": "Parent commodity code in the selected classification."
                    },
                    "editions": {
                      "type": "array",
                      "items": {
                        "enum": [
                          "H0",
                          "H1",
                          "H2",
                          "H3",
                          "H4",
                          "H5",
                          "H6"
                        ],
                        "type": "string"
                      },
                      "description": "H0–H6 catalogs listing this code in edition order. Definitions may differ across editions. Available for default HS searches when edition catalogs load."
                    },
                    "aggrLevel": {
                      "type": "number",
                      "description": "Native aggregation level in the selected HS or SITC catalog; 0 is the all-commodities TOTAL, which no aggr_level filter returns."
                    },
                    "description": {
                      "type": "string",
                      "description": "Full commodity description."
                    },
                    "parentDescription": {
                      "type": "string",
                      "description": "Immediate parent description from the default HS discovery catalog, when the code is absent from H6 and the parent exists in the discovery catalog."
                    },
                    "recommendedQueryCode": {
                      "type": "string",
                      "description": "Code to pass as cmd_code with the same classification in trade data queries."
                    }
                  },
                  "description": "A commodity entry from the selected catalog.",
                  "additionalProperties": false
                },
                "description": "Commodity codes on this page matching the query in the selected classification, ranked exact code, code prefix, whole-word description match, then other description matches for the contiguous query, then descriptions containing every term in any order. Ties keep catalog order."
              },
              "truncated": {
                "type": "boolean",
                "description": "Whether this page holds only part of the matching codes (shown < totalMatches)."
              },
              "nextOffset": {
                "type": "number",
                "description": "Offset for the next page; absent when no matching codes remain."
              },
              "totalMatches": {
                "type": "number",
                "description": "Total matching codes across all pages."
              },
              "classification": {
                "type": "string",
                "description": "Reference catalog used for the search."
              },
              "referenceNotice": {
                "type": "string",
                "description": "Unavailable HS edition catalog names when the discovery page is returned without edition enrichment."
              }
            },
            "additionalProperties": false
          },
          "annotations": {
            "readOnlyHint": true,
            "openWorldHint": false
          }
        },
        {
          "name": "comtrade_list_service_categories",
          "title": "List Service Trade Categories (EB)",
          "description": "List service trade categories from the combined EB catalog, including numeric EBOPS and SDMX codes. Returns category codes, descriptions, parent codes, and the EBOPS scheme catalogs that list each code: EB10 (EBOPS 2010), EB10S (EBOPS 2010 SDMX codes), EB02 (EBOPS 2002). Search by keyword or by several terms in any order, or browse direct children of a parent code; \"200\" lists the EB10 and EB02 top levels. Use the returned id as service_code in comtrade_get_services_trade. Code 3 is transport; SA is manufacturing services. Each page holds up to limit categories; continue with nextOffset using the same query and parent_code.",
          "inputSchema": {
            "type": "object",
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "limit": {
                "type": "integer",
                "default": 100,
                "maximum": 9007199254740991,
                "minimum": 1,
                "description": "Maximum categories returned per page; defaults to 100."
              },
              "query": {
                "type": "string",
                "description": "Description keyword, phrase, whitespace-separated terms, or category code prefix. Description terms match case-insensitively in any order. Codes compare case-insensitively and keep their dots. Examples: \"transport\", \"SA\", \"3.1\", \"insurance pension\". Omit, or leave blank, to list all EB categories."
              },
              "offset": {
                "type": "integer",
                "default": 0,
                "maximum": 9007199254740991,
                "minimum": 0,
                "description": "Number of matching categories to skip; use nextOffset to continue."
              },
              "parent_code": {
                "type": "string",
                "description": "Return direct children of this EB category code. Examples: \"3\" for transport sub-categories, \"3.1\" for sea transport sub-categories, or \"200\" for the EB10 and EB02 top-level categories."
              }
            },
            "additionalProperties": false
          },
          "outputSchema": {
            "type": "object",
            "anyOf": [
              {
                "not": {
                  "required": [
                    "error"
                  ]
                },
                "required": [
                  "categories",
                  "totalMatches",
                  "shown",
                  "truncated",
                  "offset"
                ]
              },
              {
                "required": [
                  "error"
                ]
              }
            ],
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "error": {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "maximum": 9007199254740991,
                    "minimum": -9007199254740991,
                    "description": "JSON-RPC error code for this failure."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "description": "Machine-readable failure mode."
                      },
                      "recovery": {
                        "type": "object",
                        "required": [
                          "hint"
                        ],
                        "properties": {
                          "hint": {
                            "type": "string"
                          }
                        },
                        "description": "Actionable next step for the caller.",
                        "additionalProperties": {}
                      },
                      "retryable": {
                        "type": "boolean",
                        "description": "Whether retrying may succeed."
                      }
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "description": "Human-readable description of what went wrong."
                  }
                },
                "description": "Present when the call failed. Absent on success.",
                "additionalProperties": {}
              },
              "shown": {
                "type": "number",
                "description": "Number of categories returned on this page."
              },
              "notice": {
                "type": "string",
                "description": "Recovery hint when no categories match, matches remain past this page, the offset is past the end, or scheme tags are unavailable."
              },
              "offset": {
                "type": "number",
                "description": "Number of matching categories skipped for this page."
              },
              "truncated": {
                "type": "boolean",
                "description": "Whether this page holds only part of the matching categories (shown < totalMatches)."
              },
              "categories": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "description"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "EBOPS category code (use as service_code in trade queries)."
                    },
                    "parent": {
                      "type": "string",
                      "description": "Parent category code, if any; EB10 top-level codes take 200 from the EB10 catalog."
                    },
                    "schemes": {
                      "type": "array",
                      "items": {
                        "enum": [
                          "EB10",
                          "EB10S",
                          "EB02"
                        ],
                        "type": "string"
                      },
                      "description": "EBOPS scheme catalogs listing this code: EB10 (EBOPS 2010), EB10S (EBOPS 2010 SDMX codes), EB02 (EBOPS 2002). Empty when no scheme catalog lists it; absent when the scheme catalogs could not be loaded."
                    },
                    "ebParent": {
                      "type": "string",
                      "description": "Parent the combined EB catalog gives this code when it differs from parent: TOTAL for EB10 top-level codes."
                    },
                    "description": {
                      "type": "string",
                      "description": "Category description."
                    }
                  },
                  "description": "A service trade category from the combined EB catalog.",
                  "additionalProperties": false
                },
                "description": "EB service categories on this page. With a query, ranked exact code, code prefix, whole-word phrase, other contiguous phrase, then descriptions containing every query term in any order. Ties and unfiltered listings keep catalog order."
              },
              "nextOffset": {
                "type": "number",
                "description": "Offset for the next page; absent when no matching categories remain."
              },
              "totalMatches": {
                "type": "number",
                "description": "Total matching categories across all pages."
              }
            },
            "additionalProperties": false
          },
          "annotations": {
            "readOnlyHint": true,
            "openWorldHint": false
          }
        },
        {
          "name": "comtrade_get_trade_flows",
          "title": "Get Trade Flow Records",
          "description": "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.",
          "inputSchema": {
            "type": "object",
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "required": [
              "flow_code",
              "period"
            ],
            "properties": {
              "freq": {
                "type": "string",
                "description": "Frequency: A=annual YYYY, M=monthly YYYYMM (01–12). Omit to infer it from the periods; an explicit value must match them."
              },
              "limit": {
                "type": "integer",
                "default": 25,
                "minimum": 1,
                "description": "Records per page (default 25). Larger requests are limited to 1000 with a notice."
              },
              "offset": {
                "type": "integer",
                "default": 0,
                "maximum": 9007199254740991,
                "minimum": 0,
                "description": "Number of retrieved records to skip."
              },
              "period": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[0-9]{4}(?:0[1-9]|1[0-2])?$"
                },
                "maxItems": 120,
                "minItems": 1,
                "description": "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."
              },
              "cmd_code": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$"
                },
                "maxItems": 200,
                "description": "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."
              },
              "flow_code": {
                "type": "string",
                "description": "Trade flow direction: M=imports, X=exports, RX=re-exports, RM=re-imports."
              },
              "partner_code": {
                "type": "integer",
                "maximum": 999,
                "minimum": 0,
                "description": "M49 code of the trade partner. Use 0 to aggregate across all partners (World total). Omitting it can return World alongside the partner breakdown."
              },
              "reporter_code": {
                "anyOf": [
                  {
                    "type": "integer",
                    "maximum": 999,
                    "minimum": 0,
                    "description": "One M49 reporter code."
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "integer",
                      "maximum": 999,
                      "minimum": 0
                    },
                    "maxItems": 200,
                    "minItems": 1,
                    "description": "Reporter codes to query together."
                  }
                ],
                "description": "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."
              },
              "classification": {
                "type": "string",
                "default": "HS",
                "description": "Goods classification: HS as reported, H0–H6 with authenticated access, or SITC S1–S4/SS."
              }
            },
            "additionalProperties": false
          },
          "outputSchema": {
            "type": "object",
            "anyOf": [
              {
                "not": {
                  "required": [
                    "error"
                  ]
                },
                "required": [
                  "records",
                  "totalCount",
                  "offset",
                  "shown",
                  "truncated"
                ]
              },
              {
                "required": [
                  "error"
                ]
              }
            ],
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "error": {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "maximum": 9007199254740991,
                    "minimum": -9007199254740991,
                    "description": "JSON-RPC error code for this failure."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "examples": [
                          "keyless_hs_edition_unsupported",
                          "invalid_reporter_filter",
                          "upstream_validation",
                          "invalid_upstream_response",
                          "rate_limited",
                          "upstream_unavailable",
                          "deadline_exceeded"
                        ],
                        "description": "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."
                      },
                      "recovery": {
                        "type": "object",
                        "required": [
                          "hint"
                        ],
                        "properties": {
                          "hint": {
                            "type": "string"
                          }
                        },
                        "description": "Actionable next step for the caller.",
                        "additionalProperties": {}
                      },
                      "retryable": {
                        "type": "boolean",
                        "description": "Whether retrying may succeed."
                      }
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "description": "Human-readable description of what went wrong."
                  }
                },
                "description": "Present when the call failed. Absent on success.",
                "additionalProperties": {}
              },
              "shown": {
                "type": "number",
                "description": "Number of records on this page."
              },
              "notice": {
                "type": "string",
                "description": "World overlap warnings, commodity edition guidance, period failures, and recovery for empty results, including counterpart codes for reporter or partner filters."
              },
              "offset": {
                "type": "number",
                "description": "Number of retrieved records skipped for this page."
              },
              "records": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "reporterCode",
                    "reporterDesc",
                    "partnerCode",
                    "partnerDesc",
                    "flowCode",
                    "cmdCode",
                    "cmdDesc",
                    "period"
                  ],
                  "properties": {
                    "qty": {
                      "type": "number",
                      "description": "Quantity in commodity-specific units. Absent when not reported."
                    },
                    "altQty": {
                      "type": "number",
                      "description": "Alternate quantity, in its own unit. Absent when not reported."
                    },
                    "netWgt": {
                      "type": "number",
                      "description": "Net weight in kg. Absent when not reported."
                    },
                    "period": {
                      "type": "string",
                      "description": "Period (YYYY for annual, YYYYMM for monthly)."
                    },
                    "cmdCode": {
                      "type": "string",
                      "description": "HS or SITC commodity code or \"TOTAL\"."
                    },
                    "cmdDesc": {
                      "type": "string",
                      "description": "Commodity description."
                    },
                    "cifvalue": {
                      "type": "number",
                      "description": "Cost-insurance-freight value in USD. Absent when not reported."
                    },
                    "flowCode": {
                      "type": "string",
                      "description": "Trade flow: M=import, X=export, RX=re-export, RM=re-import."
                    },
                    "fobvalue": {
                      "type": "number",
                      "description": "Free-on-board value in USD. Absent when not reported."
                    },
                    "grossWgt": {
                      "type": "number",
                      "description": "Gross weight in kg. Absent when not reported."
                    },
                    "aggrLevel": {
                      "type": "number",
                      "description": "Commodity aggregation level supplied by UN Comtrade."
                    },
                    "isReported": {
                      "type": "boolean",
                      "description": "True if directly reported; false if estimated or aggregated by UN."
                    },
                    "partnerCode": {
                      "type": "number",
                      "description": "M49 partner code."
                    },
                    "partnerDesc": {
                      "type": "string",
                      "description": "Partner country/area name."
                    },
                    "qtyUnitAbbr": {
                      "type": "string",
                      "description": "Quantity unit abbreviation supplied or resolved from the unit catalog."
                    },
                    "qtyUnitCode": {
                      "type": "number",
                      "description": "Quantity unit code; omitted when -1 and quantity is absent."
                    },
                    "primaryValue": {
                      "type": "number",
                      "description": "Primary trade value in USD (FOB for exports, CIF for imports)."
                    },
                    "reporterCode": {
                      "type": "number",
                      "description": "M49 reporter code."
                    },
                    "reporterDesc": {
                      "type": "string",
                      "description": "Reporter country/area name."
                    },
                    "altQtyUnitAbbr": {
                      "type": "string",
                      "description": "Alternate quantity unit abbreviation."
                    },
                    "altQtyUnitCode": {
                      "type": "number",
                      "description": "Alternate unit code; omitted when -1 and alternate quantity is absent."
                    },
                    "isQtyEstimated": {
                      "type": "boolean",
                      "description": "Whether quantity is estimated."
                    },
                    "isNetWgtEstimated": {
                      "type": "boolean",
                      "description": "Whether net weight is estimated."
                    },
                    "classificationCode": {
                      "type": "string",
                      "description": "Actual classification edition supplied by the row."
                    }
                  },
                  "description": "A single bilateral trade flow record.",
                  "additionalProperties": false
                },
                "description": "Trade flow records."
              },
              "truncated": {
                "type": "boolean",
                "description": "True when any preview response reached 500 and may be incomplete."
              },
              "limitClamp": {
                "type": "object",
                "required": [
                  "requested",
                  "applied"
                ],
                "properties": {
                  "applied": {
                    "type": "number",
                    "description": "Applied records per page."
                  },
                  "requested": {
                    "type": "number",
                    "description": "Requested records per page."
                  }
                },
                "description": "Requested and applied page sizes when the limit was clamped.",
                "additionalProperties": false
              },
              "nextOffset": {
                "type": "number",
                "description": "Offset for the next page when more records remain."
              },
              "totalCount": {
                "type": "number",
                "description": "Sum of upstream response counts before local filtering; not a full match count when capped."
              },
              "truncationHint": {
                "type": "string",
                "description": "Query narrowing and authenticated access guidance when possibly incomplete."
              },
              "referenceNotice": {
                "type": "string",
                "description": "Notice when reference descriptions could not be loaded; codes and trade values remain available."
              },
              "unservedPeriods": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "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."
              },
              "unservedCmdCodes": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Commodity codes beyond the 20-code work cap; query them separately."
              },
              "unservedReporters": {
                "type": "array",
                "items": {
                  "type": "number"
                },
                "description": "Reporter codes beyond the 20-reporter work cap; query them separately."
              },
              "cmdCodesWithoutRecords": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Served commodity selectors without records in any completed period. Omitted when the result is truncated."
              },
              "reportersWithoutRecords": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "reporterCode",
                    "referenceStatus"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "Reference catalog name; absent when the code is in neither catalog."
                    },
                    "reporterCode": {
                      "type": "number",
                      "description": "Served reporter code that returned no records."
                    },
                    "referenceStatus": {
                      "enum": [
                        "reporter",
                        "partner_only",
                        "unknown"
                      ],
                      "type": "string",
                      "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."
                    },
                    "suggestedReporterCode": {
                      "type": "number",
                      "description": "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)."
                    }
                  },
                  "description": "A served reporter with no records, classified by the reference catalogs.",
                  "additionalProperties": false
                },
                "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."
              }
            },
            "additionalProperties": false
          },
          "annotations": {
            "readOnlyHint": true,
            "openWorldHint": true
          }
        },
        {
          "name": "comtrade_get_trade_balance",
          "title": "Get Trade Balance",
          "description": "Compute the trade balance for a country over one or more periods — total exports minus total imports — with an optional HS or SITC commodity filter whose codes must not overlap. Keyless preview makes two requests per served period, at least 4 seconds apart; authenticated calls batch periods. Returns the export and import values per period and, when both flows have data, the signed balance (USD) 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.",
          "inputSchema": {
            "type": "object",
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "required": [
              "reporter_code",
              "period"
            ],
            "properties": {
              "freq": {
                "type": "string",
                "description": "Frequency for both flows: A=annual YYYY, M=monthly YYYYMM (01–12). Omit to infer it from the periods; an explicit value must match them."
              },
              "period": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[0-9]{4}(?:0[1-9]|1[0-2])?$"
                },
                "maxItems": 120,
                "minItems": 1,
                "description": "Periods, all annual (YYYY) or all monthly (YYYYMM); mixed lengths are rejected. Serves the first 4 distinct periods keyless (12 with authenticated access); the rest, and any period whose export or import request is rate limited, hits a UN Comtrade server error or network failure, or runs out of time, are listed in unservedPeriods. Input ceiling 120."
              },
              "cmd_code": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$"
                },
                "maxItems": 200,
                "description": "HS or SITC commodity codes whose values the balance sums; omit for the overall balance across all commodities. Exact duplicates count once. Overlapping codes are rejected because their shared trade would be summed twice: a code beside one of its sub-codes (27 and 2709), TOTAL beside any other entry, or AG<n> beside another AG selector or a code whose length is not n. Serves the first 20 and discloses the remainder; input ceiling 200."
              },
              "partner_code": {
                "type": "integer",
                "default": 0,
                "maximum": 999,
                "minimum": 0,
                "description": "M49 partner code (0–999); defaults to World (0). The balance uses the reporter’s values. A partner code with a reporter-valid counterpart (840 → 842, 158 → 490) that returns no data fails with no_data naming that counterpart."
              },
              "reporter_code": {
                "type": "integer",
                "maximum": 999,
                "minimum": 0,
                "description": "M49 numeric code of the reporting country (0–999). A partner-only code (0 World, 250 Metropolitan France, 158 Taiwan, Province of China) with no data fails with partner_only_reporter, naming the code to query instead when one exists: 251 shares the ISO-3 identity of 250, and UN Comtrade publishes the trade of 158 under 490 (Other Asia, nes)."
              },
              "classification": {
                "type": "string",
                "default": "HS",
                "description": "Goods classification: HS/H0–H6 or SITC S1–S4/SS."
              }
            },
            "additionalProperties": false
          },
          "outputSchema": {
            "type": "object",
            "anyOf": [
              {
                "not": {
                  "required": [
                    "error"
                  ]
                },
                "required": [
                  "periods",
                  "reporterCode",
                  "reporterDesc",
                  "partnerCode",
                  "partnerDesc",
                  "mirrorCaveat"
                ]
              },
              {
                "required": [
                  "error"
                ]
              }
            ],
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "error": {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "maximum": 9007199254740991,
                    "minimum": -9007199254740991,
                    "description": "JSON-RPC error code for this failure."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "examples": [
                          "keyless_hs_edition_unsupported",
                          "invalid_reporter_filter",
                          "overlapping_cmd_codes",
                          "upstream_validation",
                          "invalid_upstream_response",
                          "no_data",
                          "partner_only_reporter",
                          "rate_limited",
                          "upstream_unavailable",
                          "deadline_exceeded"
                        ],
                        "description": "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. `overlapping_cmd_codes`: Two cmd_code entries return overlapping rows: a code and one of its sub-codes, TOTAL and another entry, or an AG selector and another level. `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. `partner_only_reporter`: No served period has data and the reporter code is partner-only in UN Comtrade reference data. `rate_limited`: No period was served and UN Comtrade rate-limited a flow 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 period had both flows complete within the call's time budget. Other values are possible when a failure originates below the handler."
                      },
                      "recovery": {
                        "type": "object",
                        "required": [
                          "hint"
                        ],
                        "properties": {
                          "hint": {
                            "type": "string"
                          }
                        },
                        "description": "Actionable next step for the caller.",
                        "additionalProperties": {}
                      },
                      "retryable": {
                        "type": "boolean",
                        "description": "Whether retrying may succeed."
                      }
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "description": "Human-readable description of what went wrong."
                  }
                },
                "description": "Present when the call failed. Absent on success.",
                "additionalProperties": {}
              },
              "notice": {
                "type": "string",
                "description": "Period failures, periods without export or import data, possible incompleteness at the preview cap, and commodity edition guidance for missing selectors."
              },
              "periods": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "period"
                  ],
                  "properties": {
                    "note": {
                      "type": "string",
                      "description": "Data note when a flow has no data for this period: export only, import only, or neither."
                    },
                    "period": {
                      "type": "string",
                      "description": "Period (YYYY or YYYYMM)."
                    },
                    "balanceUsd": {
                      "type": "number",
                      "description": "Trade balance in USD: exports minus imports, only when both flows have data for the period. Positive = surplus."
                    },
                    "exportsUsd": {
                      "type": "number",
                      "description": "Total exports value in USD for this period."
                    },
                    "importsUsd": {
                      "type": "number",
                      "description": "Total imports value in USD for this period."
                    },
                    "coverageRatio": {
                      "type": "number",
                      "description": "Export coverage ratio: exports / imports. >1 = surplus, <1 = deficit. Only when both flows have data and imports are above zero."
                    }
                  },
                  "description": "Trade balance values for a single reporting period.",
                  "additionalProperties": false
                },
                "description": "Balance computation per period."
              },
              "cmdCodes": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Commodity codes used in the query (absent when querying all commodities)."
              },
              "partnerCode": {
                "type": "number",
                "description": "M49 partner code used."
              },
              "partnerDesc": {
                "type": "string",
                "description": "Partner name supplied by the returned records, or its numeric code when unavailable."
              },
              "mirrorCaveat": {
                "type": "string",
                "description": "Standard caveat about mirror asymmetry — balance reflects this country's reported values."
              },
              "reporterCode": {
                "type": "number",
                "description": "M49 reporter code used."
              },
              "reporterDesc": {
                "type": "string",
                "description": "Reporter country name."
              },
              "referenceNotice": {
                "type": "string",
                "description": "Reference descriptions unavailable; codes and trade values retained."
              },
              "unservedPeriods": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Periods not served: past the period cap (4 keyless, 12 authenticated) or whose export or import request was rate limited, hit a UN Comtrade server error or network failure, or ran out of time; query them separately."
              },
              "unservedCmdCodes": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Commodity codes beyond the 20-code work cap; query them separately."
              },
              "cmdCodesWithoutRecords": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Served commodity selectors without records in any completed period. Omitted when the result is truncated."
              }
            },
            "additionalProperties": false
          },
          "annotations": {
            "readOnlyHint": true,
            "openWorldHint": true
          }
        },
        {
          "name": "comtrade_get_top_partners",
          "title": "Get Top Trading Partners",
          "description": "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. Takes an HS or SITC code in the selected classification; omit cmd_code to rank partners for total trade.",
          "inputSchema": {
            "type": "object",
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "required": [
              "reporter_code",
              "flow_code",
              "period"
            ],
            "properties": {
              "limit": {
                "type": "integer",
                "default": 10,
                "maximum": 9007199254740991,
                "minimum": 1,
                "description": "Number of top partners to return; totalPartners counts every partner retrieved."
              },
              "period": {
                "type": "string",
                "pattern": "^[0-9]{4}(?:0[1-9]|1[0-2])?$",
                "description": "Single period: annual YYYY or monthly YYYYMM, month 01–12; frequency is inferred."
              },
              "cmd_code": {
                "type": "string",
                "pattern": "^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$",
                "description": "Single goods code in the selected classification: HS (e.g. \"84\", \"8471\") or SITC (e.g. \"071\"). Omit or pass \"TOTAL\" to rank partners for total merchandise trade."
              },
              "flow_code": {
                "type": "string",
                "description": "Trade flow: M=imports, X=exports."
              },
              "reporter_code": {
                "type": "integer",
                "maximum": 999,
                "minimum": 0,
                "description": "M49 numeric code of the reporting country (0–999)."
              },
              "classification": {
                "type": "string",
                "default": "HS",
                "description": "Goods classification: HS as reported, H0–H6 with authenticated access, or SITC S1–S4/SS."
              }
            },
            "additionalProperties": false
          },
          "outputSchema": {
            "type": "object",
            "anyOf": [
              {
                "not": {
                  "required": [
                    "error"
                  ]
                },
                "required": [
                  "partners",
                  "reporterCode",
                  "reporterDesc",
                  "period",
                  "flowCode",
                  "cmdCode",
                  "classification",
                  "totalPartners",
                  "truncated"
                ]
              },
              {
                "required": [
                  "error"
                ]
              }
            ],
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "error": {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "maximum": 9007199254740991,
                    "minimum": -9007199254740991,
                    "description": "JSON-RPC error code for this failure."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "examples": [
                          "keyless_hs_edition_unsupported",
                          "invalid_reporter_filter",
                          "upstream_validation",
                          "invalid_upstream_response",
                          "rate_limited",
                          "upstream_unavailable",
                          "deadline_exceeded"
                        ],
                        "description": "Machine-readable failure mode. Declared by this tool: `keyless_hs_edition_unsupported`: An explicit HS edition H0–H6 requires authenticated 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`: UN Comtrade rate-limited the ranking request through its retries. `upstream_unavailable`: The ranking request hit a UN Comtrade server error or network failure through its retries. `deadline_exceeded`: The ranking request did not complete within the call's time budget. Other values are possible when a failure originates below the handler."
                      },
                      "recovery": {
                        "type": "object",
                        "required": [
                          "hint"
                        ],
                        "properties": {
                          "hint": {
                            "type": "string"
                          }
                        },
                        "description": "Actionable next step for the caller.",
                        "additionalProperties": {}
                      },
                      "retryable": {
                        "type": "boolean",
                        "description": "Whether retrying may succeed."
                      }
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "description": "Human-readable description of what went wrong."
                  }
                },
                "description": "Present when the call failed. Absent on success.",
                "additionalProperties": {}
              },
              "notice": {
                "type": "string",
                "description": "Recovery hint when no data is returned."
              },
              "period": {
                "type": "string",
                "description": "Period queried."
              },
              "cmdCode": {
                "type": "string",
                "description": "Commodity code queried (TOTAL when omitted)."
              },
              "flowCode": {
                "type": "string",
                "description": "Flow direction queried."
              },
              "partners": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "rank",
                    "partnerCode",
                    "partnerDesc"
                  ],
                  "properties": {
                    "rank": {
                      "type": "number",
                      "description": "Rank (1 = largest trade value)."
                    },
                    "partnerCode": {
                      "type": "number",
                      "description": "M49 partner code."
                    },
                    "partnerDesc": {
                      "type": "string",
                      "description": "Partner country/area name."
                    },
                    "sharePercent": {
                      "type": "number",
                      "description": "Share of totalValueUsd across every retrieved partner, as a percentage."
                    },
                    "primaryValueUsd": {
                      "type": "number",
                      "description": "Trade value in USD (FOB for exports, CIF for imports)."
                    }
                  },
                  "description": "A single ranked trading partner entry.",
                  "additionalProperties": false
                },
                "description": "Top partners sorted by descending trade value."
              },
              "truncated": {
                "type": "boolean",
                "description": "True when API returned 500 records and results may be incomplete."
              },
              "reporterCode": {
                "type": "number",
                "description": "M49 reporter code."
              },
              "reporterDesc": {
                "type": "string",
                "description": "Reporter country name."
              },
              "totalPartners": {
                "type": "number",
                "description": "Partners retrieved before the limit, excluding the World (0) aggregate."
              },
              "totalValueUsd": {
                "type": "number",
                "description": "Sum of primary values across all returned partners (before limit truncation)."
              },
              "classification": {
                "type": "string",
                "description": "Goods classification the commodity code was read in."
              },
              "referenceNotice": {
                "type": "string",
                "description": "Reference descriptions unavailable; codes and values retained."
              }
            },
            "additionalProperties": false
          },
          "annotations": {
            "readOnlyHint": true,
            "openWorldHint": true
          }
        },
        {
          "name": "comtrade_get_top_services_partners",
          "title": "Get Top Services Trading Partners",
          "description": "Rank partners of one reporter by trade value for a single annual EBOPS series. Omit service_code for total services, or use comtrade_list_service_categories to find one category. EB serves original reports, while EB10 and EB02 serve converted series. Shares divide by the sum of eligible retrieved partners before the display limit. Read coverageNotice before interpreting the ranking.",
          "inputSchema": {
            "type": "object",
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "required": [
              "reporter_code",
              "flow_code",
              "period"
            ],
            "properties": {
              "limit": {
                "type": "integer",
                "default": 10,
                "maximum": 9007199254740991,
                "minimum": 1,
                "description": "Number of partners to display. Counts and sums precede the display limit."
              },
              "period": {
                "type": "string",
                "pattern": "^[0-9]{4}$",
                "description": "One annual period, YYYY."
              },
              "flow_code": {
                "type": "string",
                "description": "Trade flow: M=imports, X=exports."
              },
              "service_code": {
                "type": "string",
                "pattern": "^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$",
                "description": "One EBOPS service code. Omit or pass blank for total services."
              },
              "reporter_code": {
                "type": "integer",
                "maximum": 999,
                "minimum": 0,
                "description": "M49 numeric code of the reporting area (0–999)."
              },
              "classification": {
                "enum": [
                  "EB",
                  "EB10",
                  "EB02"
                ],
                "type": "string",
                "default": "EB",
                "description": "EB for as-reported data (default), or EB10 or EB02 for UN Comtrade’s converted series."
              }
            },
            "additionalProperties": false
          },
          "outputSchema": {
            "type": "object",
            "anyOf": [
              {
                "not": {
                  "required": [
                    "error"
                  ]
                },
                "required": [
                  "partners",
                  "reporterCode",
                  "reporterDesc",
                  "period",
                  "flowCode",
                  "classification",
                  "totalPartners",
                  "truncated",
                  "coverageNotice"
                ]
              },
              {
                "required": [
                  "error"
                ]
              }
            ],
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "error": {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "maximum": 9007199254740991,
                    "minimum": -9007199254740991,
                    "description": "JSON-RPC error code for this failure."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "examples": [
                          "upstream_validation",
                          "invalid_upstream_response",
                          "rate_limited",
                          "upstream_unavailable",
                          "deadline_exceeded"
                        ],
                        "description": "Machine-readable failure mode. Declared by this tool: `upstream_validation`: UN Comtrade rejects the query dimensions. `invalid_upstream_response`: UN Comtrade returns malformed services data. `rate_limited`: UN Comtrade rate-limits the ranking request through its retries. `upstream_unavailable`: The ranking request hits an upstream server or network failure through its retries. `deadline_exceeded`: The ranking request does not complete within its time budget. Other values are possible when a failure originates below the handler."
                      },
                      "recovery": {
                        "type": "object",
                        "required": [
                          "hint"
                        ],
                        "properties": {
                          "hint": {
                            "type": "string"
                          }
                        },
                        "description": "Actionable next step for the caller.",
                        "additionalProperties": {}
                      },
                      "retryable": {
                        "type": "boolean",
                        "description": "Whether retrying may succeed."
                      }
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "description": "Human-readable description of what went wrong."
                  }
                },
                "description": "Present when the call failed. Absent on success.",
                "additionalProperties": {}
              },
              "notice": {
                "type": "string",
                "description": "Next steps when no services series is selected."
              },
              "period": {
                "type": "string",
                "description": "Annual period queried."
              },
              "flowCode": {
                "type": "string",
                "description": "Trade flow queried."
              },
              "partners": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "partnerCode",
                    "partnerDesc"
                  ],
                  "properties": {
                    "rank": {
                      "type": "number",
                      "description": "Rank when the retrieved series can be ranked."
                    },
                    "partnerCode": {
                      "type": "number",
                      "description": "M49 partner code."
                    },
                    "partnerDesc": {
                      "type": "string",
                      "description": "Partner country or area name."
                    },
                    "sharePercent": {
                      "type": "number",
                      "description": "Percentage of the eligible retrieved partner value."
                    },
                    "primaryValueUsd": {
                      "type": "number",
                      "description": "Reported trade value in USD."
                    }
                  },
                  "description": "One partner in the selected services series.",
                  "additionalProperties": false
                },
                "description": "Retrieved partners, ordered by descending value when available."
              },
              "truncated": {
                "type": "boolean",
                "description": "True when the upstream retrieval was capped or incomplete."
              },
              "serviceCode": {
                "type": "string",
                "description": "Selected service category or scheme total code."
              },
              "reporterCode": {
                "type": "number",
                "description": "M49 code of the reporting area."
              },
              "reporterDesc": {
                "type": "string",
                "description": "Reporting area name."
              },
              "totalPartners": {
                "type": "number",
                "description": "Eligible retrieved partners before the display limit."
              },
              "totalValueUsd": {
                "type": "number",
                "description": "Sum of eligible retrieved partner values before the limit, when all are known."
              },
              "classification": {
                "type": "string",
                "description": "Services classification requested."
              },
              "coverageNotice": {
                "type": "string",
                "description": "Scope of the retrieved data and conditions that prevent ranking."
              },
              "referenceNotice": {
                "type": "string",
                "description": "Reference descriptions unavailable."
              },
              "classificationCode": {
                "type": "string",
                "description": "Actual scheme of the selected series."
              },
              "isOriginalClassification": {
                "type": "boolean",
                "description": "True for an original series, false for a UN Comtrade conversion, when established."
              }
            },
            "additionalProperties": false
          },
          "annotations": {
            "readOnlyHint": true,
            "openWorldHint": true
          }
        },
        {
          "name": "comtrade_get_top_reporters",
          "title": "Get Top Goods Reporters",
          "description": "Rank retrieved reporting areas by reported import or export value for one goods code and period. Partner 0 (World) ranks reporters by their trade with all partners. Use a bilateral partner to rank reporters by their trade with that area. Shares use the retrieved reporting areas before the display limit. Use comtrade_get_top_partners to rank the partners of one reporter.",
          "inputSchema": {
            "type": "object",
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "required": [
              "flow_code",
              "period"
            ],
            "properties": {
              "limit": {
                "type": "integer",
                "default": 10,
                "maximum": 9007199254740991,
                "minimum": 1,
                "description": "Maximum reporting areas displayed. Totals cover all eligible retrieved reporting areas."
              },
              "period": {
                "type": "string",
                "pattern": "^[0-9]{4}(?:0[1-9]|1[0-2])?$",
                "description": "One annual YYYY or monthly YYYYMM period. Frequency is inferred."
              },
              "cmd_code": {
                "type": "string",
                "pattern": "^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$",
                "description": "One commodity code in the selected HS or SITC classification. Omit or pass TOTAL for total merchandise trade."
              },
              "flow_code": {
                "type": "string",
                "description": "Trade flow: M=imports, X=exports."
              },
              "partner_code": {
                "type": "integer",
                "default": 0,
                "maximum": 999,
                "minimum": 0,
                "description": "M49 partner code (0–999). Defaults to World (0)."
              },
              "classification": {
                "type": "string",
                "default": "HS",
                "description": "Goods classification: HS as reported, H0–H6 with authenticated access, or SITC S1–S4/SS."
              }
            },
            "additionalProperties": false
          },
          "outputSchema": {
            "type": "object",
            "anyOf": [
              {
                "not": {
                  "required": [
                    "error"
                  ]
                },
                "required": [
                  "reporters",
                  "partnerCode",
                  "period",
                  "flowCode",
                  "cmdCode",
                  "classification",
                  "totalReporters",
                  "truncated",
                  "coverageNotice"
                ]
              },
              {
                "required": [
                  "error"
                ]
              }
            ],
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "error": {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "maximum": 9007199254740991,
                    "minimum": -9007199254740991,
                    "description": "JSON-RPC error code for this failure."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "examples": [
                          "keyless_hs_edition_unsupported",
                          "upstream_validation",
                          "invalid_upstream_response",
                          "rate_limited",
                          "upstream_unavailable",
                          "deadline_exceeded"
                        ],
                        "description": "Machine-readable failure mode. Declared by this tool: `keyless_hs_edition_unsupported`: An explicit HS edition H0–H6 requires authenticated access. `upstream_validation`: UN Comtrade rejects the query dimensions. `invalid_upstream_response`: UN Comtrade returns malformed trade data. `rate_limited`: UN Comtrade rate-limited the ranking request through its retries. `upstream_unavailable`: The ranking request hit a UN Comtrade server error or network failure through its retries. `deadline_exceeded`: The ranking request did not complete within the call's time budget. Other values are possible when a failure originates below the handler."
                      },
                      "recovery": {
                        "type": "object",
                        "required": [
                          "hint"
                        ],
                        "properties": {
                          "hint": {
                            "type": "string"
                          }
                        },
                        "description": "Actionable next step for the caller.",
                        "additionalProperties": {}
                      },
                      "retryable": {
                        "type": "boolean",
                        "description": "Whether retrying may succeed."
                      }
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "description": "Human-readable description of what went wrong."
                  }
                },
                "description": "Present when the call failed. Absent on success.",
                "additionalProperties": {}
              },
              "period": {
                "type": "string",
                "description": "Period queried."
              },
              "cmdCode": {
                "type": "string",
                "description": "Commodity code queried (TOTAL when omitted)."
              },
              "flowCode": {
                "type": "string",
                "description": "Flow direction queried."
              },
              "reporters": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "reporterCode",
                    "reporterDesc"
                  ],
                  "properties": {
                    "rank": {
                      "type": "number",
                      "description": "Position by value across the eligible retrieved reporting areas, when established."
                    },
                    "reporterCode": {
                      "type": "number",
                      "description": "UN Comtrade reporting area code."
                    },
                    "reporterDesc": {
                      "type": "string",
                      "description": "Reporting area name or code when the name is unavailable."
                    },
                    "sharePercent": {
                      "type": "number",
                      "description": "Percentage of totalValueUsd, when ranks are established and the total is nonzero."
                    },
                    "primaryValueUsd": {
                      "type": "number",
                      "description": "Reported primary trade value in USD, when known."
                    },
                    "referenceCaveat": {
                      "type": "string",
                      "description": "Why the reference catalog could not verify this area as a reporter."
                    }
                  },
                  "description": "One retrieved reporting area and its available trade value and rank.",
                  "additionalProperties": false
                },
                "description": "Retrieved reporting areas sorted by descending known value, then code, with unresolved values last."
              },
              "truncated": {
                "type": "boolean",
                "description": "True when the upstream retrieval may be incomplete due to a detected limit or failed slice. Independent of the display limit."
              },
              "partnerCode": {
                "type": "number",
                "description": "Partner code queried (0 = World)."
              },
              "totalValueUsd": {
                "type": "number",
                "description": "Sum in USD across eligible retrieved reporting areas before the display limit, whether or not retrieval was capped. Omitted for an empty set or any unresolved value."
              },
              "classification": {
                "type": "string",
                "description": "Goods classification queried."
              },
              "coverageNotice": {
                "type": "string",
                "description": "Scope of the retrieved data and any conditions that prevent ranking."
              },
              "totalReporters": {
                "type": "number",
                "description": "Eligible retrieved reporting areas before the display limit."
              },
              "referenceNotice": {
                "type": "string",
                "description": "Reference descriptions unavailable; trade values retained."
              }
            },
            "additionalProperties": false
          },
          "annotations": {
            "readOnlyHint": true,
            "openWorldHint": true
          }
        },
        {
          "name": "comtrade_get_top_commodities",
          "title": "Get Top Trade Commodities",
          "description": "Rank HS chapters (2-digit) or headings (4-digit) by trade value for one reporter, flow, and annual or monthly period. Set parent_code and a deeper aggr_level to rank headings or subheadings within one chapter or heading. The tool uses matching TOTAL to identify the HS edition and queries explicit commodity codes in chunks, subdividing capped chunks. Shares use matching TOTAL or the reported parent value for a drill-down. 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.",
          "inputSchema": {
            "type": "object",
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "required": [
              "reporter_code",
              "flow_code",
              "period"
            ],
            "properties": {
              "limit": {
                "type": "integer",
                "default": 10,
                "maximum": 9007199254740991,
                "minimum": 1,
                "description": "Number of top commodity categories to return; totalCommodities counts every category retrieved."
              },
              "period": {
                "type": "string",
                "pattern": "^[0-9]{4}(?:0[1-9]|1[0-2])?$",
                "description": "Single period: annual (YYYY) or monthly (YYYYMM, month 01–12)."
              },
              "flow_code": {
                "type": "string",
                "description": "Trade flow: M=imports, X=exports."
              },
              "aggr_level": {
                "anyOf": [
                  {
                    "type": "number",
                    "const": 2
                  },
                  {
                    "type": "number",
                    "const": 4
                  },
                  {
                    "type": "number",
                    "const": 6
                  }
                ],
                "default": 2,
                "description": "HS aggregation level: 2 = chapter, 4 = heading, 6 = subheading. Level 6 requires parent_code."
              },
              "parent_code": {
                "type": "string",
                "pattern": "^(?:[0-9]{2}(?:[0-9]{2})?)?$",
                "description": "Two-digit HS chapter or four-digit heading. Supply a deeper aggr_level. Blank is treated as omitted."
              },
              "partner_code": {
                "type": "integer",
                "maximum": 999,
                "minimum": 0,
                "description": "M49 partner code (0–999) for a bilateral relationship; omit for World aggregate (0)."
              },
              "reporter_code": {
                "type": "integer",
                "maximum": 999,
                "minimum": 0,
                "description": "M49 numeric code of the reporting country (0–999)."
              }
            },
            "additionalProperties": false
          },
          "outputSchema": {
            "type": "object",
            "anyOf": [
              {
                "not": {
                  "required": [
                    "error"
                  ]
                },
                "required": [
                  "commodities",
                  "reporterCode",
                  "reporterDesc",
                  "period",
                  "flowCode",
                  "aggrLevel",
                  "totalCommodities",
                  "truncated",
                  "coverageComplete",
                  "coverageNotice",
                  "missingCodes"
                ]
              },
              {
                "required": [
                  "error"
                ]
              }
            ],
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "error": {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "maximum": 9007199254740991,
                    "minimum": -9007199254740991,
                    "description": "JSON-RPC error code for this failure."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "examples": [
                          "keyless_hs_edition_unsupported",
                          "upstream_validation",
                          "invalid_upstream_response",
                          "invalid_reporter_filter",
                          "rate_limited",
                          "upstream_unavailable",
                          "deadline_exceeded"
                        ],
                        "description": "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. `rate_limited`: With TOTAL or the HS reference unavailable, UN Comtrade rate-limited the aggregate fallback through its retries. `upstream_unavailable`: With TOTAL or the HS reference unavailable, the aggregate fallback hit a UN Comtrade server error or network failure through its retries. `deadline_exceeded`: With TOTAL or the HS reference unavailable, the aggregate fallback did not complete within the call's time budget. Other values are possible when a failure originates below the handler."
                      },
                      "recovery": {
                        "type": "object",
                        "required": [
                          "hint"
                        ],
                        "properties": {
                          "hint": {
                            "type": "string"
                          }
                        },
                        "description": "Actionable next step for the caller.",
                        "additionalProperties": {}
                      },
                      "retryable": {
                        "type": "boolean",
                        "description": "Whether retrying may succeed."
                      }
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "description": "Human-readable description of what went wrong."
                  }
                },
                "description": "Present when the call failed. Absent on success.",
                "additionalProperties": {}
              },
              "notice": {
                "type": "string",
                "description": "Recovery hint when no data is 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); or what a residual row holds when it is on the returned page."
              },
              "period": {
                "type": "string",
                "description": "Period queried."
              },
              "flowCode": {
                "type": "string",
                "description": "Flow direction queried."
              },
              "aggrLevel": {
                "type": "number",
                "description": "HS aggregation level used."
              },
              "truncated": {
                "type": "boolean",
                "description": "True when complete commodity-code coverage could not be established."
              },
              "parentCode": {
                "type": "string",
                "description": "HS chapter or heading selected for the drill-down."
              },
              "commodities": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "cmdCode",
                    "cmdDesc",
                    "aggrLevel"
                  ],
                  "properties": {
                    "rank": {
                      "type": "number",
                      "description": "Rank (1 = largest trade value), only with complete code coverage and known values."
                    },
                    "cmdCode": {
                      "type": "string",
                      "description": "HS commodity code."
                    },
                    "cmdDesc": {
                      "type": "string",
                      "description": "Commodity description."
                    },
                    "residual": {
                      "type": "boolean",
                      "description": "True on a catalogued residual code at this level (99, 9999, 999999 or historical 9999AA), ranked and shared like any other row. Absent on every other row."
                    },
                    "aggrLevel": {
                      "type": "number",
                      "description": "HS aggregation level (2, 4, or 6)."
                    },
                    "sharePercent": {
                      "type": "number",
                      "description": "Share of the matching parent or TOTAL trade value, only with complete code coverage."
                    },
                    "primaryValueUsd": {
                      "type": "number",
                      "description": "Trade value in USD (FOB for exports, CIF for imports)."
                    }
                  },
                  "description": "A single ranked commodity entry.",
                  "additionalProperties": false
                },
                "description": "Top commodity categories sorted by descending trade value."
              },
              "missingCodes": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Codes whose retrieval failed, remained capped, or did not fit the call's time budget; empty when the code universe is unavailable."
              },
              "reporterCode": {
                "type": "number",
                "description": "M49 reporter code."
              },
              "reporterDesc": {
                "type": "string",
                "description": "Reporter country name."
              },
              "totalValueUsd": {
                "type": "number",
                "description": "Sum of primary values across all returned categories (before limit)."
              },
              "coverageNotice": {
                "type": "string",
                "description": "Explanation of coverage and ranking availability."
              },
              "coverageComplete": {
                "type": "boolean",
                "description": "Whether complete coverage was established for the matching HS edition and requested scope."
              },
              "totalCommodities": {
                "type": "number",
                "description": "Total commodity categories returned by API."
              },
              "classificationCode": {
                "type": "string",
                "description": "HS edition identified by matching TOTAL."
              },
              "denominatorValueUsd": {
                "type": "number",
                "description": "Matching parent or TOTAL value used as the share denominator, separate from the retrieved-category sum."
              }
            },
            "additionalProperties": false
          },
          "annotations": {
            "readOnlyHint": true,
            "openWorldHint": true
          }
        },
        {
          "name": "comtrade_get_data_availability",
          "title": "Check Data Availability",
          "description": "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.",
          "inputSchema": {
            "type": "object",
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "freq": {
                "type": "string",
                "description": "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."
              },
              "limit": {
                "type": "integer",
                "default": 50,
                "maximum": 9007199254740991,
                "description": "Maximum datasets returned per page; defaults to 50.",
                "exclusiveMinimum": 0
              },
              "offset": {
                "type": "integer",
                "default": 0,
                "maximum": 9007199254740991,
                "minimum": 0,
                "description": "Number of matching datasets to skip; use nextOffset to continue."
              },
              "period": {
                "type": "string",
                "pattern": "^[0-9]{4}(?:0[1-9]|1[0-2])?$",
                "description": "Period to check: YYYY (annual) or YYYYMM (monthly). Omit to see all available periods for the reporter."
              },
              "type_code": {
                "type": "string",
                "default": "C",
                "description": "Trade type: C=commodities (goods), S=services."
              },
              "reporter_code": {
                "type": "integer",
                "maximum": 999,
                "minimum": 0,
                "description": "M49 reporter code to check. Omit to browse availability across all reporters."
              },
              "classification": {
                "type": "string",
                "pattern": "^(?:[A-Z][A-Z0-9]*)?$",
                "description": "Classification code filter (e.g. \"HS\", \"H6\", \"EB10\"). Omitted or blank defaults to HS for goods and EB10 for services."
              }
            },
            "additionalProperties": false
          },
          "outputSchema": {
            "type": "object",
            "anyOf": [
              {
                "not": {
                  "required": [
                    "error"
                  ]
                },
                "required": [
                  "datasets",
                  "totalDatasets",
                  "truncated",
                  "offset",
                  "shown"
                ]
              },
              {
                "required": [
                  "error"
                ]
              }
            ],
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "error": {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "maximum": 9007199254740991,
                    "minimum": -9007199254740991,
                    "description": "JSON-RPC error code for this failure."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "examples": [
                          "upstream_validation",
                          "invalid_upstream_response"
                        ],
                        "description": "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."
                      },
                      "recovery": {
                        "type": "object",
                        "required": [
                          "hint"
                        ],
                        "properties": {
                          "hint": {
                            "type": "string"
                          }
                        },
                        "description": "Actionable next step for the caller.",
                        "additionalProperties": {}
                      },
                      "retryable": {
                        "type": "boolean",
                        "description": "Whether retrying may succeed."
                      }
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "description": "Human-readable description of what went wrong."
                  }
                },
                "description": "Present when the call failed. Absent on success.",
                "additionalProperties": {}
              },
              "shown": {
                "type": "number",
                "description": "Number of datasets returned on this page."
              },
              "notice": {
                "type": "string",
                "description": "Recovery hint when no records match or the offset is past the end."
              },
              "offset": {
                "type": "number",
                "description": "Number of matching datasets skipped for this page."
              },
              "datasets": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "reporterCode",
                    "reporterDesc",
                    "period",
                    "freqCode",
                    "classificationCode",
                    "typeCode"
                  ],
                  "properties": {
                    "period": {
                      "type": "string",
                      "description": "Period (YYYY or YYYYMM)."
                    },
                    "freqCode": {
                      "type": "string",
                      "description": "Frequency: A or M."
                    },
                    "typeCode": {
                      "type": "string",
                      "description": "Trade type: C or S."
                    },
                    "lastReleased": {
                      "type": "string",
                      "description": "Latest release or revision timestamp supplied by UN Comtrade."
                    },
                    "reporterCode": {
                      "type": "number",
                      "description": "M49 reporter code."
                    },
                    "reporterDesc": {
                      "type": "string",
                      "description": "Reporter country name."
                    },
                    "totalRecords": {
                      "type": "number",
                      "description": "Number of records available in this dataset."
                    },
                    "firstReleased": {
                      "type": "string",
                      "description": "First release timestamp supplied by UN Comtrade."
                    },
                    "classificationCode": {
                      "type": "string",
                      "description": "Classification code."
                    }
                  },
                  "description": "A single data availability record.",
                  "additionalProperties": false
                },
                "description": "Available datasets matching the query."
              },
              "truncated": {
                "type": "boolean",
                "description": "Whether this page contains only part of the matching dataset list."
              },
              "nextOffset": {
                "type": "number",
                "description": "Offset for the next page; absent when no rows remain."
              },
              "totalDatasets": {
                "type": "number",
                "description": "Total number of available dataset records."
              }
            },
            "additionalProperties": false
          },
          "annotations": {
            "readOnlyHint": true,
            "openWorldHint": true
          }
        },
        {
          "name": "comtrade_get_services_trade",
          "title": "Get Services Trade Data",
          "description": "Fetch annual international trade-in-services data. Classification EB (default) serves each reporter-period as reported, in its own scheme (EB10, EB10S or EB02 codes); EB10 or EB02 selects UN Comtrade's conversion of other schemes into that one. Each row names its classification and whether it is original or converted. Same bilateral structure as goods trade: returns flow value in USD, period, and reporter/partner/category metadata for each row. Follow nextOffset for remaining records; each page repeats the upstream period requests. Use comtrade_list_service_categories to find a service code and its scheme before querying. Keyless preview makes one request per served period, at least 4 seconds apart, capped at 500 records per request. Services coverage is more limited than goods trade.",
          "inputSchema": {
            "type": "object",
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "required": [
              "reporter_code",
              "flow_code",
              "period"
            ],
            "properties": {
              "limit": {
                "type": "integer",
                "default": 25,
                "minimum": 1,
                "description": "Records per page (default 25). Larger requests are limited to 1000 with a notice."
              },
              "offset": {
                "type": "integer",
                "default": 0,
                "maximum": 9007199254740991,
                "minimum": 0,
                "description": "Number of retrieved records to skip."
              },
              "period": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[0-9]{4}$"
                },
                "maxItems": 120,
                "minItems": 1,
                "description": "Annual periods YYYY. 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."
              },
              "flow_code": {
                "type": "string",
                "description": "Trade flow: M=imports (debits), X=exports (credits)."
              },
              "partner_code": {
                "type": "integer",
                "maximum": 999,
                "minimum": 0,
                "description": "M49 partner code. Use 0 for all partners combined (World). Omitting it can return World alongside the partner breakdown."
              },
              "service_code": {
                "type": "string",
                "pattern": "^(?:[A-Z0-9]+(?:\\.[A-Z0-9]+)*)?$",
                "description": "Service category code in one scheme: \"7\" (EB10), \"SG\" (EB10S) and \"260\" (EB02) are each financial services. Under EB a code returns rows only for periods reported in its scheme; comtrade_list_service_categories lists codes with their schemes. Omit to get every category the reporter reported, at mixed levels: totals (200 for EB10 and EB02, S for EB10S) beside their components, so do not sum the rows."
              },
              "reporter_code": {
                "type": "integer",
                "maximum": 999,
                "minimum": 0,
                "description": "M49 numeric code of the reporting country (0–999)."
              },
              "classification": {
                "enum": [
                  "EB",
                  "EB10",
                  "EB02"
                ],
                "type": "string",
                "default": "EB",
                "description": "Services classification. EB (default): each reporter-period as reported, in its own scheme (EB10, EB10S or EB02 codes). EB10 or EB02: UN Comtrade's conversion of reports from other schemes into that one; reports made in it stay under EB. EB10S has no converted series; its rows are served only under EB. Case-insensitive; blank means EB."
              }
            },
            "additionalProperties": false
          },
          "outputSchema": {
            "type": "object",
            "anyOf": [
              {
                "not": {
                  "required": [
                    "error"
                  ]
                },
                "required": [
                  "records",
                  "totalCount",
                  "offset",
                  "shown",
                  "truncated"
                ]
              },
              {
                "required": [
                  "error"
                ]
              }
            ],
            "$schema": "https://json-schema.org/draft/2020-12/schema",
            "properties": {
              "error": {
                "type": "object",
                "required": [
                  "code",
                  "message"
                ],
                "properties": {
                  "code": {
                    "type": "integer",
                    "maximum": 9007199254740991,
                    "minimum": -9007199254740991,
                    "description": "JSON-RPC error code for this failure."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "reason": {
                        "type": "string",
                        "examples": [
                          "invalid_reporter_filter",
                          "upstream_validation",
                          "invalid_upstream_response",
                          "rate_limited",
                          "upstream_unavailable",
                          "deadline_exceeded"
                        ],
                        "description": "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. `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."
                      },
                      "recovery": {
                        "type": "object",
                        "required": [
                          "hint"
                        ],
                        "properties": {
                          "hint": {
                            "type": "string"
                          }
                        },
                        "description": "Actionable next step for the caller.",
                        "additionalProperties": {}
                      },
                      "retryable": {
                        "type": "boolean",
                        "description": "Whether retrying may succeed."
                      }
                    },
                    "additionalProperties": {}
                  },
                  "message": {
                    "type": "string",
                    "description": "Human-readable description of what went wrong."
                  }
                },
                "description": "Present when the call failed. Absent on success.",
                "additionalProperties": {}
              },
              "shown": {
                "type": "number",
                "description": "Number of records on this page."
              },
              "notice": {
                "type": "string",
                "description": "World overlap warnings, period failures, and guidance for empty results, including EB scheme coverage, ISO-3 counterpart codes, or partner_code 158 for Taiwan services."
              },
              "offset": {
                "type": "number",
                "description": "Number of retrieved records skipped for this page."
              },
              "records": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "reporterCode",
                    "reporterDesc",
                    "partnerCode",
                    "partnerDesc",
                    "flowCode",
                    "cmdCode",
                    "cmdDesc",
                    "period"
                  ],
                  "properties": {
                    "period": {
                      "type": "string",
                      "description": "Annual period YYYY."
                    },
                    "cmdCode": {
                      "type": "string",
                      "description": "EBOPS service category code."
                    },
                    "cmdDesc": {
                      "type": "string",
                      "description": "Service category description."
                    },
                    "flowCode": {
                      "type": "string",
                      "description": "Trade flow: M=imports (debits), X=exports (credits)."
                    },
                    "isReported": {
                      "type": "boolean",
                      "description": "True if directly reported; false if estimated."
                    },
                    "partnerCode": {
                      "type": "number",
                      "description": "M49 partner code."
                    },
                    "partnerDesc": {
                      "type": "string",
                      "description": "Partner country/area name."
                    },
                    "primaryValue": {
                      "type": "number",
                      "description": "Trade value in USD."
                    },
                    "reporterCode": {
                      "type": "number",
                      "description": "M49 reporter code."
                    },
                    "reporterDesc": {
                      "type": "string",
                      "description": "Reporter country/area name."
                    },
                    "classificationCode": {
                      "type": "string",
                      "description": "Actual services classification edition on the returned row."
                    },
                    "isOriginalClassification": {
                      "type": "boolean",
                      "description": "True when the row is in the scheme the reporter used; false when UN Comtrade converted it into the requested classification."
                    }
                  },
                  "description": "A single services trade flow record.",
                  "additionalProperties": false
                },
                "description": "Services trade flow records."
              },
              "truncated": {
                "type": "boolean",
                "description": "True when any preview response reached 500 and may be incomplete."
              },
              "limitClamp": {
                "type": "object",
                "required": [
                  "requested",
                  "applied"
                ],
                "properties": {
                  "applied": {
                    "type": "number",
                    "description": "Applied records per page."
                  },
                  "requested": {
                    "type": "number",
                    "description": "Requested records per page."
                  }
                },
                "description": "Requested and applied page sizes when the limit was clamped.",
                "additionalProperties": false
              },
              "nextOffset": {
                "type": "number",
                "description": "Offset for the next page when more records remain."
              },
              "totalCount": {
                "type": "number",
                "description": "Sum of upstream response counts before local filtering; not a full match count when capped."
              },
              "truncationHint": {
                "type": "string",
                "description": "Query narrowing and authenticated access guidance when possibly incomplete."
              },
              "referenceNotice": {
                "type": "string",
                "description": "Reference descriptions unavailable; codes and values retained."
              },
              "unservedPeriods": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "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."
              }
            },
            "additionalProperties": false
          },
          "annotations": {
            "readOnlyHint": true,
            "openWorldHint": true
          }
        }
      ],
      "tools_omitted": 0,
      "resources": [
        {
          "name": "comtrade-countries",
          "uri": "comtrade://countries",
          "mimeType": "application/json",
          "description": "Complete list of all Comtrade country and area codes — both reporters and partners — with M49 numeric codes, ISO identifiers, validAsReporter flag, group membership, and entity validity dates. Bundled from reference data loaded at startup. Use comtrade_lookup_countries for name-based search; use this resource to enumerate the full list."
        },
        {
          "name": "comtrade-hs-classification-2",
          "uri": "comtrade://hs-classification/2",
          "mimeType": "application/json",
          "description": "Combined HS commodity codes, including historical codes, at chapter level (2-digit), with edition membership when available."
        },
        {
          "name": "comtrade-hs-classification-4",
          "uri": "comtrade://hs-classification/4",
          "mimeType": "application/json",
          "description": "Combined HS commodity codes, including historical codes, at heading level (4-digit), with edition membership when available."
        },
        {
          "name": "comtrade-hs-classification-6",
          "uri": "comtrade://hs-classification/6",
          "mimeType": "application/json",
          "description": "Combined HS commodity codes, including historical codes, at subheading level (6-digit), with edition membership when available."
        },
        {
          "name": "un-comtrade-guide",
          "uri": "skill://un-comtrade-guide/SKILL.md",
          "mimeType": "text/markdown",
          "description": "Use the comtrade_* tools for historical goods and services trade comparisons, partner and commodity rankings, bilateral balances, mirror analysis, and unit values. Resolve classification-specific identifiers and verify coverage before drawing conclusions."
        }
      ],
      "prompts": []
    },
    "instructions": "UN Comtrade international goods and services trade statistics. Resolve country names with comtrade_lookup_countries, goods with comtrade_search_commodities, and services with comtrade_list_service_categories; check comtrade_get_data_availability before interpreting missing data. Reporter and partner identifiers are Comtrade numeric codes, not inferred ISO numbers. Keyless preview uses paced requests with a 500-record cap per upstream response; inspect coverage, truncation, and unserved-input fields such as unservedPeriods before drawing conclusions. Configure COMTRADE_SUBSCRIPTION_KEY for authenticated access subject to subscription limits. Load un-comtrade-guide for historical classifications, complete rankings, bilateral and mirror analysis, and unit-value interpretation."
  },
  "changes": {
    "total": 1,
    "latest": [
      {
        "observed_at": "2026-11-22T21:37:01.904Z",
        "from_sha": "07564b62b64960c949a9d17591eba23ceb978b9ed9baf7cadd818840c6ce475a",
        "to_sha": "944cf88556b406024ec5fe56aa1a6cab5bda3656507dd072d03e58c5b003293b",
        "summary": {
          "tool_added": 11,
          "tool_changed": 13,
          "resource_changed": 4
        },
        "diff": [
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_lookup_countries",
            "path": "/outputSchema/properties/notice/description",
            "after": "Recovery hint when the query has no matches or role and group filters exclude them, or the goods and services codes to query for Taiwan (490 for goods reporter or partner and 158 for services partner).",
            "before": "Recovery hint when no matches are found, or the goods and services codes to query for Taiwan (490 for goods reporter or partner and 158 for services partner)."
          },
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_list_service_categories",
            "path": "/description",
            "after": "List service trade categories from the combined EB catalog, including numeric EBOPS and SDMX codes. Returns category codes, descriptions, parent codes, and the EBOPS scheme catalogs that list each code: EB10 (EBOPS 2010), EB10S (EBOPS 2010 SDMX codes), EB02 (EBOPS 2002). Search by keyword or by several terms in any order, or browse direct children of a parent code; \"200\" lists the EB10 and EB02 top levels. Use the returned id as service_code in comtrade_get_services_trade. Code 3 is transport; SA is manufacturing services. Each page holds up to limit categories; continue with nextOffset using the same query and parent_code.",
            "before": "List service trade categories from the combined EB catalog, including numeric EBOPS and SDMX codes. Returns category codes, descriptions, parent codes, and the EBOPS scheme catalogs that list each code: EB10 (EBOPS 2010), EB10S (EBOPS 2010 SDMX codes), EB02 (EBOPS 2002). Filter by keyword (e.g. \"transport\", \"financial\", \"travel\") or browse direct children of a parent code; \"200\" lists the EB10 and EB02 top levels. Use the returned id as service_code in comtrade_get_services_trade. Code 3 is transport; SA is manufacturing services. Each page holds up to limit categories; continue with nextOffset using the same query and parent_code."
          },
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_list_service_categories",
            "path": "/inputSchema/properties/query/description",
            "after": "Description keyword, phrase, whitespace-separated terms, or category code prefix. Description terms match case-insensitively in any order. Codes compare case-insensitively and keep their dots. Examples: \"transport\", \"SA\", \"3.1\", \"insurance pension\". Omit, or leave blank, to list all EB categories.",
            "before": "Keyword or category code prefix to filter results; codes compare case-insensitively and keep their dots. Examples: \"transport\", \"SA\", \"3.1\", \"financial services\". Omit, or leave blank, to list all EB categories."
          },
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_list_service_categories",
            "path": "/outputSchema/properties/categories/description",
            "after": "EB service categories on this page. With a query, ranked exact code, code prefix, whole-word phrase, other contiguous phrase, then descriptions containing every query term in any order. Ties and unfiltered listings keep catalog order.",
            "before": "EB service categories on this page. With a query, ranked exact code, code prefix, whole-word description match, then other description matches; ties, and an unfiltered listing, keep catalog order."
          },
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_get_trade_flows",
            "path": "/description",
            "after": "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.",
            "before": "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. 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."
          },
          {
            "op": "added",
            "kind": "tool",
            "name": "comtrade_get_trade_flows",
            "path": "/inputSchema/properties/limit",
            "after": {
              "type": "integer",
              "default": 25,
              "minimum": 1,
              "description": "Records per page (default 25). Larger requests are limited to 1000 with a notice."
            }
          },
          {
            "op": "added",
            "kind": "tool",
            "name": "comtrade_get_trade_flows",
            "path": "/inputSchema/properties/offset",
            "after": {
              "type": "integer",
              "default": 0,
              "maximum": 9007199254740991,
              "minimum": 0,
              "description": "Number of retrieved records to skip."
            }
          },
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_get_trade_flows",
            "path": "/outputSchema/anyOf/0/required",
            "after": [
              "records",
              "totalCount",
              "offset",
              "shown",
              "truncated"
            ],
            "before": [
              "records",
              "totalCount",
              "shown",
              "truncated"
            ]
          },
          {
            "op": "added",
            "kind": "tool",
            "name": "comtrade_get_trade_flows",
            "path": "/outputSchema/properties/limitClamp",
            "after": {
              "type": "object",
              "required": [
                "requested",
                "applied"
              ],
              "properties": {
                "applied": {
                  "type": "number",
                  "description": "Applied records per page."
                },
                "requested": {
                  "type": "number",
                  "description": "Requested records per page."
                }
              },
              "description": "Requested and applied page sizes when the limit was clamped.",
              "additionalProperties": false
            }
          },
          {
            "op": "added",
            "kind": "tool",
            "name": "comtrade_get_trade_flows",
            "path": "/outputSchema/properties/nextOffset",
            "after": {
              "type": "number",
              "description": "Offset for the next page when more records remain."
            }
          },
          {
            "op": "added",
            "kind": "tool",
            "name": "comtrade_get_trade_flows",
            "path": "/outputSchema/properties/offset",
            "after": {
              "type": "number",
              "description": "Number of retrieved records skipped for this page."
            }
          },
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_get_trade_flows",
            "path": "/outputSchema/properties/records/items/properties/altQtyUnitCode/description",
            "after": "Alternate unit code; omitted when -1 and alternate quantity is absent.",
            "before": "Alternate quantity unit code."
          },
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_get_trade_flows",
            "path": "/outputSchema/properties/records/items/properties/qtyUnitCode/description",
            "after": "Quantity unit code; omitted when -1 and quantity is absent.",
            "before": "Quantity unit code; -1 means unavailable."
          },
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_get_trade_flows",
            "path": "/outputSchema/properties/shown/description",
            "after": "Number of records on this page.",
            "before": "Number of records returned in this response."
          },
          {
            "op": "added",
            "kind": "tool",
            "name": "comtrade_get_top_services_partners",
            "path": "",
            "after": {
              "chars": 5297,
              "truncated": true
            }
          },
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_get_data_availability",
            "path": "/description",
            "after": "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.",
            "before": "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."
          },
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_get_services_trade",
            "path": "/description",
            "after": "Fetch annual international trade-in-services data. Classification EB (default) serves each reporter-period as reported, in its own scheme (EB10, EB10S or EB02 codes); EB10 or EB02 selects UN Comtrade's conversion of other schemes into that one. Each row names its classification and whether it is original or converted. Same bilateral structure as goods trade: returns flow value in USD, period, and reporter/partner/category metadata for each row. Follow nextOffset for remaining records; each page repeats the upstream period requests. Use comtrade_list_service_categories to find a service code and its scheme before querying. Keyless preview makes one request per served period, at least 4 seconds apart, capped at 500 records per request. Services coverage is more limited than goods trade.",
            "before": "Fetch annual international trade-in-services data. Classification EB (default) serves each reporter-period as reported, in its own scheme (EB10, EB10S or EB02 codes); EB10 or EB02 selects UN Comtrade's conversion of other schemes into that one. Each row names its classification and whether it is original or converted. 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 a service code and its scheme before querying. Keyless preview makes one request per served period, at least 4 seconds apart, capped at 500 records per request. Services coverage is more limited than goods trade."
          },
          {
            "op": "added",
            "kind": "tool",
            "name": "comtrade_get_services_trade",
            "path": "/inputSchema/properties/limit",
            "after": {
              "type": "integer",
              "default": 25,
              "minimum": 1,
              "description": "Records per page (default 25). Larger requests are limited to 1000 with a notice."
            }
          },
          {
            "op": "added",
            "kind": "tool",
            "name": "comtrade_get_services_trade",
            "path": "/inputSchema/properties/offset",
            "after": {
              "type": "integer",
              "default": 0,
              "maximum": 9007199254740991,
              "minimum": 0,
              "description": "Number of retrieved records to skip."
            }
          },
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_get_services_trade",
            "path": "/outputSchema/anyOf/0/required",
            "after": [
              "records",
              "totalCount",
              "offset",
              "shown",
              "truncated"
            ],
            "before": [
              "records",
              "totalCount",
              "shown",
              "truncated"
            ]
          },
          {
            "op": "added",
            "kind": "tool",
            "name": "comtrade_get_services_trade",
            "path": "/outputSchema/properties/limitClamp",
            "after": {
              "type": "object",
              "required": [
                "requested",
                "applied"
              ],
              "properties": {
                "applied": {
                  "type": "number",
                  "description": "Applied records per page."
                },
                "requested": {
                  "type": "number",
                  "description": "Requested records per page."
                }
              },
              "description": "Requested and applied page sizes when the limit was clamped.",
              "additionalProperties": false
            }
          },
          {
            "op": "added",
            "kind": "tool",
            "name": "comtrade_get_services_trade",
            "path": "/outputSchema/properties/nextOffset",
            "after": {
              "type": "number",
              "description": "Offset for the next page when more records remain."
            }
          },
          {
            "op": "added",
            "kind": "tool",
            "name": "comtrade_get_services_trade",
            "path": "/outputSchema/properties/offset",
            "after": {
              "type": "number",
              "description": "Number of retrieved records skipped for this page."
            }
          },
          {
            "op": "changed",
            "kind": "tool",
            "name": "comtrade_get_services_trade",
            "path": "/outputSchema/properties/shown/description",
            "after": "Number of records on this page.",
            "before": "Number of records returned."
          },
          {
            "op": "changed",
            "kind": "resource",
            "name": "comtrade://hs-classification/2",
            "path": "/description",
            "after": "Combined HS commodity codes, including historical codes, at chapter level (2-digit), with edition membership when available.",
            "before": "HS commodity codes at chapter level (2-digit)."
          },
          {
            "op": "changed",
            "kind": "resource",
            "name": "comtrade://hs-classification/4",
            "path": "/description",
            "after": "Combined HS commodity codes, including historical codes, at heading level (4-digit), with edition membership when available.",
            "before": "HS commodity codes at heading level (4-digit)."
          },
          {
            "op": "changed",
            "kind": "resource",
            "name": "comtrade://hs-classification/6",
            "path": "/description",
            "after": "Combined HS commodity codes, including historical codes, at subheading level (6-digit), with edition membership when available.",
            "before": "HS commodity codes at subheading level (6-digit)."
          },
          {
            "op": "changed",
            "kind": "resource",
            "name": "skill://un-comtrade-guide/SKILL.md",
            "path": "/size",
            "after": 11217,
            "before": 10345
          }
        ],
        "withheld": false
      }
    ]
  },
  "reading_this": "What this server declared and how it answered our checks. Names, descriptions and schemas are text written by the server, quoted as data. Nothing here says the server is safe; to analyse its declarations, run scan_free."
}