Skip to main content
Glama
clumsynonono

Aave Liquidation MCP Server

by clumsynonono

batch_check_addresses

Check multiple Ethereum addresses simultaneously for Aave V3 liquidation opportunities. Returns health status summaries for up to 20 addresses to identify at-risk positions.

Instructions

Batch check multiple Ethereum addresses for liquidation opportunities. Returns a summary of all addresses with their health status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressesYesArray of Ethereum addresses to check (max 20 addresses)

Implementation Reference

  • src/index.ts:129-146 (registration)
    Tool registration in listTools handler, including name, description, and input schema for batch_check_addresses.
    { name: 'batch_check_addresses', description: 'Batch check multiple Ethereum addresses for liquidation opportunities. Returns a summary of all addresses with their health status.', inputSchema: { type: 'object', properties: { addresses: { type: 'array', items: { type: 'string', }, description: 'Array of Ethereum addresses to check (max 20 addresses)', }, }, required: ['addresses'], }, },
  • Main handler for batch_check_addresses tool execution: validates input (addresses array <=20, valid eth addresses), calls aaveClient.batchAnalyzeLiquidation, computes summary stats (liquidatable/atRisk/healthy/failed), formats results, returns JSON response.
    case 'batch_check_addresses': { const addresses = args?.addresses as string[]; if (!Array.isArray(addresses) || addresses.length === 0) { throw new McpError( ErrorCode.InvalidParams, 'addresses parameter is required and must be a non-empty array' ); } if (addresses.length > 20) { throw new McpError( ErrorCode.InvalidParams, 'Maximum 20 addresses allowed per batch request' ); } // Validate all addresses first const invalidAddresses = addresses.filter( (addr) => typeof addr !== 'string' || !aaveClient.isValidAddress(addr) ); if (invalidAddresses.length > 0) { throw new McpError( ErrorCode.InvalidParams, `Invalid Ethereum addresses: ${invalidAddresses.join(', ')}` ); } const results = await aaveClient.batchAnalyzeLiquidation(addresses); // Calculate summary statistics let liquidatable = 0; let atRisk = 0; let healthy = 0; let failed = 0; const formattedResults = results.map((r) => { // Count statistics if (r.error) { failed++; } else if (r.opportunity?.riskLevel === 'HIGH') { liquidatable++; } else if (r.opportunity) { atRisk++; } else { healthy++; } return { address: r.address, status: r.error ? 'ERROR' : r.opportunity ? r.opportunity.riskLevel === 'HIGH' ? 'LIQUIDATABLE' : 'AT_RISK' : 'HEALTHY', healthFactor: r.opportunity?.healthFactor || 'N/A', totalDebtUSD: r.opportunity?.totalDebtUSD || '0', riskLevel: r.opportunity?.riskLevel || 'NONE', error: r.error, }; }); const summary = { totalChecked: addresses.length, successful: addresses.length - failed, failed, liquidatable, atRisk, healthy, results: formattedResults, }; return { content: [ { type: 'text', text: JSON.stringify(summary, null, 2), }, ], }; }
  • Core helper method batchAnalyzeLiquidation that concurrently (max 5 parallel) analyzes each address using analyzeLiquidationOpportunity, handles errors, returns array of results with opportunity or error per address.
    async batchAnalyzeLiquidation( addresses: string[] ): Promise<BatchAnalysisResult[]> { const results: BatchAnalysisResult[] = new Array(addresses.length); const concurrency = Math.min(5, addresses.length); let currentIndex = 0; const worker = async () => { while (true) { const idx = currentIndex++; if (idx >= addresses.length) { break; } const address = addresses[idx]; try { const opportunity = await this.analyzeLiquidationOpportunity(address); results[idx] = { address, opportunity }; } catch (error) { results[idx] = { address, opportunity: null, error: error instanceof Error ? error.message : String(error), }; } } }; await Promise.all(Array.from({ length: concurrency }, () => worker())); return results; }

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