faostat_list_codes
Lists the valid codes and labels for one dimension of a FAOSTAT dataset, so you can find the exact filter values a query accepts. Supports case-insensitive search across codes and labels.
Instructions
List the codes of one dimension of any FAOSTAT dataset, the values its filter takes.
One request to getCodeList, kept for a day, filtered by search over code and label. dimension_id is a dimension's or a part's id as list_dimensions names it; FS's year3 codes are one per middle year ("20013", 2001 / 2000-2002), not those the rows print. A code ending ">" lists others (5000> World > (List)); show_lists=False leaves those out. FAOSTAT answers an unknown dataset, an unknown dimension and one the dataset lacks alike, with HTTP 500 and no body, which raises NotFoundError; the list of domains and the dataset's structure are then read, and a dataset or dimension they lack is named with the closest. A call sends the code list and, after that answer, those two, each tried up to four times, twelve requests at most, a login where the process holds no token, and a login and the request again where FAOSTAT refuses with 401 or 403.
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": {
"domain_code": "<domain_code>",
"dimension_id": "<dimension_id>"
},
"name": "faostat_list_codes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lang | No | Language of the labels: ``"en"`` (the default), ``"fr"`` or ``"es"``. | en |
| offset | No | Rows of the answer already shown, to skip: the note of a cut answer names the next offset. 0, the default, starts at the first row. | |
| search | No | Text to look for in the code or the label, ignoring case, e.g. ``"united"``, ``"231"`` or ``"2001"``; ``None`` lists every code. | |
| show_lists | No | ``True``, upstream's default, lists the codes that stand for a list of others too, those ending ``>``; ``False`` sends ``show_lists=false``, which leaves them out. | |
| domain_code | Yes | The dataset's code, as ``list_domains`` lists it, e.g. ``"QCL"`` (Crops and livestock products), ``"MDDW"`` (Minimum Dietary Diversity for Women) or ``"FS"`` (Suite of Food Security Indicators). An empty text, ``"."`` or ``".."`` is refused before sending. | |
| dimension_id | Yes | A dimension's id or a part's, as ``list_dimensions`` lists them, e.g. ``"area"``, ``"countries"``, ``"year"``, ``"month"`` in PP, ``"survey"`` in MDDW or ``"year3"`` in FS; an empty text, ``"."`` or ``".."`` is refused before sending. |