Query Whale Wallets
query_whalesFilter whale wallets by blockchain, minimum balance, token, and activity. Returns wallet address, balance, token holdings, and last activity timestamp.
Instructions
List whale wallets filtered by blockchain, minimum balance, token, and activity. Returns wallet address, balance, token holdings, and last activity timestamp. Cost: $0.014 per query. Source: On-chain analytics, updated hourly.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | No | Filter by blockchain network | |
| min_balance_usd | No | Minimum wallet balance in USD | |
| token | No | Filter by token symbol (e.g. WETH, USDC) | |
| sort | No | Sort order (default: balance) | |
| limit | No | Maximum results (default 25) |
Implementation Reference
- src/tools/whales.ts:66-96 (handler)The async handler function for the 'query_whales' tool. Accepts optional chain, min_balance_usd, token, sort, and limit parameters, calls the Verilex API at /api/v1/whales, formats the response, and returns content with count summary and JSON data.
async ({ chain, min_balance_usd, token, sort, limit }) => { const res = await apiGet<WhaleQueryResponse>("/api/v1/whales", { chain, min_balance_usd, token, sort, limit: limit ?? 25, }); 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 warn = stalenessWarning(res); const summary = `${warn}Found ${count} whale wallet(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, ); - src/tools/whales.ts:40-64 (schema)Input schema for 'query_whales' using Zod validators. Defines optional chain (enum of 5 chains), min_balance_usd (number), token (string), sort (enum: balance/activity/pnl), and limit (1-100 integer).
inputSchema: { chain: z .enum(["ethereum", "arbitrum", "polygon", "base", "bsc"]) .optional() .describe("Filter by blockchain network"), min_balance_usd: z .number() .optional() .describe("Minimum wallet balance in USD"), token: z .string() .optional() .describe("Filter by token symbol (e.g. WETH, USDC)"), sort: z .enum(["balance", "activity", "pnl"]) .optional() .describe("Sort order (default: balance)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 25)"), }, - src/tools/whales.ts:32-96 (registration)Registration of the 'query_whales' tool via server.registerTool() with title, description, inputSchema, and the handler function.
server.registerTool( "query_whales", { title: "Query Whale Wallets", description: "List whale wallets filtered by blockchain, minimum balance, token, and activity. " + "Returns wallet address, balance, token holdings, and last activity timestamp. " + "Cost: $0.014 per query. Source: On-chain analytics, updated hourly.", inputSchema: { chain: z .enum(["ethereum", "arbitrum", "polygon", "base", "bsc"]) .optional() .describe("Filter by blockchain network"), min_balance_usd: z .number() .optional() .describe("Minimum wallet balance in USD"), token: z .string() .optional() .describe("Filter by token symbol (e.g. WETH, USDC)"), sort: z .enum(["balance", "activity", "pnl"]) .optional() .describe("Sort order (default: balance)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 25)"), }, }, async ({ chain, min_balance_usd, token, sort, limit }) => { const res = await apiGet<WhaleQueryResponse>("/api/v1/whales", { chain, min_balance_usd, token, sort, limit: limit ?? 25, }); 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 warn = stalenessWarning(res); const summary = `${warn}Found ${count} whale wallet(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, ); - src/index.ts:49-49 (registration)Top-level registration: registerWhaleTools(server) is called in the main server setup to activate all whale tools including query_whales.
registerWhaleTools(server); - src/client.ts:10-23 (helper)Helper function buildUrl used by apiGet to construct the full URL with query parameters for the API call.
function buildUrl( path: string, params?: Record<string, string | number | undefined>, ): string { const url = new URL(path, baseUrl); if (params) { for (const [k, v] of Object.entries(params)) { if (v !== undefined && v !== "") { url.searchParams.set(k, String(v)); } } } return url.toString(); }