get_cashflow
Retrieve cash flow statements for stocks to analyze financial health and liquidity. Specify symbol and frequency (yearly, quarterly) for detailed cash flow data.
Instructions
Get cashflow for a given stock symbol.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Stock symbol in Yahoo Finance format. | |
| freq | No | At what frequency to get cashflow statements. Defaults to "yearly". Valid freqencies: "yearly", "quarterly", "trainling" |
Implementation Reference
- src/mcp_yahoo_finance/server.py:272-285 (handler)MCP tool handler function for get_cashflow, registered via @mcp_instance.tool() decorator, delegates to YahooFinance.get_cashflow@mcp_instance.tool() def get_cashflow( symbol: str, freq: Literal["yearly", "quarterly", "trainling"] = "yearly" ) -> str: """Get cashflow for a given stock symbol. Args: symbol (str): Stock symbol in Yahoo Finance format. freq (str): At what frequency to get cashflow statements. Defaults to "yearly". Valid freqencies: "yearly", "quarterly", "trainling" """ # Note: Original function didn't specify return type, assuming str return str(yf_instance.get_cashflow(symbol, freq))
- Supporting helper method in YahooFinance class that fetches and formats cashflow data using yfinance.def get_cashflow( self, symbol: str, freq: Literal["yearly", "quarterly", "trainling"] = "yearly" ): """Get cashflow for a given stock symbol. Args: symbol (str): Stock symbol in Yahoo Finance format. freq (str): At what frequency to get cashflow statements. Defaults to "yearly". Valid freqencies: "yearly", "quarterly", "trainling" """ stock = Ticker(ticker=symbol, session=self.session) cashflow = stock.get_cashflow(freq=freq, pretty=True) if isinstance(cashflow, pd.DataFrame): cashflow.columns = [str(col.date()) for col in cashflow.columns] return f"{cashflow.to_json(indent=2)}" return f"{cashflow}"