hyperd.liquidation.risk
Assess cross-protocol liquidation risk for a wallet's lending positions. Get health factor, USD-at-risk, and recommendations across Aave V3, Compound v3, Spark Lend, and Morpho Blue.
Instructions
Cross-protocol liquidation risk for a wallet's lending positions. Health factor, USD-at-risk, and recommendations across Aave V3, Compound v3, Spark Lend, and Morpho Blue. Pass chain='all' for cross-chain aggregate. Costs $0.10 in USDC.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | 0x EVM wallet address | |
| chain | No | Chain to check, or 'all' for cross-chain aggregate. Default 'base'. |
Implementation Reference
- src/server.ts:357-369 (registration)Registration of the 'hyperd.liquidation.risk' tool using server.tool() with name, description, Zod schema for address and chain inputs, and a handler that calls paidGet('/api/liquidation/risk').
// hyperd.liquidation.risk — cross-protocol lending liquidation health ($0.10) server.tool( "hyperd.liquidation.risk", "Cross-protocol liquidation risk for a wallet's lending positions. Health factor, USD-at-risk, and recommendations across Aave V3, Compound v3, Spark Lend, and Morpho Blue. Pass chain='all' for cross-chain aggregate. Costs $0.10 in USDC.", { address: z.string().describe("0x EVM wallet address"), chain: z .enum(["base", "ethereum", "polygon", "arbitrum", "optimism", "avalanche", "bnb", "all"]) .optional() .describe("Chain to check, or 'all' for cross-chain aggregate. Default 'base'."), }, async (args) => asText(await paidGet("/api/liquidation/risk", args)), ); - src/server.ts:357-369 (handler)Handler logic for 'hyperd.liquidation.risk' – an async function that calls paidGet('/api/liquidation/risk') with the args (address, chain) and wraps the result via asText().
// hyperd.liquidation.risk — cross-protocol lending liquidation health ($0.10) server.tool( "hyperd.liquidation.risk", "Cross-protocol liquidation risk for a wallet's lending positions. Health factor, USD-at-risk, and recommendations across Aave V3, Compound v3, Spark Lend, and Morpho Blue. Pass chain='all' for cross-chain aggregate. Costs $0.10 in USDC.", { address: z.string().describe("0x EVM wallet address"), chain: z .enum(["base", "ethereum", "polygon", "arbitrum", "optimism", "avalanche", "bnb", "all"]) .optional() .describe("Chain to check, or 'all' for cross-chain aggregate. Default 'base'."), }, async (args) => asText(await paidGet("/api/liquidation/risk", args)), ); - src/server.ts:357-369 (schema)Zod input schema for the tool: address (required string) and chain (optional enum of chains including 'all', defaults to 'base').
// hyperd.liquidation.risk — cross-protocol lending liquidation health ($0.10) server.tool( "hyperd.liquidation.risk", "Cross-protocol liquidation risk for a wallet's lending positions. Health factor, USD-at-risk, and recommendations across Aave V3, Compound v3, Spark Lend, and Morpho Blue. Pass chain='all' for cross-chain aggregate. Costs $0.10 in USDC.", { address: z.string().describe("0x EVM wallet address"), chain: z .enum(["base", "ethereum", "polygon", "arbitrum", "optimism", "avalanche", "bnb", "all"]) .optional() .describe("Chain to check, or 'all' for cross-chain aggregate. Default 'base'."), }, async (args) => asText(await paidGet("/api/liquidation/risk", args)), ); - src/server.ts:79-92 (helper)paidGet() helper function that constructs the URL, appends query params, and calls paidRequest('GET', ...) to make an x402-authenticated paid HTTP request to the hyperD API.
async function paidGet( path: string, query: Record<string, string | number | boolean | undefined>, ): Promise<unknown> { if (!httpClient) { throw new Error(WALLET_NOT_CONFIGURED_MSG); } const url = new URL(`${API_BASE}${path}`); for (const [k, v] of Object.entries(query)) { if (v !== undefined && v !== "" && v !== null) url.searchParams.set(k, String(v)); } return paidRequest("GET", url, undefined); } - src/server.ts:155-157 (helper)asText() helper that wraps the JSON response into the MCP content format (array with a single text content block).
function asText(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; }