Skip to main content
Glama
narumiruna

Yahoo Finance MCP Server

get_ticker_info

Fetch detailed stock data such as company info, financials, trading metrics, and governance details using a specific stock symbol via the Yahoo Finance MCP Server.

Instructions

Retrieve stock data including company info, financials, trading metrics and governance data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesThe stock symbol

Implementation Reference

  • The main handler function for the 'get_ticker_info' tool. It fetches comprehensive stock information using yfinance.Ticker, converts timestamps to readable format, and returns the data as a JSON string. The @mcp.tool() decorator handles registration, and the Annotated parameter defines the input schema.
    @mcp.tool() def get_ticker_info(symbol: Annotated[str, Field(description="The stock symbol")]) -> str: """Retrieve stock data including company info, financials, trading metrics and governance data.""" ticker = yf.Ticker(symbol) # Convert timestamps to human-readable format info = ticker.info for key, value in info.items(): if not isinstance(key, str): continue if key.lower().endswith(("date", "start", "end", "timestamp", "time", "quarter")): try: info[key] = datetime.fromtimestamp(value).strftime("%Y-%m-%d %H:%M:%S") except Exception as e: logger.error("Unable to convert {}: {} to datetime, got error: {}", key, value, e) continue return json.dumps(info, ensure_ascii=False)

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/narumiruna/yfinance-mcp'

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