list_indicators
Retrieve a list of indicators for a specified dataset, such as 'IFS', 'DOT', or 'BOP', from the local indicators directory. Simplifies data access and analysis with JSON file integration.
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
| Name | Required | Description | Default |
|---|---|---|---|
| dataset_id | Yes |
Implementation Reference
- imf_data_mcp/__init__.py:288-310 (handler)The handler function for the 'list_indicators' tool, which reads and returns indicators from a local JSON file for the given dataset_id. The @mcp.tool() decorator registers it as an MCP tool.@mcp.tool() 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)}"}