get_trending_crypto
Identify top trending cryptocurrencies within the last 24 hours to monitor market movements and inform trading decisions.
Instructions
Gets the top trending cryptocurrencies in the last 24 hours.
Returns:
Formatted string with trending coins
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- tools/crypto_data.py:94-120 (handler)The core handler function that fetches top trending cryptocurrencies from CoinGecko API and formats them into a readable string list.def get_trending_crypto() -> str: """ Gets the top trending cryptocurrencies in the last 24 hours. Returns: Formatted string with trending coins """ try: data = cg.get_search_trending() coins = data.get('coins', []) if not coins: return "No trending coins data available" summary = ["=== TRENDING CRYPTOCURRENCIES (24h) ===\n"] for i, item in enumerate(coins[:10], 1): coin = item.get('item', {}) summary.append( f"{i}. {coin.get('name')} ({coin.get('symbol', 'N/A').upper()})" f" - Rank #{coin.get('market_cap_rank', 'N/A')}" ) return "\n".join(summary) except Exception as e: logger.error(f"CoinGecko error: {e}") return f"Error fetching trending coins: {str(e)}"
- server.py:414-418 (registration)Registers get_trending_crypto as an MCP tool in the 'Cryptocurrency' category using the register_tools helper function.register_tools( [get_crypto_price, get_crypto_market_data, get_trending_crypto, search_crypto], "Cryptocurrency" )
- app.py:295-302 (registration)Includes get_trending_crypto in the 'Crypto' tools group for the Gradio toolbox and MCP server in the app.py dual-mode application."Crypto": [ get_crypto_price, get_crypto_market_data, get_trending_crypto, search_crypto, get_crypto_resource, crypto_market_update, ],
- tools/crypto_data.py:13-13 (helper)Global CoinGeckoAPI client initialization used by get_trending_crypto and other crypto tools.cg = CoinGeckoAPI()