get_top_trending_tokens
Retrieve the top trending tokens within a specified time frame for market cap or volume comparison, using a structured request format.
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-576 (handler)The main handler function for the 'get_top_trending_tokens' tool, decorated with @mcp.tool() for registration in the MCP server. It checks if the armor_client is initialized, calls the client's top_trending_tokens method, and handles exceptions by returning error messages.@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 (TopTrendingTokensRequest) for the tool, specifying the time_frame parameter with allowed values and default.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")
- Supporting method in ArmorWalletAPIClient class that serializes the request data and makes the HTTP POST request to the '/tokens/trending/' API endpoint to fetch the top trending tokens.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)