Skip to main content
Glama
leoncuhk

MCP Yahoo Finance

by leoncuhk

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
NameRequiredDescriptionDefault
symbolYesStock symbol in Yahoo Finance format.
freqNoAt what frequency to get cashflow statements. Defaults to "yearly". Valid freqencies: "yearly", "quarterly", "trainling"

Implementation Reference

  • 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}"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/leoncuhk/mcp-yahoo-finance'

If you have feedback or need assistance with the MCP directory API, please join our Discord server