Skip to main content
Glama
llnOrmll

World Bank Data360 MCP Server

by llnOrmll

get_temporal_coverage_tool

Check available years for World Bank datasets to ensure valid data retrieval by identifying temporal coverage before downloading.

Instructions

[STEP 2/3] Get available years for a specific dataset.

CRITICAL: Always call this BEFORE retrieve_data to avoid errors. Workflow: 1. search_datasets - Done ✓ 2. get_temporal_coverage (this tool) - Check what years are available 3. retrieve_data - Use latest_year from this response Returns: start_year, end_year, latest_year, and full list of available years. Next step: Call retrieve_data with year=latest_year.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indicatorYes
databaseYes

Implementation Reference

  • The MCP tool handler decorated with @server.tool(). This is the entry point for the 'get_temporal_coverage_tool' tool, which validates inputs via type hints and delegates execution to the core helper function.
    def get_temporal_coverage_tool(indicator: str, database: str) -> dict[str, Any]: """[STEP 2/3] Get available years for a specific dataset. CRITICAL: Always call this BEFORE retrieve_data to avoid errors. Workflow: 1. search_datasets - Done ✓ 2. get_temporal_coverage (this tool) - Check what years are available 3. retrieve_data - Use latest_year from this response Returns: start_year, end_year, latest_year, and full list of available years. Next step: Call retrieve_data with year=latest_year. """ return get_temporal_coverage(indicator, database)
  • Core helper function containing the actual API call to retrieve temporal coverage (start_year, end_year) from World Bank metadata endpoint for the specified indicator.
    def get_temporal_coverage(indicator: str, database: str) -> dict[str, Any]: """Get available years for a dataset""" try: payload = { "query": f"&$filter=series_description/idno eq '{indicator}'" } response = requests.post( METADATA_ENDPOINT, json=payload, headers={"Content-Type": "application/json", "Accept": "application/json"}, timeout=30 ) response.raise_for_status() metadata = response.json() values = metadata.get("value", []) if not values: return {"success": False, "error": "No metadata found"} series_desc = values[0].get("series_description", {}) time_periods = series_desc.get("time_periods", []) if time_periods: period = time_periods[0] start_year = int(period.get("start", 0)) end_year = int(period.get("end", 0)) return { "success": True, "start_year": start_year, "end_year": end_year, "latest_year": end_year, "available_years": list(range(start_year, end_year + 1)) } return {"success": False, "error": "No temporal data available"} except Exception as e: return {"success": False, "error": str(e)}
  • The @server.tool() decorator registers this function as an MCP tool named 'get_temporal_coverage_tool' in the FastMCP server.
    def get_temporal_coverage_tool(indicator: str, database: str) -> dict[str, Any]:

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/llnOrmll/world-bank-data-mcp'

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