get_balance_sheet
Retrieve company balance sheet data for financial analysis by providing a stock symbol and specifying the number of recent records needed.
Instructions
Get company balance sheet data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Stock symbol/ticker (e.g. '000001') | |
| recent_n | No | Number of most recent records to return |
Implementation Reference
- src/akshare_one_mcp/server.py:184-195 (handler)The handler function for the 'get_balance_sheet' tool. It is registered via the @mcp.tool decorator. Takes a stock symbol and optional recent_n parameter, fetches balance sheet data from akshare_one (ako), limits rows if specified, and returns as JSON string.@mcp.tool def get_balance_sheet( symbol: Annotated[str, Field(description="Stock symbol/ticker (e.g. '000001')")], recent_n: Annotated[ int | None, Field(description="Number of most recent records to return", ge=1) ] = 10, ) -> str: """Get company balance sheet data.""" df = ako.get_balance_sheet(symbol=symbol, source="sina") if recent_n is not None: df = df.head(recent_n) return df.to_json(orient="records") or "[]"
- src/akshare_one_mcp/server.py:184-184 (registration)The @mcp.tool decorator registers the get_balance_sheet function as an MCP tool.@mcp.tool
- Input schema defined using Annotated and Field for symbol (str) and recent_n (optional int). Output is str (JSON).symbol: Annotated[str, Field(description="Stock symbol/ticker (e.g. '000001')")], recent_n: Annotated[ int | None, Field(description="Number of most recent records to return", ge=1) ] = 10, ) -> str: