get_crypto_price_eod
Retrieve historical end-of-day cryptocurrency prices via Yahoo Finance MCP Server, supporting both light and full data modes for analysis and insights.
Instructions
获取加密货币的历史收盘价,可选简略或完整模式。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | light | |
| symbol | Yes |
Implementation Reference
- server.py:1188-1208 (handler)Handler function implementing the get_crypto_price_eod tool logic, fetching historical EOD crypto prices from Financial Modeling Prep API in light or full mode.async def get_crypto_price_eod(symbol: str, mode: str = "light") -> str: """获取加密货币 EOD 数据""" api_key = os.environ.get("FMP_API_KEY") if not api_key: return "Error: FMP_API_KEY environment variable not set." base = "https://financialmodelingprep.com/stable/historical-price-eod" endpoint_map = {"light": "light", "full": "full"} endpoint = endpoint_map.get(mode.lower()) if not endpoint: return "Error: invalid mode" url = f"{base}/{endpoint}" 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 {mode} crypto prices for {symbol}: {e}" return json.dumps(data)
- server.py:1184-1187 (registration)Registers the get_crypto_price_eod tool with the MCP server using the @tool decorator, including name and description.@fmp_server.tool( name="get_crypto_price_eod", description="""获取加密货币的历史收盘价,可选简略或完整模式。""", )