get_balance_sheets
Retrieve company balance sheets from Vietnam's stock market by specifying a stock symbol, period (quarter/year), and output format (JSON/dataframe).
Instructions
Get balance sheets of a company from stock market
Args:
symbol: str (symbol of the company to get balance sheets)
period: Literal['quarter', 'year'] = 'year' (period to get balance sheets)
output_format: Literal['json', 'dataframe'] = 'json'
Returns:
pd.DataFrame
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | ||
| period | No | year | |
| output_format | No | json |
Implementation Reference
- src/vnstock_mcp/server.py:407-427 (handler)The handler function decorated with @server.tool(), implementing the get_balance_sheets tool. It retrieves balance sheet data for a given stock symbol and period using VCIFinance.balance_sheet() and returns it in JSON or DataFrame format.@server.tool() def get_balance_sheets( symbol: str, period: Literal["quarter", "year"] = "year", output_format: Literal["json", "dataframe"] = "json", ): # pyright: ignore[reportUndefinedVariable] """ Get balance sheets of a company from stock market Args: symbol: str (symbol of the company to get balance sheets) period: Literal['quarter', 'year'] = 'year' (period to get balance sheets) output_format: Literal['json', 'dataframe'] = 'json' Returns: pd.DataFrame """ finance = VCIFinance(symbol=symbol, period=period) df = finance.balance_sheet() if output_format == "json": return df.to_json(orient="records", force_ascii=False) else: return df
- src/vnstock_mcp/server.py:407-407 (registration)The @server.tool() decorator registers the get_balance_sheets function as an MCP tool.@server.tool()
- src/vnstock_mcp/server.py:409-411 (schema)Type annotations defining the input schema for the tool parameters.symbol: str, period: Literal["quarter", "year"] = "year", output_format: Literal["json", "dataframe"] = "json",