Skip to main content
Glama

faostat_list_codes

Read-onlyIdempotent

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

NameRequiredDescriptionDefault
langNoLanguage of the labels: ``"en"`` (the default), ``"fr"`` or ``"es"``.en
offsetNoRows 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.
searchNoText to look for in the code or the label, ignoring case, e.g. ``"united"``, ``"231"`` or ``"2001"``; ``None`` lists every code.
show_listsNo``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_codeYesThe 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_idYesA 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.0

TDQS

A4.5/5.0
Behavior5/5

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

Adds substantial behavior beyond the annotations: response caching for a day, the upstream 500-with-no-body error mapped to NotFoundError plus a closest-match fallback against domains/dimensions, and a full retry/auth budget (up to four tries each, twelve requests max, login on missing token, re-login on 401/403). The openWorldHint is fleshed out with concrete failure and recovery semantics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

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

Purpose is front-loaded in the first sentence and every subsequent sentence carries information. The retry/login sentence is dense and slightly run-on ('those two, each tried up to four times, twelve requests at most'), which costs a point on readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only list tool with 100% schema coverage and rich annotations, the description covers identity lookup, filtering, list handling, caching, errors, and retries. It does not state the shape of the returned codes/labels, though pagination behavior is covered via the offset parameter documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3, but the description adds real meaning: that year3 codes are one per middle year ('20013' means 2001 within 2000-2002) rather than what rows print, and that codes ending in '>' represent nested lists excluded by show_lists=False. These details are not recoverable from the schema alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource — 'List the codes of one dimension of any FAOSTAT dataset' — and immediately defines what those codes are ('the values its filter takes'). It also implicitly separates itself from list_dimensions/list_domains by explaining that dimension_id comes from those tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description makes the use case concrete: retrieve filter values for a dimension, narrowed by 'search', with 'show_lists' controlling whether list-codes appear and 'offset' for paging. It does not explicitly say when to prefer this over faostat_get_data, but the retrieval-of-filter-values framing is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.