Skip to main content
Glama

get_stock_price

Retrieve the current stock price for a specific ticker symbol using Yahoo Finance data integration. Input the stock ticker symbol to receive up-to-date pricing information.

Instructions

Get the current stock price using yfinance.

Args: symbol: Stock ticker (e.g. AAPL, TSLA, MSFT)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes

Implementation Reference

  • The tool handler decorated with @mcp.tool(), which implements the get_stock_price logic using yfinance library. Includes input schema in docstring and type hints.
    @mcp.tool() async def get_stock_price(symbol: str) -> str: """Get the current stock price using yfinance. Args: symbol: Stock ticker (e.g. AAPL, TSLA, MSFT) """ try: stock = yf.Ticker(symbol) info = stock.info price = info["currentPrice"] currency = info.get("currency", "USD") return f"{symbol.upper()} is trading at {price} {currency}." except Exception: return f"Could not retrieve stock price for {symbol}."

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/coreyjwang/FinDataMCP'

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