get_invoices
Retrieve billing history and Stripe invoices, including amounts, credits, dates, and statuses. Supports pagination with a cursor for navigating results.
Instructions
Get billing history (Stripe invoices). Response: { invoices: [{ amount, credits, date, status }], has_more, cursor }. Pass cursor to paginate.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Pagination cursor (payment intent ID) for next page |
Implementation Reference
- src/index.ts:805-821 (registration)The 'get_invoices' tool is registered using server.tool() with Zod schema for the optional 'cursor' parameter.
server.tool( "get_invoices", "Get billing history (Stripe invoices). Response: { invoices: [{ amount, credits, date, status }], has_more, cursor }. Pass cursor to paginate.", { cursor: z.string().optional().describe("Pagination cursor (payment intent ID) for next page"), }, async ({ cursor }) => { const guard = requireApiKey(); if (guard) return guard; const params = cursor ? `?cursor=${encodeURIComponent(cursor)}` : ""; const result = await apiFetch(`/api/stripe-invoices${params}`, { method: "GET", headers: apiKeyHeaders(), }); return formatResult(result); } ); - src/index.ts:811-821 (handler)The handler function calls requireApiKey() to guard authentication, then fetches GET /api/stripe-invoices with an optional pagination cursor parameter.
async ({ cursor }) => { const guard = requireApiKey(); if (guard) return guard; const params = cursor ? `?cursor=${encodeURIComponent(cursor)}` : ""; const result = await apiFetch(`/api/stripe-invoices${params}`, { method: "GET", headers: apiKeyHeaders(), }); return formatResult(result); } ); - src/index.ts:808-810 (schema)Zod schema for get_invoices: accepts an optional 'cursor' string parameter for pagination of billing history.
{ cursor: z.string().optional().describe("Pagination cursor (payment intent ID) for next page"), },