get_crypto_latest_news
Retrieve cryptocurrency news updates from the Yahoo Finance MCP Server to stay informed on market trends and developments.
Instructions
获取加密货币最新新闻列表。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| page | No |
Implementation Reference
- server.py:1261-1279 (handler)The handler function that executes the tool logic: fetches latest crypto news from Financial Modeling Prep API using page and limit parameters, returns JSON string or error message.async def get_crypto_latest_news(page: int = 0, limit: int = 20) -> 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-latest" try: resp = requests.get( url, params={"page": page, "limit": limit, "apikey": api_key}, timeout=10, ) resp.raise_for_status() data = resp.json() except Exception as e: return f"Error: getting latest crypto news: {e}" return json.dumps(data)
- server.py:1257-1260 (registration)Registers the get_crypto_latest_news tool using the @fmp_server.tool decorator with name and description.@fmp_server.tool( name="get_crypto_latest_news", description="""获取加密货币最新新闻列表。""", )