get_money_supply_data_year
Retrieve yearly money supply data for economic analysis, supporting date ranges and multiple output formats to track monetary policy trends.
Instructions
Yearly money supply data.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_money_supply_data_year"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| start_date | No | ||
| end_date | No | ||
| limit | No | ||
| format | No | markdown |
Implementation Reference
- src/tools/macroeconomic.py:61-69 (handler)MCP tool handler: decorated with @app.tool(), invokes the use case via run_tool_with_handling for error handling and execution.
@app.tool() def get_money_supply_data_year(start_date: Optional[str] = None, end_date: Optional[str] = None, limit: int = 250, format: str = "markdown") -> str: """Yearly money supply data.""" return run_tool_with_handling( lambda: fetch_money_supply_data_year( active_data_source, start_date=start_date, end_date=end_date, limit=limit, format=format ), context="get_money_supply_data_year", ) - mcp_server.py:55-55 (registration)Invocation of the register_macroeconomic_tools function, which registers the get_money_supply_data_year tool among others.
register_macroeconomic_tools(app, active_data_source) - src/use_cases/macroeconomic.py:38-42 (helper)Use case function that fetches yearly money supply data from the data source, applies validation and formatting.
def fetch_money_supply_data_year(data_source: FinancialDataSource, *, start_date: Optional[str], end_date: Optional[str], limit: int, format: str) -> str: validate_output_format(format) df = data_source.get_money_supply_data_year(start_date=start_date, end_date=end_date) meta = {"dataset": "money_supply_year", "start_date": start_date, "end_date": end_date} return format_table_output(df, format=format, max_rows=limit, meta=meta) - src/baostock_data_source.py:682-685 (helper)Data source implementation: calls Baostock API via _fetch_macro_data to retrieve the raw yearly money supply data.
def get_money_supply_data_year(self, start_date: Optional[str] = None, end_date: Optional[str] = None) -> pd.DataFrame: """Fetches yearly money supply data (M0, M1, M2 - year end balance) using Baostock.""" # Baostock expects YYYY format for dates here return _fetch_macro_data(bs.query_money_supply_data_year, "Yearly Money Supply", start_date, end_date) - src/data_source_interface.py:118-120 (schema)Abstract method definition in FinancialDataSource interface, defining the expected input/output for the data method.
@abstractmethod def get_money_supply_data_year(self, start_date: Optional[str] = None, end_date: Optional[str] = None) -> pd.DataFrame: """Fetches yearly money supply data (M0, M1, M2 - year end balance)."""