get_cash_flow
Retrieve company cash flow statement data for a specified stock symbol, with options to select the data source and determine the number of recent records to analyze.
Instructions
Get company cash flow statement data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recent_n | No | Number of most recent records to return | |
| source | No | Data source | sina |
| symbol | Yes | Stock symbol/ticker (e.g. '000001') |
Implementation Reference
- src/akshare_one_mcp/server.py:212-224 (handler)The handler function for the 'get_cash_flow' MCP tool. It is registered via the @mcp.tool decorator. The input schema is defined using Annotated types with pydantic Field for validation. The function fetches cash flow data from akshare_one (ako), optionally limits rows, and returns JSON.@mcp.tool def get_cash_flow( symbol: Annotated[str, Field(description="Stock symbol/ticker (e.g. '000001')")], source: Annotated[Literal["sina"], Field(description="Data source")] = "sina", recent_n: Annotated[ int | None, Field(description="Number of most recent records to return", ge=1) ] = 10, ) -> str: """Get company cash flow statement data.""" df = ako.get_cash_flow(symbol=symbol, source=source) if recent_n is not None: df = df.head(recent_n) return df.to_json(orient="records") or "[]"