get_crypto_news
Search for cryptocurrency-related news by providing specific crypto symbols. This tool connects to the Yahoo Finance MCP Server to deliver targeted financial updates.
Instructions
搜索加密货币相关新闻。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbols | Yes |
Implementation Reference
- server.py:1240-1254 (handler)The main handler function that fetches cryptocurrency news from the Financial Modeling Prep API using the provided symbols, handles errors, and returns JSON data.async def get_crypto_news(symbols: 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/news/crypto" try: resp = requests.get(url, params={"symbols": symbols, "apikey": api_key}, timeout=10) resp.raise_for_status() data = resp.json() except Exception as e: return f"Error: getting crypto news for {symbols}: {e}" return json.dumps(data)
- server.py:1236-1239 (registration)The decorator that registers the 'get_crypto_news' tool with the MCP server, including its name and description.@fmp_server.tool( name="get_crypto_news", description="""搜索加密货币相关新闻。""", )