Market Stress Indices
query_network_stressAssess network-level market stress across blockchains using liquidation, gas, and failure data. Returns a 0-100 composite score for macro DeFi risk analysis.
Instructions
Get network-level market stress indices combining liquidation intensity, gas costs, and execution failure rates. Provides a 0-100 composite stress score per blockchain. Useful for macro risk assessment across DeFi lending. Source: Liquidationbot real-time telemetry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| window | No | Time window for aggregation (default: 1h) | |
| network | No | Filter by blockchain network |
Implementation Reference
- src/tools/crypto.ts:113-162 (registration)Registration of the 'query_network_stress' tool via server.registerTool() with its input schema (window, network) and async handler.
server.registerTool( "query_network_stress", { title: "Market Stress Indices", description: "Get network-level market stress indices combining liquidation intensity, " + "gas costs, and execution failure rates. Provides a 0-100 composite stress " + "score per blockchain. Useful for macro risk assessment across DeFi lending. " + "Source: Liquidationbot real-time telemetry.", inputSchema: { window: z .enum(["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"), }, }, async ({ window, network }) => { const res = await apiGet<CryptoQueryResponse>( "/api/v1/crypto/risk/networks", { window: window ?? "1h", network, }, ); 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} network stress 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:133-161 (handler)Async handler function that calls apiGet('/api/v1/crypto/risk/networks') with window and network params, then returns formatted text content with results or error.
async ({ window, network }) => { const res = await apiGet<CryptoQueryResponse>( "/api/v1/crypto/risk/networks", { window: window ?? "1h", network, }, ); 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} network stress 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:122-132 (schema)Input schema for query_network_stress: optional 'window' enum (1h/24h/7d) and optional 'network' enum (ethereum/arbitrum/polygon/base/bsc/avalanche).
inputSchema: { window: z .enum(["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"), }, }, - src/client.ts:44-76 (helper)apiGet() helper function used by the handler to make HTTP GET requests to the Verilex API.
export async function apiGet<T = unknown>( path: string, params?: Record<string, string | number | undefined>, ): Promise<ApiResponse<T>> { const url = buildUrl(path, params); const headers: Record<string, string> = { Accept: "application/json", "User-Agent": "verilex-mcp-server/0.1.0", }; // Forward x402 payment token if present in env (for paid endpoints) const paymentToken = process.env.VERILEX_PAYMENT_TOKEN; if (paymentToken) { headers["X-Payment-Token"] = paymentToken; } const res = await fetch(url, { headers }); const data = (await res.json()) as T; const stale = res.headers.get("X-Data-Stale"); const lastUpdated = res.headers.get("X-Data-Last-Updated"); const ageSeconds = res.headers.get("X-Data-Age-Seconds"); return { ok: res.ok, status: res.status, data, stale: stale === "true", lastUpdated: lastUpdated ?? undefined, ageSeconds: ageSeconds ? Number(ageSeconds) : undefined, }; }