Data source: FAOSTAT API
https://context.gnist.ai/mcp/faostat/
AuthenticationAll requests require a Gnist-API-Key header (or api_key query parameter).
Free tier: 100 calls/day. Get your API key.
Tools (7)
search_datasetslist_datasetsget_domain_dimensionsget_dimension_codesget_datacompare_countriesreport_feedback
search_datasetsSearch the FAOSTAT dataset catalog by keyword.
Search across all FAO domains for datasets matching your query.
FAOSTAT covers crop production, livestock, trade, prices, food
security, land use, fertilizers, emissions, and more for 193+ countries.
Args:
query: Search term (e.g. "wheat", "rice", "food prices").
limit: Number of results to return (1-50, default 20).
Returns:
Matching datasets with domain codes needed for get_data calls.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | required | Search term for FAOSTAT datasets (e.g. "wheat", "rice production", "food prices", "fertilizer", "livestock"). |
limit | integer | optional | Number of results to return (1-50, default 20). (default: 20) |
{
"jsonrpc": "2.0",
"method": "tools/call",
"id": 1,
"params": {
"name": "search_datasets",
"arguments": {
"query": "example"
}
}
}list_datasetsList available FAOSTAT dataset groups and domains.
Browse the full FAOSTAT catalog organized by topic group. Use this
to discover available domains before querying data. Key groups:
Production (QCL, QI, QV), Trade (TCL, TM), Prices (PP, CP),
Food Security (FS), Food Balances (FBS), Emissions (GT, GCE).
Args:
group: Optional group name filter. Omit to list all datasets.
limit: Maximum datasets to return (1-200, default 50).
Returns:
List of datasets with group and domain codes.
| Parameter | Type | Required | Description |
|---|---|---|---|
group | any | optional | Optional group filter (e.g. "Production", "Trade", "Prices", "Food Security", "Emissions"). Omit to list all. |
limit | integer | optional | Maximum datasets to return (1-200, default 50). (default: 50) |
{
"jsonrpc": "2.0",
"method": "tools/call",
"id": 1,
"params": {
"name": "list_datasets",
"arguments": {}
}
}get_domain_dimensionsGet available dimensions and filter options for a FAOSTAT domain.
Shows what filters (area, element, item, year) are available for
a dataset, so you know what parameters to pass to get_data.
Use get_dimension_codes to see the valid values for each dimension.
Args:
domain: FAOSTAT domain code from list_datasets.
Returns:
List of dimensions with IDs and labels.
| Parameter | Type | Required | Description |
|---|---|---|---|
domain | string | required | FAOSTAT domain code (e.g. "QCL" for crops, "TCL" for trade, "PP" for prices, "FS" for food security). Use list_datasets to find codes. |
{
"jsonrpc": "2.0",
"method": "tools/call",
"id": 1,
"params": {
"name": "get_domain_dimensions",
"arguments": {
"domain": "example"
}
}
}get_dimension_codesGet valid codes for a specific dimension of a FAOSTAT domain.
Look up what area codes, element codes, item codes, or year values
are valid for a domain. Use these codes in get_data filters.
Common area codes: 231 (USA), 351 (China), 100 (India), 5000 (World).
Common element codes vary by domain (e.g. 2510=Production quantity).
Args:
domain: FAOSTAT domain code.
dimension: Dimension name (area, element, item, year, etc.).
limit: Maximum codes to return (1-500, default 100).
Returns:
List of valid codes with labels and descriptions.
| Parameter | Type | Required | Description |
|---|---|---|---|
domain | string | required | FAOSTAT domain code (e.g. "QCL", "TCL", "PP"). |
dimension | string | required | Dimension name (e.g. "area" for countries, "element" for indicators, "item" for commodities, "year" for time periods). |
limit | integer | optional | Maximum codes to return (1-500, default 100). (default: 100) |
{
"jsonrpc": "2.0",
"method": "tools/call",
"id": 1,
"params": {
"name": "get_dimension_codes",
"arguments": {
"domain": "example",
"dimension": "example"
}
}
}get_dataFetch data from a FAOSTAT domain.
Query any FAOSTAT dataset filtered by area (country/region),
element (indicator), item (commodity), and year. Covers production,
trade, prices, food security, land use, emissions, and more
for 193+ countries from 1961 to present.
Args:
domain: FAOSTAT domain code. Use list_datasets to find codes.
areas: FAO area codes. Omit for all areas.
elements: Element codes for indicator type.
items: Item codes for commodities.
years: Year values.
area_cs: Area coding system (M49, FAO, ISO2, ISO3).
limit: Maximum records to return (1-2000, default 500).
Returns:
Data records with area, element, item, year, value, unit, and flags.
| Parameter | Type | Required | Description |
|---|---|---|---|
domain | string | required | FAOSTAT domain code (e.g. "QCL" for crops/livestock, "TCL" for trade, "PP" for producer prices, "FS" for food security, "FBS" for food balances). Use list_datasets to find codes. |
areas | any | optional | FAO area codes (e.g. ["231", "351", "5000"] for USA, China, World). Use get_dimension_codes to find codes. Omit for all areas. |
elements | any | optional | Element codes for the indicator type (e.g. ["2510"] for production quantity, ["2610"] for import quantity). Use get_dimension_codes to find valid codes. |
items | any | optional | Item codes for commodities (e.g. ["15"] for wheat, ["27"] for rice). Use get_dimension_codes to find valid codes. |
years | any | optional | Year values (e.g. ["2020", "2021", "2022"]). Omit for all available years. |
area_cs | any | optional | Area coding system: "M49" (default), "FAO", "ISO2", or "ISO3". |
limit | integer | optional | Maximum records to return (1-2000, default 500). (default: 500) |
{
"jsonrpc": "2.0",
"method": "tools/call",
"id": 1,
"params": {
"name": "get_data",
"arguments": {
"domain": "example"
}
}
}compare_countriesCompare data across countries/regions for a FAOSTAT domain.
Fetches the same indicator for multiple areas side by side.
Useful for cross-country analysis of production, trade volumes,
food prices, food security metrics, and more.
Args:
domain: FAOSTAT domain code.
area_codes: FAO area codes to compare. Maximum 20.
elements: Element codes to filter by.
items: Item codes to filter by.
years: Year values to filter by.
area_cs: Area coding system.
Returns:
Data grouped by area for easy comparison.
| Parameter | Type | Required | Description |
|---|---|---|---|
domain | string | required | FAOSTAT domain code (e.g. "QCL", "FS", "PP"). |
area_codes | list[string] | required | FAO area codes to compare (e.g. ["231", "351", "100"] for USA, China, India). Maximum 20. |
elements | any | optional | Element codes to filter by. |
items | any | optional | Item codes to filter by. |
years | any | optional | Year values to filter by. |
area_cs | any | optional | Area coding system: "M49", "FAO", "ISO2", or "ISO3". |
{
"jsonrpc": "2.0",
"method": "tools/call",
"id": 1,
"params": {
"name": "compare_countries",
"arguments": {
"domain": "example",
"area_codes": [
"example"
]
}
}
}report_feedbackReport a bug, feature request, or general feedback for this data source.
Use this when something doesn't work as expected, when you'd like
a new feature, or when you have suggestions for improvement.
Args:
feedback: Describe the issue or suggestion.
feedback_type: One of 'bug', 'feature_request', or 'general'.
| Parameter | Type | Required | Description |
|---|---|---|---|
feedback | string | required | |
feedback_type | string | optional | (default: "general") |
{
"jsonrpc": "2.0",
"method": "tools/call",
"id": 1,
"params": {
"name": "report_feedback",
"arguments": {
"feedback": "example"
}
}
}Quick Start
curl -X POST "https://context.gnist.ai/mcp/faostat/" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Gnist-API-Key: YOUR_API_KEY" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "search_datasets", "arguments": {"query": "example"}}}'
import httpx
resp = httpx.post(
"https://context.gnist.ai/mcp/faostat/",
headers={"Gnist-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
json={
"jsonrpc": "2.0",
"method": "tools/call",
"id": 1,
"params": {
"name": "search_datasets",
"arguments": {
"query": "example"
}
}
},
)
print(resp.json())