madeonsol_tokens_batch_buyer_quality
Batch score buyer quality for up to 50 Solana token mints, leveraging a shared cache for reduced cost on warm entries.
Instructions
Bulk buyer-quality scoring for up to 50 mints in one call. Shares the 5-min LRU cache with the single-mint endpoint — already-warm mints return at ~zero cost. Response includes cache_hits counter.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mints | Yes | 1–50 base58 Solana token mints |
Implementation Reference
- src/index.ts:644-652 (registration)Tool registration with server.tool() — defines the tool name, description, schema (mints array 1-50), read-only annotations, and the handler that calls restQuery().
server.tool( "madeonsol_tokens_batch_buyer_quality", "Bulk buyer-quality scoring for up to 50 mints in one call. Shares the 5-min LRU cache with the single-mint endpoint — already-warm mints return at ~zero cost. Response includes cache_hits counter.", { mints: z.array(z.string()).min(1).max(50).describe("1–50 base58 Solana token mints") }, { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }, async ({ mints }) => ({ content: [{ type: "text" as const, text: await restQuery("POST", "/tokens/batch/buyer-quality", { mints }) }], }) ); - src/index.ts:649-652 (handler)Handler function — sends a POST request to /api/v1/tokens/batch/buyer-quality with { mints } payload and returns the text response.
async ({ mints }) => ({ content: [{ type: "text" as const, text: await restQuery("POST", "/tokens/batch/buyer-quality", { mints }) }], }) ); - src/index.ts:647-648 (schema)Input schema using Zod: accepts an array of strings (base58 token mint addresses), min 1 max 50.
{ mints: z.array(z.string()).min(1).max(50).describe("1–50 base58 Solana token mints") }, { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }, - src/index.ts:451-465 (helper)Helper function restQuery() — makes authenticated HTTP requests to the API v1 endpoints and returns the JSON string response or an error message. Used by the handler to call POST /tokens/batch/buyer-quality.
async function restQuery(method: string, path: string, body?: unknown): Promise<string> { const headers: Record<string, string> = { "Content-Type": "application/json", ...apiKeyHeaders(), }; const res = await fetch(`${BASE_URL}/api/v1${path}`, { method, headers, ...(body ? { body: JSON.stringify(body) } : {}), }); if (!res.ok) { const text = await res.text().catch(() => ""); return `Error ${res.status}: ${text}`; } return JSON.stringify(await res.json(), null, 2);