get_top_symbols_by_volume
Identify top symbols by trading volume from the Wormholescan API to analyze cross-chain activity. Specify a time span (7d, 15d, 30d) to retrieve results in a structured pandas DataFrame format.
Instructions
Fetch top symbols by volume from Wormholescan API.
Args:
timeSpan: Time span for data (7d, 15d, 30d). Default: 7d
Returns:
String representation of a pandas DataFrame containing top symbols by volume
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeSpan | No | 7d |
Implementation Reference
- main.py:343-402 (handler)The handler function decorated with @mcp.tool(), implementing the core logic: validates timeSpan, fetches data from Wormholescan API /api/v1/top-symbols-by-volume, transforms to pandas DataFrame with symbol, volume, txs, sorts by volume descending, returns markdown table.# Define the get_top_symbols_by_volume tool @mcp.tool() async def get_top_symbols_by_volume( timeSpan: str = "7d" ) -> str: """ Fetch top symbols by volume from Wormholescan API. Args: timeSpan: Time span for data (7d, 15d, 30d). Default: 7d Returns: String representation of a pandas DataFrame containing top symbols by volume """ try: # Validate parameters valid_time_spans = {"7d", "15d", "30d"} if timeSpan not in valid_time_spans: raise ValueError(f"Invalid timeSpan. Must be one of {valid_time_spans}") # Construct query parameters params = {"timeSpan": timeSpan} # Make API request async with httpx.AsyncClient() as client: response = await client.get( f"{API_BASE}/api/v1/top-symbols-by-volume", params=params ) response.raise_for_status() # Parse JSON response data = response.json() # Transform data for DataFrame rows = [ { "symbol": item.get("symbol"), "volume": item.get("volume"), "txs": item.get("txs") } for item in data.get("symbols", []) ] # Create DataFrame df = pd.DataFrame(rows) # Convert numeric columns df["volume"] = pd.to_numeric(df["volume"], errors="coerce") df["txs"] = pd.to_numeric(df["txs"], errors="coerce") # Sort by volume descending for readability df = df.sort_values("volume", ascending=False) return df.to_markdown(index=False) except Exception as e: return str(e)