Skip to main content
Glama
c-cf

IMF Data MCP Server

by c-cf

list_indicators

Retrieve available economic indicators for a specific IMF dataset to identify relevant metrics for analysis.

Instructions

Returns a list of indicators for the specified dataset, read from the corresponding .json file in the local indicators directory. Args: dataset_id (str): Dataset ID, such as "IFS", "DOT", "BOP", etc. Returns: list: List of indicators.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataset_idYes

Implementation Reference

  • The handler function for the 'list_indicators' MCP tool, registered via @mcp.tool(). It loads a JSON file from resources/indicators/{dataset_id}.json and returns the list of indicators, handling errors appropriately. The function signature and docstring define the input schema (dataset_id: str) and output (list).
    def list_indicators(dataset_id: str) -> list: """ Returns a list of indicators for the specified dataset, read from the corresponding .json file in the local indicators directory. Args: dataset_id (str): Dataset ID, such as "IFS", "DOT", "BOP", etc. Returns: list: List of indicators. """ file_path = os.path.join(os.path.dirname(__file__), "resources", "indicators", f"{dataset_id.lower()}.json") try: with open(file_path, 'r', encoding='utf-8') as file: data = json.load(file) return data except FileNotFoundError: return {"error": f"File not found: {file_path}"} except json.JSONDecodeError: return {"error": f"Error decoding JSON from file: {file_path}"} except Exception as e: return {"error": f"Error reading file: {str(e)}"}

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/c-cf/imf-data-mcp'

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