Skip to main content
Glama
0xReisearch

REI Crypto MCP Server

by 0xReisearch

get_protocol_tvl

Retrieve the current Total Value Locked (TVL) for any DeFi protocol using its slug identifier. This tool provides real-time TVL data from DeFiLlama Pro to analyze protocol performance and market position.

Instructions

GET /api/tvl/{protocol}

Simplified endpoint to get current TVL of a protocol.

Parameters:
    protocol: protocol slug (e.g., 'uniswap')

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protocolYes

Implementation Reference

  • The handler function for the 'get_protocol_tvl' tool. It is automatically registered as an MCP tool via the @mcp.tool() decorator. The function signature and docstring define the input schema (protocol: str) and output (str representing JSON response). It fetches the current TVL from DefiLlama API using the make_request helper.
    @mcp.tool()
    async def get_protocol_tvl(protocol: str) -> str:
        """GET /api/tvl/{protocol}
        
        Simplified endpoint to get current TVL of a protocol.
        
        Parameters:
            protocol: protocol slug (e.g., 'uniswap')
        """
        result = await make_request('GET', f'/api/tvl/{protocol}')
        return str(result)
  • Helper function used by get_protocol_tvl (and other tools) to make HTTP requests to the DefiLlama Pro API, handling errors and returning JSON or error string.
    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)}"
  • The @mcp.tool() decorator registers the get_protocol_tvl function as an MCP tool.
    @mcp.tool()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/0xReisearch/crypto-mcp-beta'

If you have feedback or need assistance with the MCP directory API, please join our Discord server