comtrade_get_data_availability
Check which UN Comtrade datasets cover a query per reporter and period, returning record counts and release dates. Validate availability and publication windows before requesting trade data.
Instructions
List the UN Comtrade datasets a query covers, per reporter and period, with release dates.
Upstream's getDa: which reporters have published data for which periods, in which
classification, how many records each dataset holds and when it was first and last
released (first_released, last_released, naive datetimes as upstream sends
them). One call. A period nobody reported returns an empty list. Arguments are checked
before the call; an unknown reporter code raises UnknownCode, an
InvalidRequestError naming the packaged list and the closest area, another
mistake InvalidRequestError naming the closest valid value.
Args:
type_code: "C" goods or "S" services.
freq_code: "A" annual or "M" monthly.
cl_code: Classification: "HS" for the data as reported (Switzerland 2023 is
an "H6" dataset), an HS edition "H0" to "H6", SITC "S1" to
"S4", "BE", for services "EB", "EB02", "EB10".
reporter_code: Reporters, comma-separated, as list_reporters lists them:
"757" Switzerland, "842" USA, "276" Germany, "156" China,
"757,842". Omit for every reporter (169 datasets for 2023, annual HS).
period: Years "2023" or months "202305", comma-separated, e.g.
"2021,2022,2023"; unlike get_data, more than 12 are accepted.
published_date_from: Upstream's publishedDateFrom, a day "2024-01-01":
datasets published from then on. A dataset revised in the range counts
(Switzerland 2022, first released 2023-02-01, revised 2024-04-29, is in 2024).
published_date_to: Upstream's publishedDateTo, a day "2024-12-31".
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"type_code": "<type_code>",
"freq_code": "<freq_code>",
"cl_code": "<cl_code>"
},
"name": "comtrade_get_data_availability"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| period | No | ||
| cl_code | Yes | ||
| freq_code | Yes | ||
| type_code | Yes | ||
| reporter_code | No | ||
| published_date_to | No | ||
| published_date_from | No |