get_historical_chain_tvl_by_chain
Retrieve historical total value locked (TVL) data for a specific blockchain, excluding liquid staking and double-counted TVL, using a chain slug as input. Available via the REI Crypto MCP Server.
Instructions
GET /api/v2/historicalChainTvl/{chain}
Get historical TVL (excludes liquid staking and double counted tvl) of a chain.
Parameters:
chain: chain slug (e.g., 'Ethereum')
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | Yes |
Implementation Reference
- defillama_server.py:103-113 (handler)The main handler function for the tool 'get_historical_chain_tvl_by_chain'. It is registered via the @mcp.tool() decorator. The function makes an API request to DefiLlama for historical TVL data of the specified chain and returns the result as a string. The input schema is defined by the function parameter 'chain: str' and the docstring.@mcp.tool() async def get_historical_chain_tvl_by_chain(chain: str) -> str: """GET /api/v2/historicalChainTvl/{chain} Get historical TVL (excludes liquid staking and double counted tvl) of a chain. Parameters: chain: chain slug (e.g., 'Ethereum') """ result = await make_request('GET', f'/api/v2/historicalChainTvl/{chain}') return str(result)
- defillama_server.py:103-103 (registration)The @mcp.tool() decorator registers the function as an MCP tool with the name matching the function name.@mcp.tool()
- defillama_server.py:105-111 (schema)Docstring provides the tool description and parameter schema (chain: str)."""GET /api/v2/historicalChainTvl/{chain} Get historical TVL (excludes liquid staking and double counted tvl) of a chain. Parameters: chain: chain slug (e.g., 'Ethereum') """
- defillama_server.py:30-38 (helper)Shared helper function used by the tool 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)}"