Skip to main content
Glama

faostat_get_codes

Retrieve filter codes for a dimension in a domain, essential before fetching data. Note: element codes differ from display codes—use these for accurate filtering.

Instructions

Get the list of available FILTER codes for a specific dimension in a domain. You MUST call this before faostat_get_data to get the correct codes for filtering.

IMPORTANT: For the 'element' dimension, filter codes differ from the display codes shown in data responses. For example in QCL, faostat_get_codes returns filter code '2510' for Production, but the data response shows '5510' in the Element Code column. Always use the codes from this tool when filtering.

Args: dimension_id: Dimension identifier (e.g. 'area', 'item', 'element', 'year') domain_code: Domain code (e.g. 'QCL', 'TM', 'FS') lang: Language code (default: 'en') limit: Maximum number of codes to return (default: 0 = no limit). Useful for large dimensions like 'item' which can have 1000+ entries.

Examples: faostat_get_codes(dimension_id='element', domain_code='QCL') → Returns element filter codes: 2510=Production, 2312=Area harvested, etc.

faostat_get_codes(dimension_id='area', domain_code='QCL')
→ Returns country/area codes: 2=Afghanistan, 3=Albania, etc.

TIP: To find a code by name (e.g. 'production', 'wheat', 'Nigeria'), use faostat_search_codes instead — it returns filtered results and signals whether the match is unambiguous before you proceed to faostat_get_data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dimension_idYes
domain_codeYes
langNoen
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations, the description carries full burden. It discloses a crucial quirk (filter codes vs display codes for 'element') and explains the limit parameter's default behavior. It does not mention idempotency or rate limits, but covers key behavioral aspects thoroughly.

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?

The description is well-structured into sections (main purpose, important note, args, examples, tip). Every sentence adds value, but it is slightly lengthy. However, given the complexity (quirks and parameter details), the length is justified.

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

Completeness5/5

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

Given the output schema existence, the description covers all necessary aspects: parameter details, usage prerequisites, behavioral nuances, and examples. It anticipates common pitfalls and guides the agent effectively.

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

Parameters5/5

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

Schema coverage is 0%, so the description must compensate. It explains all four parameters: dimension_id, domain_code, lang (with default), and limit (with default and example usage for large dimensions). Examples further clarify usage.

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?

The description clearly states it retrieves filter codes for a dimension in a domain, using a specific verb ('get') and resource ('codes'). It distinguishes itself from sibling tools by explicitly contrasting with faostat_get_data and faostat_search_codes.

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

Usage Guidelines5/5

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

It explicitly says 'You MUST call this before faostat_get_data' and provides a TIP directing to faostat_search_codes for name-based searches. It also clarifies when to use which tool and the importance of using correct codes.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/berba-q/faostat-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server