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
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes |
Implementation Reference
- server.py:1125-1139 (handler)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="""获取指定加密货币的完整行情。""", )