GnistAI GnistAI
Log in

FAOSTAT (FAO Food & Agriculture)

FAO food and agriculture statistics — crop production, livestock, trade, prices, food security, land use, fertilizers, and emissions data for 193+ countries from 1961 to present.

Overview   |   MCP Docs   |   API Docs   |   OpenAPI   |   Playground   |   Tutorial   |   Toolkits   |   Home
status: healthy status status healthy healthy tools: 7 tools tools 7 7 Economics

Data source: FAOSTAT API

MCP MCP Protocol

Endpoint https://context.gnist.ai/mcp/faostat/
claude_desktop_config.json
{
  "mcpServers": {
    "gnist-faostat": {
      "url": "https://context.gnist.ai/mcp/faostat/",
      "headers": {
        "Gnist-API-Key": "YOUR_API_KEY"
      }
    }
  }
}
Shell
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"}}}'

API REST API

API Root https://context.gnist.ai/rest/faostat/

7 endpoints available:

Shell
curl "https://context.gnist.ai/rest/faostat/search_datasets?query=example" \
  -H "Gnist-API-Key: YOUR_API_KEY"
Python
import httpx

resp = httpx.get(
    "https://context.gnist.ai/rest/faostat/search_datasets",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    params={
        "query": "example"
},
)
print(resp.json())

OpenAPI Spec  ·  Full API Docs

CLI Command Line

Command gc faostat

CLI documentation will be available when the GnistAI SDK is published.

Install
pip install gnistai

Available Tools (7)

search_datasets
Search the FAOSTAT dataset catalog by keyword.
ParameterTypeRequiredDescription
querystringrequiredSearch term for FAOSTAT datasets (e.g. "wheat", "rice production", "food prices", "fertilizer", "livestock").
limitintegeroptionalNumber of results to return (1-50, default 20). (default: 20)
list_datasets
List available FAOSTAT dataset groups and domains.
ParameterTypeRequiredDescription
groupanyoptionalOptional group filter (e.g. "Production", "Trade", "Prices", "Food Security", "Emissions"). Omit to list all.
limitintegeroptionalMaximum datasets to return (1-200, default 50). (default: 50)
get_domain_dimensions
Get available dimensions and filter options for a FAOSTAT domain.
ParameterTypeRequiredDescription
domainstringrequiredFAOSTAT domain code (e.g. "QCL" for crops, "TCL" for trade, "PP" for prices, "FS" for food security). Use list_datasets to find codes.
get_dimension_codes
Get valid codes for a specific dimension of a FAOSTAT domain.
ParameterTypeRequiredDescription
domainstringrequiredFAOSTAT domain code (e.g. "QCL", "TCL", "PP").
dimensionstringrequiredDimension name (e.g. "area" for countries, "element" for indicators, "item" for commodities, "year" for time periods).
limitintegeroptionalMaximum codes to return (1-500, default 100). (default: 100)
get_data
Fetch data from a FAOSTAT domain.
ParameterTypeRequiredDescription
domainstringrequiredFAOSTAT 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.
areasanyoptionalFAO area codes (e.g. ["231", "351", "5000"] for USA, China, World). Use get_dimension_codes to find codes. Omit for all areas.
elementsanyoptionalElement codes for the indicator type (e.g. ["2510"] for production quantity, ["2610"] for import quantity). Use get_dimension_codes to find valid codes.
itemsanyoptionalItem codes for commodities (e.g. ["15"] for wheat, ["27"] for rice). Use get_dimension_codes to find valid codes.
yearsanyoptionalYear values (e.g. ["2020", "2021", "2022"]). Omit for all available years.
area_csanyoptionalArea coding system: "M49" (default), "FAO", "ISO2", or "ISO3".
limitintegeroptionalMaximum records to return (1-2000, default 500). (default: 500)
compare_countries
Compare data across countries/regions for a FAOSTAT domain.
ParameterTypeRequiredDescription
domainstringrequiredFAOSTAT domain code (e.g. "QCL", "FS", "PP").
area_codeslist[string]requiredFAO area codes to compare (e.g. ["231", "351", "100"] for USA, China, India). Maximum 20.
elementsanyoptionalElement codes to filter by.
itemsanyoptionalItem codes to filter by.
yearsanyoptionalYear values to filter by.
area_csanyoptionalArea coding system: "M49", "FAO", "ISO2", or "ISO3".
report_feedback
Report a bug, feature request, or general feedback for this data source.
ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: "general")

Related