madeonsol_token_batch
Bulk lookup of up to 50 Solana token mints in one request. Uses batched database queries and parallel RPC fan-outs to reduce cost by 10-20x compared to sequential calls.
Instructions
Bulk lookup of up to 50 mints in one request. Returns the same per-mint shape as madeonsol_token_get. DB queries batched with IN(...); dex-stream + RPC fan-outs run in parallel. ~10-20× cheaper than N sequential calls — ideal for sniper pipelines scoring many tokens at once.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mints | Yes | 1–50 base58 Solana token mints |
Implementation Reference
- src/index.ts:666-674 (registration)Registration of the madeonsol_token_batch tool via server.tool(). It accepts an array of 1-50 Solana mint addresses and calls restQuery('POST', '/token/batch', { mints }) to perform a bulk token lookup.
server.tool( "madeonsol_token_batch", "Bulk lookup of up to 50 mints in one request. Returns the same per-mint shape as madeonsol_token_get. DB queries batched with IN(...); dex-stream + RPC fan-outs run in parallel. ~10-20× cheaper than N sequential calls — ideal for sniper pipelines scoring many tokens at once.", { 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", "/token/batch", { mints }) }], }) ); - src/index.ts:671-674 (handler)Handler function for madeonsol_token_batch. It receives the mints array and calls the REST API 'POST /token/batch' with those mints, returning the response as text content.
async ({ mints }) => ({ content: [{ type: "text" as const, text: await restQuery("POST", "/token/batch", { mints }) }], }) ); - src/index.ts:451-466 (helper)The restQuery helper function used by madeonsol_token_batch to make authenticated REST API calls to the MadeOnSol API. It sends a fetch request with the method, path, and optional body to BASE_URL/api/v1/{path}.
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); } - src/index.ts:669-670 (schema)Zod schema for the madeonsol_token_batch tool input. Validates that mints is an array of strings with 1 to 50 items.
{ mints: z.array(z.string()).min(1).max(50).describe("1–50 base58 Solana token mints") }, { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },