get_price_chart
Retrieve historical price data for crypto tokens at specified intervals to analyze market trends and performance over time.
Instructions
GET /coins/chart/{coins}
Get token prices at regular time intervals.
Parameters:
coins: comma-separated tokens in format {chain}:{address}
start: unix timestamp of earliest data point
end: unix timestamp of latest data point
span: number of data points returned
period: duration between data points (default: '24h')
search_width: time range on either side to find price data (default: '600')
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coins | Yes | ||
| start | No | ||
| end | No | ||
| span | No | ||
| period | No | 24h | |
| search_width | No | 600 |
Implementation Reference
- defillama_server.py:661-694 (handler)The handler function for the 'get_price_chart' tool, registered via @mcp.tool(). It constructs parameters and calls the DefiLlama API endpoint /coins/chart/{coins} to retrieve token price charts at regular intervals.@mcp.tool() async def get_price_chart( coins: str, start: Optional[int] = None, end: Optional[int] = None, span: Optional[int] = None, period: str = "24h", search_width: str = "600" ) -> str: """GET /coins/chart/{coins} Get token prices at regular time intervals. Parameters: coins: comma-separated tokens in format {chain}:{address} start: unix timestamp of earliest data point end: unix timestamp of latest data point span: number of data points returned period: duration between data points (default: '24h') search_width: time range on either side to find price data (default: '600') """ params = { 'period': period, 'searchWidth': search_width } if start is not None: params['start'] = start if end is not None: params['end'] = end if span is not None: params['span'] = span result = await make_request('GET', f'/coins/chart/{coins}', params) return str(result)