Query Top Holders
query_holdersIdentify top token holders with wallet addresses, balances, percentage of supply, and holder labels (exchange, whale, contract).
Instructions
Get the top holders for a token contract address. Returns wallet addresses, balances, percentage of supply, and holder labels (exchange, whale, contract). Cost: $0.04 per query. Source: On-chain token analytics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | Token contract address (e.g. 0xdAC17F958D2ee523a2206206994597C13D831ec7) | |
| chain | No | Blockchain network (default: ethereum) | |
| limit | No | Maximum results (default 25) |
Implementation Reference
- src/tools/holders.ts:56-86 (handler)The async handler function for the 'query_holders' tool. Makes an API GET request to /api/v1/holders/{token}, passes chain and limit params, and returns formatted results with holder count and JSON data.
async ({ token, chain, limit }) => { const res = await apiGet<HolderQueryResponse>( `/api/v1/holders/${encodeURIComponent(token)}`, { chain, 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} holder(s) for token ${token}.`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, ); - src/tools/holders.ts:39-55 (schema)Input schema for 'query_holders' using Zod validation: token (string, required), chain (enum: ethereum/arbitrum/polygon/base/bsc, optional), limit (int 1-100, optional, default 25).
inputSchema: { token: z .string() .describe("Token contract address (e.g. 0xdAC17F958D2ee523a2206206994597C13D831ec7)"), chain: z .enum(["ethereum", "arbitrum", "polygon", "base", "bsc"]) .optional() .describe("Blockchain network (default: ethereum)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 25)"), }, }, - src/tools/holders.ts:31-86 (registration)Registration of the 'query_holders' tool via server.registerTool(), including title/description metadata, input schema, and the async handler.
server.registerTool( "query_holders", { title: "Query Top Holders", description: "Get the top holders for a token contract address. Returns wallet addresses, " + "balances, percentage of supply, and holder labels (exchange, whale, contract). " + "Cost: $0.04 per query. Source: On-chain token analytics.", inputSchema: { token: z .string() .describe("Token contract address (e.g. 0xdAC17F958D2ee523a2206206994597C13D831ec7)"), chain: z .enum(["ethereum", "arbitrum", "polygon", "base", "bsc"]) .optional() .describe("Blockchain network (default: ethereum)"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 25)"), }, }, async ({ token, chain, limit }) => { const res = await apiGet<HolderQueryResponse>( `/api/v1/holders/${encodeURIComponent(token)}`, { chain, 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} holder(s) for token ${token}.`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, ); - src/index.ts:51-51 (registration)Top-level registration: registerHolderTools(server) is called to wire up all holder tools including 'query_holders'.
registerHolderTools(server); - src/client.ts:44-76 (helper)The apiGet helper function used by the handler to make HTTP GET requests to the Verilex API, handling response parsing and staleness headers.
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, }; }