get_top_trending_tokens
Retrieve the most actively traded cryptocurrency tokens within a specific time period to analyze market trends and compare performance metrics like market capitalization and trading volume.
Instructions
Get the top trending tokens in a particular time frame. Great for comparing market cap or volume.
Expects a TopTrendingTokensRequest, returns a list of tokens with their details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top_trending_tokens_requests | Yes |
Implementation Reference
- armor_crypto_mcp/armor_mcp.py:562-575 (handler)The primary MCP tool handler for 'get_top_trending_tokens'. Decorated with @mcp.tool() for automatic registration. Proxies the request to the global armor_client instance, handles login check and exceptions.@mcp.tool() async def get_top_trending_tokens(top_trending_tokens_requests: TopTrendingTokensRequest) -> List: """ Get the top trending tokens in a particular time frame. Great for comparing market cap or volume. Expects a TopTrendingTokensRequest, returns a list of tokens with their details. """ if not armor_client: return [{"error": "Not logged in"}] try: result: List = await armor_client.top_trending_tokens(top_trending_tokens_requests) return result except Exception as e: return [{"error": str(e)}]
- Pydantic BaseModel defining the input schema for the tool, with a 'time_frame' field specifying the period for trending data.class TopTrendingTokensRequest(BaseModel): time_frame: Literal["5m", "15m", "30m", "1h", "2h", "3h", "4h", "5h", "6h", "12h", "24h"] = Field(default="24h", description="Time frame to get the top trending tokens")
- Core implementation in ArmorWalletAPIClient that serializes the request and calls the backend API endpoint '/tokens/trending/' via POST.async def top_trending_tokens(self, data: TopTrendingTokensRequest) -> List: """Get the top trending tokens.""" payload = data.model_dump(exclude_none=True) return await self._api_call("POST", f"tokens/trending/", payload)
- armor_crypto_mcp/armor_mcp.py:76-80 (helper)Global initialization of the ArmorWalletAPIClient instance used by all tool handlers, loaded from environment variables.ACCESS_TOKEN = os.getenv('ARMOR_API_KEY') or os.getenv('ARMOR_ACCESS_TOKEN') BASE_API_URL = os.getenv('ARMOR_API_URL') or 'https://app.armorwallet.ai/api/v1' armor_client = ArmorWalletAPIClient(ACCESS_TOKEN, base_api_url=BASE_API_URL) #, log_path='armor_client.log')