Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_crypto_quote

Retrieve complete market data for any specified cryptocurrency, including price, volume, and trends, using Yahoo Finance MCP Server.

Instructions

获取指定加密货币的完整行情。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes

Implementation Reference

  • The handler function that implements the get_crypto_quote tool. It retrieves the crypto quote for a given symbol from the Financial Modeling Prep API, handles API key, makes HTTP request, and returns JSON data or error.
    async def get_crypto_quote(symbol: str) -> str:
        """获取加密货币报价"""
    
        api_key = os.environ.get("FMP_API_KEY")
        if not api_key:
            return "Error: FMP_API_KEY environment variable not set."
    
        url = "https://financialmodelingprep.com/stable/quote"
        try:
            resp = requests.get(url, params={"symbol": symbol, "apikey": api_key}, timeout=10)
            resp.raise_for_status()
            data = resp.json()
        except Exception as e:
            return f"Error: getting crypto quote for {symbol}: {e}"
        return json.dumps(data)
  • server.py:1121-1124 (registration)
    The registration of the get_crypto_quote tool via the @fmp_server.tool decorator, defining its name and description.
    @fmp_server.tool(
        name="get_crypto_quote",
        description="""获取指定加密货币的完整行情。""",
    )

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/16Coffee/finance-mcp'

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