get_first_price_record
Retrieve the earliest timestamp price record for specific crypto tokens by providing their chain and address details. Ideal for tracking initial price data points.
Instructions
GET /coins/prices/first/{coins}
Get earliest timestamp price record for coins.
Parameters:
coins: comma-separated tokens in format {chain}:{address}
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coins | Yes |
Implementation Reference
- defillama_server.py:721-731 (handler)The main handler function for the 'get_first_price_record' tool. It is decorated with @mcp.tool() which registers it automatically with FastMCP. The function makes an API request to DefiLlama's /coins/prices/first/{coins} endpoint using the shared make_request helper and returns the result as a string. Input schema is defined by the 'coins: str' type hint and docstring.@mcp.tool() async def get_first_price_record(coins: str) -> str: """GET /coins/prices/first/{coins} Get earliest timestamp price record for coins. Parameters: coins: comma-separated tokens in format {chain}:{address} """ result = await make_request('GET', f'/coins/prices/first/{coins}') return str(result)
- defillama_server.py:30-38 (helper)Shared helper function used by all tools, including get_first_price_record, to make HTTP requests to the DefiLlama API.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)}"
- defillama_server.py:721-721 (registration)The @mcp.tool() decorator registers the get_first_price_record function as an MCP tool with the server instance 'mcp'.@mcp.tool()