Skip to main content
Glama
clumsynonono

Aave Liquidation MCP Server

by clumsynonono

get_asset_price

Retrieve current asset prices from Aave oracles to monitor collateral values, assess liquidation risks, and analyze protocol positions.

Instructions

Get current price for a specific asset from Aave oracle.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assetAddressYesToken contract address

Implementation Reference

  • src/index.ts:105-119 (registration)
    Tool registration in the listTools handler, including name, description, and input schema definition.
    { name: 'get_asset_price', description: 'Get current price for a specific asset from Aave oracle.', inputSchema: { type: 'object', properties: { assetAddress: { type: 'string', description: 'Token contract address', }, }, required: ['assetAddress'], }, },
  • Primary MCP tool handler that validates the assetAddress input and calls the AaveClient to retrieve the price, then formats the response.
    case 'get_asset_price': { const assetAddress = args?.assetAddress as string; if (!assetAddress || typeof assetAddress !== 'string') { throw new McpError( ErrorCode.InvalidParams, 'assetAddress parameter is required and must be a string' ); } if (!aaveClient.isValidAddress(assetAddress)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid Ethereum address format' ); } const price = await aaveClient.getAssetPrice(assetAddress); return { content: [ { type: 'text', text: JSON.stringify( { assetAddress, priceUSD: price, }, null, 2 ), }, ], }; }
  • Helper method in AaveClient that queries the Aave oracle contract for the asset price and formats it to USD string.
    async getAssetPrice(assetAddress: string): Promise<string> { const price = await this.oracleContract.getAssetPrice(assetAddress); // Oracle returns price with 8 decimals return ethers.formatUnits(price, 8); }

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