get_current_prices
Retrieve current cryptocurrency token prices by contract address using comma-separated chain:address format to monitor market values.
Instructions
GET /coins/prices/current/{coins}
Get current prices of tokens by contract address.
Parameters:
coins: comma-separated tokens in format {chain}:{address} (e.g., 'ethereum:0xdF574c24545E5FfEcb9a659c229253D4111d87e1,coingecko:ethereum')
search_width: time range on either side to find price data (default: '6h')
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coins | Yes | ||
| search_width | No | 6h |
Implementation Reference
- defillama_server.py:605-620 (handler)The main handler function for the 'get_current_prices' tool. It is registered via the @mcp.tool() decorator and implements the logic to fetch current token prices from the DefiLlama API by calling the shared make_request helper with the appropriate endpoint and parameters.@mcp.tool() async def get_current_prices( coins: str, search_width: str = "6h" ) -> str: """GET /coins/prices/current/{coins} Get current prices of tokens by contract address. Parameters: coins: comma-separated tokens in format {chain}:{address} (e.g., 'ethereum:0xdF574c24545E5FfEcb9a659c229253D4111d87e1,coingecko:ethereum') search_width: time range on either side to find price data (default: '6h') """ params = {'searchWidth': search_width} result = await make_request('GET', f'/coins/prices/current/{coins}', params) return str(result)