get_stablecoin_history
Retrieve historical market capitalization and blockchain distribution data for any stablecoin to analyze trends and track performance over time.
Instructions
GET /stablecoins/stablecoin/{asset}
Get historical mcap and historical chain distribution of a stablecoin.
Parameters:
asset: stablecoin ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| asset | Yes |
Implementation Reference
- defillama_server.py:196-206 (handler)The handler function for the 'get_stablecoin_history' tool, registered via @mcp.tool(). It makes an API request to DefiLlama's /stablecoins/stablecoin/{asset} endpoint to retrieve historical market cap and chain distribution data for the specified stablecoin asset ID.@mcp.tool() async def get_stablecoin_history(asset: int) -> str: """GET /stablecoins/stablecoin/{asset} Get historical mcap and historical chain distribution of a stablecoin. Parameters: asset: stablecoin ID """ result = await make_request('GET', f'/stablecoins/stablecoin/{asset}') return str(result)
- defillama_server.py:30-38 (helper)Shared helper function used by get_stablecoin_history (and other tools) to perform HTTP requests to the DefiLlama API using the configured httpx client.async def make_request(method: str, endpoint: str, params: Optional[Dict[str, Any]] = None) -> Any: """Make a request to the DefiLlama API.""" try: response = await client.request(method, endpoint, params=params) response.raise_for_status() return response.json() except Exception as e: return f"Error: {str(e)}"