Skip to main content
Glama
clumsynonono

Aave Liquidation MCP Server

by clumsynonono

get_aave_reserves

Retrieve all available assets and their configurations from Aave V3 protocol to analyze positions 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

  • MCP tool handler for 'get_aave_reserves': validates no params needed, calls aaveClient.getAllReserves(), formats reserves data with parsed LTV, liquidation threshold/bonus, and returns as JSON text content.
    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 ), }, ], }; }
  • src/index.ts:96-104 (registration)
    Tool registration in ListToolsResponse: defines name 'get_aave_reserves', description, and empty inputSchema (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: {}, }, },
  • Input schema definition: empty object since no input parameters are required.
    inputSchema: { type: 'object', properties: {}, },
  • Core helper function implementing reserve fetching: caches results (1min TTL), fetches reserve tokens, parallel queries for configurations and decimals from data provider and ERC20 contracts, constructs ReserveData array.
    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