Skip to main content
Glama
kukapay

crypto-stocks-mcp

get_stock_price

Retrieve real-time stock prices for crypto-related companies by providing a ticker symbol. Returns an ASCII table with ticker, company name, price, and timestamp.

Instructions

Get real-time price for a specific stock in a table format.

Args: ticker (str): The stock ticker symbol (e.g., 'COIN' for Coinbase). Returns: str: An ASCII table string containing the ticker, company name, current price, and timestamp. Returns an error message if the ticker is invalid.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes

Implementation Reference

  • main.py:50-73 (handler)
    The handler function decorated with @mcp.tool() that implements the get_stock_price tool. It checks if the ticker is valid using CRYPTO_STOCKS, fetches the current price using yfinance.Ticker, and formats the result as an ASCII table using tabulate.
    @mcp.tool() def get_stock_price(ticker: str) -> str: """Get real-time price for a specific stock in a table format. Args: ticker (str): The stock ticker symbol (e.g., 'COIN' for Coinbase). Returns: str: An ASCII table string containing the ticker, company name, current price, and timestamp. Returns an error message if the ticker is invalid. """ if ticker not in CRYPTO_STOCKS: return f"Error: Unknown ticker {ticker}" stock = yf.Ticker(ticker) price = stock.info.get("regularMarketPrice", "N/A") table_data = [[ticker, CRYPTO_STOCKS[ticker], price, datetime.now().isoformat()]] return tabulate( table_data, headers=["Ticker", "Name", "Price", "Timestamp"], tablefmt="grid", stralign="left", floatfmt=".2f" )

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/kukapay/crypto-stocks-mcp'

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