get_price_chart
Retrieve token price data at specified intervals for custom time ranges with chain and address parameters. Analyze historical trends and market movements using this API tool.
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 | ||
| end | No | ||
| period | No | 24h | |
| search_width | No | 600 | |
| span | No | ||
| start | No |
Implementation Reference
- defillama_server.py:661-693 (handler)Handler function decorated with @mcp.tool() that implements the get_price_chart tool. It constructs parameters and calls the DefiLlama API endpoint /coins/chart/{coins} via the make_request helper 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)