Skip to main content
Glama
leoncuhk

MCP Yahoo Finance

by leoncuhk

get_cashflow

Retrieve cashflow statements for a specific stock symbol at custom frequencies (yearly, quarterly, trailing) using Yahoo Finance data to analyze financial performance.

Instructions

Get cashflow for a given stock symbol.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
freqNoAt what frequency to get cashflow statements. Defaults to "yearly". Valid freqencies: "yearly", "quarterly", "trainling"
symbolYesStock symbol in Yahoo Finance format.

Implementation Reference

  • The main MCP tool handler for get_cashflow. It is registered via @mcp_instance.tool() decorator and executes the tool logic by calling the YahooFinance helper method, returning the cashflow data as string.
    @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 the YahooFinance class that fetches cashflow data from yfinance Ticker, formats it as JSON string if DataFrame.
    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}"

Other Tools

Related Tools

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