query_protocol_risk
Analyze liquidation pressure and stress scores for DeFi lending protocols. Identify high-risk accounts, health factor deterioration, and debt at risk across multiple blockchain networks.
Instructions
Get liquidation pressure and stress scores for DeFi lending protocols. Shows critical/high-risk account counts, health factor deterioration rate, and total debt at risk per protocol. Covers Aave V3, Compound V3, Venus, Radiant, Morpho Blue, LlamaLend, ZeroLend, MakerDAO across 6 chains. Source: Liquidationbot real-time telemetry.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| window | No | Time window for aggregation (default: 1h) | |
| network | No | Filter by blockchain network | |
| protocol | No | Filter by lending protocol | |
| limit | No | Maximum results (default 100) |
Implementation Reference
- src/tools/crypto.ts:78-108 (handler)The handler function for the `query_protocol_risk` tool which calls the `/api/v1/crypto/risk/protocols` endpoint.
async ({ window, network, protocol, limit }) => { const res = await apiGet<CryptoQueryResponse>( "/api/v1/crypto/risk/protocols", { window: window ?? "1h", network, protocol, limit: limit ?? 100, }, ); if (!res.ok) { return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } const { count, data } = res.data; const summary = `Found ${count} protocol risk record(s) for window=${window ?? "1h"}.`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, - src/tools/crypto.ts:37-77 (registration)Registration of the `query_protocol_risk` tool with its schema definition.
server.registerTool( "query_protocol_risk", { title: "Protocol Risk Monitor", description: "Get liquidation pressure and stress scores for DeFi lending protocols. " + "Shows critical/high-risk account counts, health factor deterioration rate, " + "and total debt at risk per protocol. Covers Aave V3, Compound V3, Venus, " + "Radiant, Morpho Blue, LlamaLend, ZeroLend, MakerDAO across 6 chains. " + "Source: Liquidationbot real-time telemetry.", inputSchema: { window: z .enum(["5m", "1h", "24h", "7d"]) .optional() .describe("Time window for aggregation (default: 1h)"), network: z .enum(["ethereum", "arbitrum", "polygon", "base", "bsc", "avalanche"]) .optional() .describe("Filter by blockchain network"), protocol: z .enum([ "aave_v3", "compound_v3", "venus", "radiant", "morpho_blue", "llamalend", "zerolend", "makerdao", ]) .optional() .describe("Filter by lending protocol"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 100)"), }, },