faostat_get_series
Retrieves yearly FAOSTAT series for a dataset across a chosen year range, filtering by area, item, element, and other dimensions.
Instructions
Get a FAOSTAT dataset's yearly series over a year range, filtered as get_data filters.
One get_data request with the years since to until as its filter: year, or for FS, which has year3, the codes of its year3 list whose middle year is in the range. With since and until it reads the dataset's structure first, and FS's year3 list, each kept for a day; a dataset with neither year nor year3 refuses them. Without either, every year comes. Give both or neither: one alone, or since after until, is refused before any request. Rows keep upstream's order, area, item, year ascending. Codes are checked and meta is built as get_data does, with since and until in meta.request; a range without a year of the dataset is refused. A call sends at most twelve requests (structure, year3 list, code lists, data, release date), each tried up to four times, 48 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>"
},
"name": "faostat_get_series"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| area | No | The area's code, FAO's, as ``list_codes(domain_code, "area")`` lists it, e.g. ``"231"`` (United States of America), or several, ``["231", "79"]``; ``None`` where the dataset has no area or every area is wanted. | |
| item | No | The item's code, as ``list_codes(domain_code, "item")`` lists it, e.g. ``"15"`` (Wheat), or several, ``["15", "56"]``; ``None`` likewise. | |
| lang | No | Language of the labels and the headers: ``"en"`` (the default), ``"fr"`` or ``"es"``. | en |
| since | No | The first year, included, e.g. ``2015``; with ``until``. ``None`` with ``until`` ``None`` asks for every year the domain holds. | |
| until | No | The last year, included, e.g. ``2021``; with ``since``. ``list_domains`` prints each domain's latest year as ``year_current`` (``"2024"`` for QCL in its recording). | |
| element | No | The element's filter code, as ``list_codes(domain_code, "element")`` lists it, e.g. ``"2510"`` (Production Quantity in QCL), which answers rows whose ``element_code`` is ``"5510"`` (Production); ``5510`` is refused naming ``2510``. Or several, ``["2510", "2312"]``; ``None`` likewise. | |
| filters | No | Any other dimension's codes by its id, as ``get_data`` takes them, e.g. ``{"reporterarea": "231", "partnerarea": "110"}`` for TM; ``year``, ``year3``, ``since`` and ``until`` are refused, the years being ``since`` and ``until``'s. | |
| domain_code | Yes | The domain's code, as ``list_domains`` lists it, e.g. ``"QCL"`` (Crops and livestock products), ``"PP"`` (Producer Prices) or ``"FS"`` (Suite of Food Security Indicators); one FAOSTAT does not have raises ``NotFoundError``, and an empty text, ``"."`` or ``".."`` is refused before sending. |