insumer_credits
Check your verification credit balance, subscription tier (free/pro/enterprise), and daily rate limit for the current API key to determine usage capacity for on-chain attestation queries.
Instructions
Check verification credit balance, tier (free/pro/enterprise), and daily rate limit for the current API key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:447-455 (handler)The tool registration and handler for 'insumer_credits'. It calls GET /credits on the API and formats the result (credit balance, tier, rate limit).
server.tool( "insumer_credits", "Check verification credit balance, tier (free/pro/enterprise), and daily rate limit for the current API key.", {}, async () => { const result = await apiCall("GET", "/credits"); return formatResult(result); } ); - src/index.ts:447-455 (registration)The tool is registered using server.tool() with the name 'insumer_credits' on the McpServer instance.
server.tool( "insumer_credits", "Check verification credit balance, tier (free/pro/enterprise), and daily rate limit for the current API key.", {}, async () => { const result = await apiCall("GET", "/credits"); return formatResult(result); } ); - src/index.ts:17-40 (helper)The apiCall helper function used by the handler to make authenticated requests to the Insumer API.
async function apiCall( method: string, path: string, body?: Record<string, unknown> ): Promise<{ ok: boolean; data?: unknown; error?: unknown; meta?: unknown }> { if (!apiKey) { return { ok: false, error: "INSUMER_API_KEY is not set. Call the insumer_setup tool to generate a free API key instantly, then add it to your MCP config as INSUMER_API_KEY and restart." }; } const url = `${API_BASE}${path}`; const res = await fetch(url, { method, headers: { "Content-Type": "application/json", "X-API-Key": apiKey, }, body: body ? JSON.stringify(body) : undefined, }); return res.json() as Promise<{ ok: boolean; data?: unknown; error?: unknown; meta?: unknown; }>; } - src/index.ts:61-75 (helper)The formatResult helper function that formats API responses into MCP content blocks, setting isError on failure.
function formatResult(result: { ok: boolean; data?: unknown; error?: unknown; meta?: unknown; }) { if (result.ok) { return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], }; } return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], isError: true, };