Skip to main content
Glama
leoncuhk

MCP Yahoo Finance

by leoncuhk

get_dividends

Retrieve dividend data for a specific stock symbol using the MCP Yahoo Finance server. Input the stock symbol to access payout details for financial analysis or investment decisions.

Instructions

Get dividends for a given stock symbol.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock symbol in Yahoo Finance format.

Implementation Reference

  • The MCP tool handler for 'get_dividends', registered via @mcp_instance.tool() decorator. It calls the underlying YahooFinance.get_dividends method.
    @mcp_instance.tool() def get_dividends(symbol: str) -> str: """Get dividends for a given stock symbol. Args: symbol (str): Stock symbol in Yahoo Finance format. """ return yf_instance.get_dividends(symbol)
  • Helper method in YahooFinance class that fetches dividends data using yfinance.Ticker and formats it as JSON.
    def get_dividends(self, symbol: str) -> str: """Get dividends for a given stock symbol. Args: symbol (str): Stock symbol in Yahoo Finance format. """ stock = Ticker(ticker=symbol, session=self.session) dividends = stock.dividends if hasattr(dividends.index, "date"): dividends.index = dividends.index.date.astype(str) # type: ignore return f"{dividends.to_json(orient='index')}"

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