Skip to main content
Glama
clumsynonono

Aave Liquidation MCP Server

by clumsynonono

get_aave_reserves

Retrieve all available assets and their configurations from the Aave V3 protocol to analyze lending pools and identify liquidation opportunities.

Instructions

Get list of all available reserves (assets) in Aave V3 protocol with their configuration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:96-104 (registration)
    Registration of the 'get_aave_reserves' tool including its name, description, and empty input schema (no parameters required).
    { name: 'get_aave_reserves', description: 'Get list of all available reserves (assets) in Aave V3 protocol with their configuration.', inputSchema: { type: 'object', properties: {}, }, },
  • Handler for the 'get_aave_reserves' tool. Fetches reserves using AaveClient and returns formatted JSON response.
    case 'get_aave_reserves': { const reserves = await aaveClient.getAllReserves(); return { content: [ { type: 'text', text: JSON.stringify( { totalReserves: reserves.length, reserves: reserves.map((r) => ({ symbol: r.symbol, address: r.tokenAddress, decimals: r.decimals, ltv: parseFloat((Number(r.ltv) / 10000).toFixed(4)), liquidationThreshold: parseFloat((Number(r.liquidationThreshold) / 10000).toFixed(4)), liquidationBonus: parseFloat(((Number(r.liquidationBonus) - 10000) / 10000).toFixed(4)), canBeCollateral: r.usageAsCollateralEnabled, canBeBorrowed: r.borrowingEnabled, isActive: r.isActive, })), }, null, 2 ), }, ], }; }
  • Core helper function getAllReserves() in AaveClient that fetches all Aave V3 reserves data using parallel queries and caching.
    async getAllReserves(): Promise<ReserveData[]> { // Return cached data if still valid const now = Date.now(); if (this.reserveCache && (now - this.reserveCacheTime) < this.CACHE_TTL) { return this.reserveCache; } const reserveTokens = await this.dataProviderContract.getAllReservesTokens(); // Parallel query all configurations and decimals const configPromises = reserveTokens.map((reserve: { tokenAddress: string }) => this.dataProviderContract.getReserveConfigurationData(reserve.tokenAddress) ); const decimalsPromises = reserveTokens.map((reserve: { tokenAddress: string }) => { const tokenContract = new ethers.Contract(reserve.tokenAddress, ERC20_ABI, this.provider); return tokenContract.decimals(); }); const [configs, decimalsList] = await Promise.all([ Promise.all(configPromises), Promise.all(decimalsPromises), ]); const reserves: ReserveData[] = reserveTokens.map( (reserve: { symbol: string; tokenAddress: string }, index: number) => ({ symbol: reserve.symbol, tokenAddress: reserve.tokenAddress, decimals: Number(decimalsList[index]), ltv: configs[index].ltv, liquidationThreshold: configs[index].liquidationThreshold, liquidationBonus: configs[index].liquidationBonus, usageAsCollateralEnabled: configs[index].usageAsCollateralEnabled, borrowingEnabled: configs[index].borrowingEnabled, isActive: configs[index].isActive, }) ); // Update cache this.reserveCache = reserves; this.reserveCacheTime = now; return reserves; }

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/clumsynonono/aave-liquidation-mcp'

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