Skip to main content
Glama

MCP Yahoo Finance

by leoncuhk

get_income_statement

Retrieve income statement data for a specific stock symbol, customizable by frequency, to analyze financial performance. Input the stock symbol to access detailed financial metrics.

Instructions

Get income statement for a given stock symbol.

Input Schema

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

Input Schema (JSON Schema)

{ "properties": { "freq": { "description": "At what frequency to get cashflow statements. Defaults to \"yearly\". Valid freqencies: \"yearly\", \"quarterly\", \"trainling\"", "type": "string" }, "symbol": { "description": "Stock symbol in Yahoo Finance format.", "type": "string" } }, "required": [ "symbol" ], "type": "object" }

Implementation Reference

  • MCP tool handler for 'get_income_statement', decorated with @mcp_instance.tool(). Delegates to YahooFinance instance method.
    @mcp_instance.tool() def get_income_statement( symbol: str, freq: Literal["yearly", "quarterly", "trainling"] = "yearly" ) -> str: """Get income statement 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" """ return yf_instance.get_income_statement(symbol, freq)
  • Core implementation in YahooFinance class using yfinance.Ticker.get_income_stmt() to fetch and format income statement as JSON.
    def get_income_statement( self, symbol: str, freq: Literal["yearly", "quarterly", "trainling"] = "yearly" ) -> str: """Get income statement 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) income_statement = stock.get_income_stmt(freq=freq, pretty=True) if isinstance(income_statement, pd.DataFrame): income_statement.columns = [ str(col.date()) for col in income_statement.columns ] return f"{income_statement.to_json()}" return f"{income_statement}"

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