get_token_protocols
Retrieve token distribution across protocols by specifying a token symbol (e.g., 'usdt') to analyze its allocation within DeFi ecosystems.
Instructions
GET /api/tokenProtocols/{symbol}
Lists the amount of a certain token within all protocols.
Parameters:
symbol: token slug (e.g., 'usdt')
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes |
Implementation Reference
- defillama_server.py:40-49 (handler)The handler function implementing the get_token_protocols tool. It takes a token symbol, calls the DefiLlama API endpoint /api/tokenProtocols/{symbol}, and returns the result as a string.async def get_token_protocols(symbol: str) -> str: """GET /api/tokenProtocols/{symbol} Lists the amount of a certain token within all protocols. Parameters: symbol: token slug (e.g., 'usdt') """ result = await make_request('GET', f'/api/tokenProtocols/{symbol}') return str(result)
- defillama_server.py:39-39 (registration)The @mcp.tool() decorator registers the get_token_protocols function as an MCP tool.@mcp.tool()
- defillama_server.py:46-47 (schema)Input schema defined by function parameter symbol: str and docstring description.symbol: token slug (e.g., 'usdt') """
- defillama_server.py:30-37 (helper)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)}"