get_growth_data
Retrieve quarterly growth capability data for A-share stocks by specifying stock code, year, and quarter to analyze financial performance trends.
Instructions
Quarterly growth capability data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| year | Yes | ||
| quarter | Yes | ||
| limit | No | ||
| format | No | markdown |
Implementation Reference
- src/tools/financial_reports.py:47-53 (handler)MCP tool handler for 'get_growth_data', decorated with @app.tool(). Accepts code, year, quarter, limit, and format parameters. Delegates execution to the fetch_growth_data use case wrapped in run_tool_with_handling for error handling and caching.@app.tool() def get_growth_data(code: str, year: str, quarter: int, limit: int = 250, format: str = "markdown") -> str: """Quarterly growth capability data.""" return run_tool_with_handling( lambda: fetch_growth_data(active_data_source, code=code, year=year, quarter=quarter, limit=limit, format=format), context=f"get_growth_data:{code}:{year}Q{quarter}", )
- mcp_server.py:52-52 (registration)Registration of financial report tools, including 'get_growth_data', by calling the register_financial_report_tools function with the MCP app and active data source.register_financial_report_tools(app, active_data_source)
- Helper use case function that performs input validation, fetches raw growth data from the FinancialDataSource interface, and formats the output as a table in markdown or other specified format.def fetch_growth_data(data_source: FinancialDataSource, *, code: str, year: str, quarter: int, limit: int, format: str) -> str: validate_year(year) validate_quarter(quarter) validate_output_format(format) df = data_source.get_growth_data(code=code, year=year, quarter=quarter) return _format_financial_df(df, code=code, year=year, quarter=quarter, dataset="Growth", format=format, limit=limit)
- src/tools/financial_reports.py:26-29 (helper)Registration function that defines and registers all financial report tools, including the get_growth_data handler using @app.tool() decorator.def register_financial_report_tools(app: FastMCP, active_data_source: FinancialDataSource): """ Register financial report related tools with the MCP app. """