GnistAI GnistAI
Log in

Getting Started with OECD Statistics

OECD economic statistics — GDP, trade, education, health, labour, and environment data across 38+ member economies.

All Tutorials   |   Overview   |   Playground   |   MCP   |   REST API   |   Home
Economics

Data source: OECD SDMX REST API

Overview

OECD Statistics wraps OECD SDMX REST API, handling authentication, pagination, and rate limits for you. This tutorial covers all 6 tools with working code examples you can copy and run.

Prerequisites

  1. Sign up at https://context.gnist.ai/signup for a free API key (100 calls/day).
  2. Choose your integration method: MCP protocol or REST API.

Connect via MCP

Add to your MCP client config (Claude Desktop, Cursor, etc.):

MCP Config
{
  "mcpServers": {
    "gnist-oecd": {
      "url": "https://context.gnist.ai/mcp/oecd/",
      "headers": {
        "Gnist-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Tools (6)

search_datasets

Search the OECD dataset catalog by keyword. Returns matching datasets with their full dataflow IDs needed for get_data, get_dataset_structure, and compare_countries calls. OECD covers 38+ member economies with data on GDP, trade, education, health, labor, environment, governance, and more. Args: query: Search term (e.g. "gdp", "productivity", "education"). limit: Number of results to return (1-50, default 20). Returns: List of matching datasets with id, name, agency, and description. Use the 'id' field as the dataflow parameter in other tools.

ParameterTypeRequiredDescription
querystringrequiredSearch term for OECD datasets (e.g. "gdp", "productivity", "education", "trade", "labour", "health").
limitintegeroptionalNumber of results to return (1-50, default 20). (default: 20)
curl -X POST "https://context.gnist.ai/mcp/oecd/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "search_datasets", "arguments": {"query": "gdp"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/oecd/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'query': 'gdp'}, 'name': 'search_datasets'}},
)
print(resp.json())

list_datasets

List available OECD datasets, optionally filtered by topic. Browse the full OECD data catalog. Use this to discover what datasets exist before querying specific data. Args: topic: Optional topic filter keyword. Omit to list all datasets. limit: Maximum datasets to return (1-200, default 50). Returns: List of datasets with id, name, and description.

ParameterTypeRequiredDescription
topicanyoptionalOptional topic filter (e.g. "health", "labour", "education", "environment"). Omit to list all.
limitintegeroptionalMaximum datasets to return (1-200, default 50). (default: 50)
curl -X POST "https://context.gnist.ai/mcp/oecd/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "list_datasets", "arguments": {"topic": "health"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/oecd/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'topic': 'health'}, 'name': 'list_datasets'}},
)
print(resp.json())

get_dataset_structure

Get the dimension structure of an OECD dataset. Shows what dimensions (filters) are available for a dataset and their valid values. Use this before get_data to understand what country codes, indicators, frequencies, and other parameters are accepted. Args: dataflow: OECD dataflow identifier from search_datasets. Returns: List of dimensions with their valid codes/values. Each dimension shows its position in the SDMX key and sample values.

ParameterTypeRequiredDescription
dataflowstringrequiredOECD dataflow identifier from search_datasets (e.g. "OECD.SDD.TPS,DSD_PDB@DF_PDB_LV,1.0").
curl -X POST "https://context.gnist.ai/mcp/oecd/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_dataset_structure", "arguments": {"dataflow": "OECD.SDD.TPS,DSD_PDB@DF_PDB_LV,1.0"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/oecd/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'dataflow': 'OECD.SDD.TPS,DSD_PDB@DF_PDB_LV,1.0'},
            'name': 'get_dataset_structure'}},
)
print(resp.json())

get_data

Fetch data from an OECD dataset. Query any OECD dataset using an SDMX dimension key filter. Use get_dataset_structure first to find valid dimension values and their positions in the key. OECD does not support startPeriod/endPeriod filters. Use last_n_observations to limit the time range. Args: dataflow: OECD dataflow identifier. Use search_datasets to find IDs. key_filter: SDMX dimension key with * wildcards for any position. last_n_observations: Return only the last N time periods. limit: Maximum observations to return (1-1000, default 200). Returns: Observations with all dimension labels and values.

ParameterTypeRequiredDescription
dataflowstringrequiredOECD dataflow identifier (e.g. "OECD.SDD.TPS,DSD_PDB@DF_PDB_LV,1.0"). Use search_datasets to find IDs.
key_filteranyoptionalSDMX dimension key (dot-separated, * for wildcard, e.g. "A.USA.*.*.*"). Use get_dataset_structure to find valid values.
last_n_observationsanyoptionalReturn only the last N time periods (1-100).
limitintegeroptionalMaximum observations to return (1-1000, default 200). (default: 200)
curl -X POST "https://context.gnist.ai/mcp/oecd/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "get_data", "arguments": {"dataflow": "OECD.SDD.TPS,DSD_PDB@DF_PDB_LV,1.0"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/oecd/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'dataflow': 'OECD.SDD.TPS,DSD_PDB@DF_PDB_LV,1.0'},
            'name': 'get_data'}},
)
print(resp.json())

compare_countries

Compare data across countries for a given OECD dataset. Fetches the same indicator for multiple countries side by side. Useful for cross-country analysis of GDP, productivity, education, health, and other OECD statistics. Args: dataflow: OECD dataflow identifier. country_codes: ISO alpha-3 country codes to compare. Maximum 20. last_n_observations: Return last N time periods (1-100, default 5). Returns: Data grouped by country for easy comparison.

ParameterTypeRequiredDescription
dataflowstringrequiredOECD dataflow identifier (e.g. "OECD.SDD.TPS,DSD_PDB@DF_PDB_LV,1.0").
country_codeslist[string]requiredISO alpha-3 country codes to compare (e.g. ["USA", "DEU", "JPN", "NOR"]). Maximum 20.
last_n_observationsintegeroptionalReturn last N time periods per country (1-100, default 5). (default: 5)
curl -X POST "https://context.gnist.ai/mcp/oecd/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "compare_countries", "arguments": {"dataflow": "OECD.SDD.TPS,DSD_PDB@DF_PDB_LV,1.0", "country_codes": "[\"USA\""}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/oecd/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'country_codes': '["USA"',
                          'dataflow': 'OECD.SDD.TPS,DSD_PDB@DF_PDB_LV,1.0'},
            'name': 'compare_countries'}},
)
print(resp.json())

report_feedback

Report 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'.

ParameterTypeRequiredDescription
feedbackstringrequired
feedback_typestringoptional (default: general)
curl -X POST "https://context.gnist.ai/mcp/oecd/" \
  -H "Content-Type: application/json" \
  -H "Gnist-API-Key: YOUR_API_KEY" \
  -d '{"jsonrpc": "2.0", "method": "tools/call", "id": 1, "params": {"name": "report_feedback", "arguments": {"feedback": "example"}}}'
import httpx

resp = httpx.post(
    "https://context.gnist.ai/mcp/oecd/",
    headers={"Gnist-API-Key": "YOUR_API_KEY"},
    json={'id': 1,
 'jsonrpc': '2.0',
 'method': 'tools/call',
 'params': {'arguments': {'feedback': 'example'}, 'name': 'report_feedback'}},
)
print(resp.json())

Common Patterns

Search then retrieve
Use search_datasets to find items, then get_dataset_structure to get full details. This two-step pattern is common for exploring data before drilling down.
Pagination
Several tools support limit, offset, or page parameters. Start with small limits during development, then increase for production queries.

FAQ

What data does OECD Statistics provide?

OECD economic statistics — GDP, trade, education, health, labour, and environment data across 38+ member economies. It exposes 6 tools: search_datasets, list_datasets, get_dataset_structure, get_data, compare_countries, report_feedback.

What do I need to get started?

A Gnist API key (free tier: 100 calls/day). Sign up at https://context.gnist.ai/signup.

What format does the OECD Statistics API return?

JSON, via either MCP protocol (JSON-RPC 2.0) or REST API.

Next Steps

Related Tutorials