@guillaume_code_2012/stripe-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/server.ts","../src/tools/customers/create-customer.ts","../src/config.ts","../src/utils/format-stripe-error.ts","../src/utils/object.ts","../src/tools/customers/get-customer.ts","../src/tools/customers/update-customer.ts","../src/tools/customers/delete-customer.ts","../src/tools/customers/list-customers.ts","../src/utils/pagination.ts","../src/tools/customers/search-customers.ts","../src/tools/customers/index.ts","../src/tools/products/create-product.ts","../src/tools/products/get-product.ts","../src/tools/products/update-product.ts","../src/tools/products/archive-product.ts","../src/tools/products/list-products.ts","../src/tools/products/index.ts","../src/tools/prices/create-price.ts","../src/tools/prices/get-price.ts","../src/tools/prices/update-price.ts","../src/tools/prices/list-prices.ts","../src/tools/prices/index.ts","../src/tools/subscriptions/create-subscription.ts","../src/tools/subscriptions/get-subscription.ts","../src/tools/subscriptions/update-subscription.ts","../src/tools/subscriptions/cancel-subscription.ts","../src/tools/subscriptions/pause-subscription.ts","../src/tools/subscriptions/resume-subscription.ts","../src/tools/subscriptions/list-subscriptions.ts","../src/tools/subscriptions/search-subscriptions.ts","../src/tools/subscriptions/index.ts","../src/tools/invoices/get-invoice.ts","../src/tools/invoices/list-invoices.ts","../src/tools/invoices/pay-invoice.ts","../src/tools/invoices/void-invoice.ts","../src/tools/invoices/finalize-invoice.ts","../src/tools/invoices/send-invoice.ts","../src/tools/invoices/index.ts","../src/tools/payment-intents/create-payment-intent.ts","../src/tools/payment-intents/get-payment-intent.ts","../src/tools/payment-intents/confirm-payment-intent.ts","../src/tools/payment-intents/cancel-payment-intent.ts","../src/tools/payment-intents/list-payment-intents.ts","../src/tools/payment-intents/index.ts","../src/tools/refunds/create-refund.ts","../src/tools/refunds/get-refund.ts","../src/tools/refunds/list-refunds.ts","../src/tools/refunds/index.ts","../src/tools/disputes/get-dispute.ts","../src/tools/disputes/update-dispute.ts","../src/tools/disputes/close-dispute.ts","../src/tools/disputes/list-disputes.ts","../src/tools/disputes/index.ts","../src/tools/webhooks/create-webhook.ts","../src/tools/webhooks/get-webhook.ts","../src/tools/webhooks/update-webhook.ts","../src/tools/webhooks/delete-webhook.ts","../src/tools/webhooks/list-webhooks.ts","../src/tools/webhooks/index.ts","../src/tools/coupons/create-coupon.ts","../src/tools/coupons/get-coupon.ts","../src/tools/coupons/delete-coupon.ts","../src/tools/coupons/list-coupons.ts","../src/tools/coupons/index.ts","../src/tools/promotion-codes/create-promotion-code.ts","../src/tools/promotion-codes/get-promotion-code.ts","../src/tools/promotion-codes/list-promotion-codes.ts","../src/tools/promotion-codes/index.ts","../src/tools/payment-links/create-payment-link.ts","../src/tools/payment-links/get-payment-link.ts","../src/tools/payment-links/update-payment-link.ts","../src/tools/payment-links/list-payment-links.ts","../src/tools/payment-links/index.ts","../src/tools/checkout/create-checkout-session.ts","../src/tools/checkout/get-checkout-session.ts","../src/tools/checkout/expire-checkout-session.ts","../src/tools/checkout/list-checkout-sessions.ts","../src/tools/checkout/index.ts","../src/tools/billing-portal/create-portal-session.ts","../src/tools/billing-portal/index.ts","../src/tools/balance/get-balance.ts","../src/tools/balance/list-balance-transactions.ts","../src/tools/balance/index.ts","../src/tools/payouts/create-payout.ts","../src/tools/payouts/get-payout.ts","../src/tools/payouts/cancel-payout.ts","../src/tools/payouts/list-payouts.ts","../src/tools/payouts/index.ts","../src/tools/tax/create-tax-rate.ts","../src/tools/tax/get-tax-rate.ts","../src/tools/tax/list-tax-rates.ts","../src/tools/tax/index.ts","../src/tools/meters/create-meter.ts","../src/tools/meters/get-meter.ts","../src/tools/meters/list-meters.ts","../src/tools/meters/index.ts","../src/tools/analytics/get-mrr.ts","../src/utils/currency.ts","../src/utils/date.ts","../src/tools/analytics/get-churn-rate.ts","../src/tools/analytics/get-revenue-summary.ts","../src/tools/analytics/get-top-customers.ts","../src/tools/analytics/get-failed-payments-report.ts","../src/tools/analytics/index.ts","../src/tools/index.ts","../src/doctor.ts","../src/cli.ts"],"sourcesContent":["import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { createServer } from './server.js';\nimport { config } from './config.js';\nimport { handleCliArgs } from './cli.js';\n\nasync function main(): Promise<void> {\n // Handle --help / --version / --list-tools / --list-categories / --doctor\n // first. These exit early and never start the stdio server.\n if (await handleCliArgs(process.argv)) {\n return;\n }\n\n if (config.stripeMode === 'live') {\n console.error('⚠️ LIVE MODE — real money affected. Proceed with caution.');\n } else {\n console.error('✓ Test mode (no real charges).');\n }\n\n const server = createServer();\n const transport = new StdioServerTransport();\n await server.connect(transport);\n console.error('stripe-mcp running on stdio');\n}\n\nmain().catch((error) => {\n console.error('Fatal error starting stripe-mcp:', error);\n process.exit(1);\n});\n","import { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\nimport { allTools } from './tools/index.js';\n\n/**\n * Build and configure the MCP server with all stripe-mcp tools registered.\n * Exposed as a factory so tests can construct isolated instances.\n */\nexport function createServer(): Server {\n const server = new Server(\n { name: 'stripe-mcp', version: '1.0.0' },\n { capabilities: { tools: {} } },\n );\n\n server.setRequestHandler(ListToolsRequestSchema, async () => ({\n tools: allTools.map((t) => t.definition),\n }));\n\n server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const name = request.params.name;\n const tool = allTools.find((t) => t.definition.name === name);\n if (!tool) {\n return {\n content: [{ type: 'text', text: `Unknown tool: ${name}` }],\n isError: true,\n };\n }\n try {\n const result = await tool.execute(request.params.arguments ?? {});\n // A tool returns a string. If it starts with ❌/🚫/⚠️ etc. treat as error.\n const isError = /^(❌|🚫|⚠️|🔐|⏳|🔌|Validation error:|Unknown error:)/.test(result);\n return {\n content: [{ type: 'text', text: result }],\n isError,\n };\n } catch (error) {\n return {\n content: [\n {\n type: 'text',\n text: `Unexpected error executing ${name}: ${\n error instanceof Error ? error.message : String(error)\n }`,\n },\n ],\n isError: true,\n };\n }\n });\n\n return server;\n}\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst addressSchema = z\n .object({\n line1: z.string().optional().describe('First line of the address'),\n line2: z.string().optional().describe('Second line of the address'),\n city: z.string().optional().describe('City, district, or suburb'),\n state: z.string().optional().describe('State, county, or province'),\n postal_code: z.string().optional().describe('ZIP or postal code'),\n country: z.string().optional().describe('Two-letter ISO country code (e.g. \"US\")'),\n })\n .describe('Customer billing address');\n\nconst shippingSchema = z\n .object({\n name: z.string().describe('Recipient name'),\n phone: z.string().optional().describe('Recipient phone number'),\n address: addressSchema.describe('Shipping address'),\n })\n .describe('Customer shipping information');\n\nconst inputSchema = z.object({\n email: z.string().email().optional().describe('Customer email address'),\n name: z.string().optional().describe('Customer full name or business name'),\n phone: z.string().optional().describe('Customer phone number'),\n description: z.string().optional().describe('Internal description shown in the Stripe dashboard'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Arbitrary key-value pairs attached to the customer (keys and values are strings)'),\n address: addressSchema.optional(),\n shipping: shippingSchema.optional(),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_customers_create',\n description: `Create a new customer in Stripe.\n\nUse this when:\n- A new user signs up and needs a Stripe customer record\n- You need to create a customer before attaching a payment method or subscription\n\nReturns: the created Stripe Customer object.\nStripe docs: https://stripe.com/docs/api/customers/create`,\n inputSchema: {\n type: 'object',\n properties: {\n email: { type: 'string', description: 'Customer email address' },\n name: { type: 'string', description: 'Customer full name or business name' },\n phone: { type: 'string', description: 'Customer phone number' },\n description: { type: 'string', description: 'Internal description shown in the Stripe dashboard' },\n metadata: {\n type: 'object',\n description: 'Arbitrary key-value pairs attached to the customer (keys and values are strings)',\n additionalProperties: { type: 'string' },\n },\n address: {\n type: 'object',\n description: 'Customer billing address',\n properties: {\n line1: { type: 'string', description: 'First line of the address' },\n line2: { type: 'string', description: 'Second line of the address' },\n city: { type: 'string', description: 'City, district, or suburb' },\n state: { type: 'string', description: 'State, county, or province' },\n postal_code: { type: 'string', description: 'ZIP or postal code' },\n country: { type: 'string', description: 'Two-letter ISO country code (e.g. \"US\")' },\n },\n required: [],\n },\n shipping: {\n type: 'object',\n description: 'Customer shipping information',\n properties: {\n name: { type: 'string', description: 'Recipient name' },\n phone: { type: 'string', description: 'Recipient phone number' },\n address: {\n type: 'object',\n description: 'Shipping address',\n properties: {\n line1: { type: 'string', description: 'First line of the address' },\n line2: { type: 'string', description: 'Second line of the address' },\n city: { type: 'string', description: 'City, district, or suburb' },\n state: { type: 'string', description: 'State, county, or province' },\n postal_code: { type: 'string', description: 'ZIP or postal code' },\n country: { type: 'string', description: 'Two-letter ISO country code (e.g. \"US\")' },\n },\n required: [],\n },\n },\n required: ['name', 'address'],\n },\n },\n required: [],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.customers.create(\n buildStripeParams<Stripe.CustomerCreateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import Stripe from 'stripe';\n\nlet stripeClient: Stripe | null = null;\n\n/**\n * Lazily construct (and cache) the Stripe client from the\n * STRIPE_SECRET_KEY environment variable.\n *\n * Throws a clear, actionable error if the key is missing so the MCP\n * client surfaces it instead of a cryptic auth failure.\n */\nexport function getStripeClient(): Stripe {\n if (!stripeClient) {\n const apiKey = process.env.STRIPE_SECRET_KEY;\n if (!apiKey) {\n throw new Error(\n 'STRIPE_SECRET_KEY is required. Get yours at https://dashboard.stripe.com/apikeys',\n );\n }\n // We intentionally do NOT pin `apiVersion`. The Stripe SDK's config type\n // restricts it to a single `LatestApiVersion` literal that changes every\n // release; pinning a stale string would fail typecheck, and pinning the\n // current literal would break on the next SDK upgrade. Omitting it lets\n // Stripe use the version bundled with the installed SDK (the latest\n // stable), which is Stripe's recommended default unless you are mid-\n // migration. See DECISIONS.md 008.\n stripeClient = new Stripe(apiKey, {\n appInfo: { name: 'stripe-mcp', version: '1.0.0' },\n typescript: true,\n });\n }\n return stripeClient;\n}\n\n/** Reset the cached client — primarily for tests. */\nexport function resetStripeClient(): void {\n stripeClient = null;\n}\n\nexport const config = {\n stripeMode: process.env.STRIPE_SECRET_KEY?.startsWith('sk_live_') ? 'live' : 'test',\n} as const;\n","import type Stripe from 'stripe';\n\n/**\n * Convert any Stripe SDK error into a human-readable, actionable string.\n * Never throws — returns a fallback message for unknown error shapes.\n *\n * Each branch includes a concrete fix and a docs link so the LLM (and the\n * human behind it) knows exactly what to do next.\n *\n * Note: Stripe's error class type is exposed as `Stripe.errors.StripeError`\n * (a namespace), not `Stripe.Error`.\n */\nexport function formatStripeError(error: unknown): string {\n // Stripe errors carry a `type` discriminator. `Stripe.errors.StripeError`\n // is an instance type; we only need its shape for safe property access.\n const stripeError = error as Partial<Stripe.errors.StripeError> & {\n type?: string;\n message?: string;\n statusCode?: number;\n doc_url?: string;\n param?: string;\n requestId?: string;\n };\n\n if (!stripeError || typeof stripeError !== 'object') {\n return `Unknown error: ${String(error)}`;\n }\n\n const type = stripeError.type ?? 'unknown';\n const message = stripeError.message ?? 'No message provided by Stripe.';\n const param = stripeError.param ? `\\n - Invalid parameter: \\`${stripeError.param}\\`` : '';\n const doc = stripeError.doc_url ? `\\n - Docs: ${stripeError.doc_url}` : '';\n const requestId = stripeError.requestId ? `\\n - Request ID: ${stripeError.requestId}` : '';\n\n switch (type) {\n case 'StripeCardError':\n return [\n '❌ Card error — the card was declined or invalid.',\n ` - ${message}`,\n ' - How to fix: use a different card, or ask the customer to contact their bank.',\n ' - Decline codes: https://stripe.com/docs/declines/codes',\n doc,\n requestId,\n ]\n .filter(Boolean)\n .join('\\n');\n\n case 'StripeRateLimitError':\n return [\n '⏳ Rate limit exceeded — too many requests to Stripe.',\n ' - How to fix: wait a few seconds and retry. Reduce polling frequency.',\n ' - Rate limits: https://stripe.com/docs/rate-limits',\n requestId,\n ]\n .filter(Boolean)\n .join('\\n');\n\n case 'StripeInvalidRequestError':\n return [\n '🚫 Invalid request — a parameter was missing or malformed.',\n ` - ${message}`,\n param,\n ' - How to fix: correct the parameter and retry.',\n ' - API reference: https://stripe.com/docs/api',\n doc,\n requestId,\n ]\n .filter(Boolean)\n .join('\\n');\n\n case 'StripeAuthenticationError':\n return [\n '🔐 Authentication failed — your Stripe secret key is invalid or expired.',\n ' - How to fix: generate a new key at https://dashboard.stripe.com/apikeys',\n ' - Make sure STRIPE_SECRET_KEY is set correctly (starts with sk_test_ or sk_live_).',\n requestId,\n ]\n .filter(Boolean)\n .join('\\n');\n\n case 'StripeAPIError':\n return [\n '⚠️ Stripe API error — something went wrong on Stripe\\'s side.',\n ` - ${message}`,\n ' - How to fix: retry with exponential backoff. If it persists, check https://status.stripe.com/',\n ' - Support: https://support.stripe.com/',\n doc,\n requestId,\n ]\n .filter(Boolean)\n .join('\\n');\n\n case 'StripeConnectionError':\n return [\n '🔌 Connection error — network failure communicating with Stripe.',\n ` - ${message}`,\n ' - How to fix: check your network/DNS, then retry. Verify https://status.stripe.com/',\n requestId,\n ]\n .filter(Boolean)\n .join('\\n');\n\n case 'StripePermissionError':\n return [\n '🚫 Permission denied — your key lacks the required scope for this operation.',\n ` - ${message}`,\n ' - How to fix: use a key with broader permissions, or restrict the operation to an allowed account.',\n requestId,\n ]\n .filter(Boolean)\n .join('\\n');\n\n default:\n return [\n `❌ Stripe error (${type}):`,\n ` - ${message}`,\n param,\n doc,\n requestId,\n ` - Status code: ${stripeError.statusCode ?? 'n/a'}`,\n ]\n .filter(Boolean)\n .join('\\n');\n }\n}\n","/**\n * Build a Stripe SDK params object from a zod-parsed input, dropping any\n * keys whose value is `undefined`.\n *\n * Why this exists: the project enables `exactOptionalPropertyTypes`, under\n * which an object with `{ email: undefined }` is NOT assignable to a Stripe\n * params type that declares `email?: string`. zod's `.optional()` produces\n * `string | undefined`, so we filter undefineds here and cast to the target\n * params type. Runtime behaviour is identical (Stripe ignores undefined keys\n * anyway), but this keeps TypeScript strict and the codebase cast-free.\n *\n * @example\n * const customer = await stripe.customers.create(\n * buildStripeParams<Stripe.CustomerCreateParams>(parsed.data),\n * );\n */\nexport function buildStripeParams<P>(obj: Record<string, unknown>): P {\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined) {\n out[key] = value;\n }\n }\n return out as P;\n}\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n customer_id: z\n .string()\n .min(1)\n .describe('Stripe customer ID (e.g. \"cus_1a2b3c\")'),\n expand: z\n .array(z.string())\n .optional()\n .describe(\n 'Fields to expand. Commonly useful values: \"default_payment_method\", \"subscriptions\", \"sources\", \"invoice_settings.default_payment_method\".',\n ),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_customers_get',\n description: `Retrieve a single Stripe customer by ID.\n\nUse this when:\n- You need the full customer object (email, name, balance, default payment method, etc.)\n- You need to expand related objects like subscriptions or default payment method\n\nReturns: the Stripe Customer object (or a DeletedCustomer if it was deleted).\nStripe docs: https://stripe.com/docs/api/customers/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n customer_id: { type: 'string', description: 'Stripe customer ID (e.g. \"cus_1a2b3c\")' },\n expand: {\n type: 'array',\n items: { type: 'string' },\n description:\n 'Fields to expand. Commonly useful values: \"default_payment_method\", \"subscriptions\", \"sources\", \"invoice_settings.default_payment_method\".',\n },\n },\n required: ['customer_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.customers.retrieve(\n parsed.data.customer_id,\n buildStripeParams<Stripe.CustomerRetrieveParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n customer_id: z\n .string()\n .min(1)\n .describe('Stripe customer ID to update (e.g. \"cus_1a2b3c\")'),\n email: z.string().email().optional().describe('New customer email address'),\n name: z.string().optional().describe('New customer full name or business name'),\n phone: z.string().optional().describe('New customer phone number'),\n description: z.string().optional().describe('New internal description'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Arbitrary key-value pairs to attach. Pass an empty string for a key to unset it.',\n ),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_customers_update',\n description: `Update an existing Stripe customer.\n\nUse this when:\n- A customer changes their email, name, phone, or description\n- You want to attach or update metadata on a customer\n\nReturns: the updated Stripe Customer object.\nStripe docs: https://stripe.com/docs/api/customers/update`,\n inputSchema: {\n type: 'object',\n properties: {\n customer_id: { type: 'string', description: 'Stripe customer ID to update (e.g. \"cus_1a2b3c\")' },\n email: { type: 'string', description: 'New customer email address' },\n name: { type: 'string', description: 'New customer full name or business name' },\n phone: { type: 'string', description: 'New customer phone number' },\n description: { type: 'string', description: 'New internal description' },\n metadata: {\n type: 'object',\n description:\n 'Arbitrary key-value pairs to attach. Pass an empty string for a key to unset it.',\n additionalProperties: { type: 'string' },\n },\n },\n required: ['customer_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { customer_id: customerId, ...rest } = parsed.data;\n const result = await stripe.customers.update(\n customerId,\n buildStripeParams<Stripe.CustomerUpdateParams>(rest),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\n\nconst inputSchema = z.object({\n customer_id: z\n .string()\n .min(1)\n .describe('Stripe customer ID to permanently delete (e.g. \"cus_1a2b3c\")'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_customers_delete',\n description: `Permanently delete a Stripe customer.\n\nUse this when:\n- A user requests account deletion (GDPR / right-to-be-forgotten)\n- You are cleaning up test customers\n\nIMPORTANT: this cannot be undone. It also immediately cancels any active subscriptions on the customer.\n\nReturns: a Stripe DeletedCustomer object (with \\`deleted: true\\`).\nStripe docs: https://stripe.com/docs/api/customers/delete`,\n inputSchema: {\n type: 'object',\n properties: {\n customer_id: {\n type: 'string',\n description: 'Stripe customer ID to permanently delete (e.g. \"cus_1a2b3c\")',\n },\n },\n required: ['customer_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.customers.del(parsed.data.customer_id);\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Page size (1-100). Note: results are auto-paginated up to max_items.'),\n email: z\n .string()\n .optional()\n .describe('Optional exact case-sensitive filter on the customer email field'),\n starting_after: z\n .string()\n .optional()\n .describe('Cursor: a customer ID to start after (used for manual pagination)'),\n max_items: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Cap on total returned items (default 1000). Use to bound large accounts.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_customers_list',\n description: `List Stripe customers with auto-pagination.\n\nUse this when:\n- You need to enumerate all or many customers (e.g. for a dashboard, sync, or report)\n- You want to filter by an exact email match\n\nThis tool auto-paginates through every page up to \\`max_items\\` (default 1000). The response is wrapped as \\`{ total_count, has_more, data }\\` where \\`has_more\\` is true only if the cap was hit before exhausting all results.\n\nReturns: an object with \\`total_count\\`, \\`has_more\\`, and \\`data\\` (array of Customer objects).\nStripe docs: https://stripe.com/docs/api/customers/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: {\n type: 'integer',\n minimum: 1,\n maximum: 100,\n description: 'Page size (1-100). Note: results are auto-paginated up to max_items.',\n },\n email: {\n type: 'string',\n description: 'Optional exact case-sensitive filter on the customer email field',\n },\n starting_after: {\n type: 'string',\n description: 'Cursor: a customer ID to start after (used for manual pagination)',\n },\n max_items: {\n type: 'integer',\n minimum: 1,\n description: 'Cap on total returned items (default 1000). Use to bound large accounts.',\n },\n },\n required: [],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const maxItems = parsed.data.max_items ?? 1000;\n const all = await paginateAll<Stripe.Customer>(\n (p) =>\n stripe.customers.list({\n ...p,\n ...(parsed.data.email ? { email: parsed.data.email } : {}),\n }),\n { maxItems },\n );\n const hasMore = all.length >= maxItems;\n return JSON.stringify(\n { total_count: all.length, has_more: hasMore, data: all },\n null,\n 2,\n );\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type Stripe from 'stripe';\n\n/**\n * Auto-paginate through all cursor-based Stripe list responses.\n *\n * @param fetchPage A function that fetches one page. It receives\n * `{ limit, starting_after }` and must return a Stripe\n * `ApiList<T>` (with `.data` and `.has_more`).\n * @param options Optional `maxItems` cap to avoid runaway pagination.\n *\n * @example\n * const allCustomers = await paginateAll((p) => stripe.customers.list(p));\n */\nexport async function paginateAll<T>(\n fetchPage: (params: { limit: number; starting_after?: string }) => Promise<Stripe.ApiList<T>>,\n options?: { maxItems?: number },\n): Promise<T[]> {\n const maxItems = options?.maxItems ?? 100_000;\n const pageSize = Math.min(100, maxItems);\n const results: T[] = [];\n let startingAfter: string | undefined;\n\n for (let i = 0; i < 1000; i++) {\n const page = await fetchPage({\n limit: Math.min(pageSize, maxItems - results.length),\n ...(startingAfter ? { starting_after: startingAfter } : {}),\n });\n\n const data = page.data;\n results.push(...data);\n\n if (!page.has_more || results.length >= maxItems) {\n break;\n }\n\n const last = data[data.length - 1];\n if (!last) break;\n // Stripe list items always carry an `id`. We cast through unknown because\n // the generic T does not constrain to `{ id: string }` but real resources do.\n startingAfter = (last as unknown as { id: string }).id;\n }\n\n return results.slice(0, maxItems);\n}\n\n/**\n * Build a summary envelope for a paginated list result.\n * Useful for analytics tools that return large computed datasets.\n */\nexport function listEnvelope<T>(data: T[], hasMore = false) {\n return {\n total_count: data.length,\n has_more: hasMore,\n next_cursor: null as string | null,\n data,\n };\n}\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n query: z\n .string()\n .min(1)\n .describe(\n 'Stripe search query string. Example: `email:\\'foo@bar.com\\'` or `name:\\'Acme Corp\\'`. See https://stripe.com/docs/search#search-query-language and query fields for customers at https://stripe.com/docs/search#query-fields-for-customers.',\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Maximum number of results to return (1-100, default 10).'),\n page: z\n .string()\n .optional()\n .describe('Cursor for next page of search results (use next_page value from a prior response).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_customers_search',\n description: `Search Stripe customers using the Stripe Search API.\n\nUse this when:\n- You need to find customers by partial matches on name, email, phone, etc.\n- The list endpoint's exact-match filters are not flexible enough\n\nThe Stripe Search API supports a query language. See:\n- Query language: https://stripe.com/docs/search#search-query-language\n- Queryable fields for customers: https://stripe.com/docs/search#query-fields-for-customers\n\nNote: search results are eventually consistent; very recently created customers may not appear immediately.\n\nReturns: a Stripe SearchResult envelope with \\`data\\` (array of Customer), \\`has_more\\`, and \\`next_page\\`.\nStripe docs: https://stripe.com/docs/api/customers/search`,\n inputSchema: {\n type: 'object',\n properties: {\n query: {\n type: 'string',\n description:\n 'Stripe search query string. Example: `email:\\'foo@bar.com\\'` or `name:\\'Acme Corp\\'`. See https://stripe.com/docs/search#search-query-language and query fields for customers at https://stripe.com/docs/search#query-fields-for-customers.',\n },\n limit: {\n type: 'integer',\n minimum: 1,\n maximum: 100,\n description: 'Maximum number of results to return (1-100, default 10).',\n },\n page: {\n type: 'string',\n description:\n 'Cursor for next page of search results (use next_page value from a prior response).',\n },\n },\n required: ['query'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.customers.search(\n buildStripeParams<Stripe.CustomerSearchParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createCustomer } from './create-customer.js';\nimport { toolDefinition as getCustomer } from './get-customer.js';\nimport { toolDefinition as updateCustomer } from './update-customer.js';\nimport { toolDefinition as deleteCustomer } from './delete-customer.js';\nimport { toolDefinition as listCustomers } from './list-customers.js';\nimport { toolDefinition as searchCustomers } from './search-customers.js';\n\nexport const tools: ToolDefinition[] = [\n createCustomer,\n getCustomer,\n updateCustomer,\n deleteCustomer,\n listCustomers,\n searchCustomers,\n];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n name: z.string().min(1).describe('Product name (displayable to the customer). Required.'),\n description: z\n .string()\n .optional()\n .describe('Long-form description of the product (displayable to the customer)'),\n images: z\n .array(z.string().url())\n .max(8)\n .optional()\n .describe('Up to 8 image URLs for this product'),\n default_price: z\n .string()\n .optional()\n .describe('ID of an existing Price to set as this product\\u2019s default price'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Arbitrary key-value pairs attached to the product (keys and values are strings)'),\n active: z\n .boolean()\n .optional()\n .describe('Whether the product is available for purchase. Defaults to true.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_products_create',\n description: `Create a new product in Stripe.\n\nUse this when:\n- You need a Product to attach Prices to (subscriptions, one-time purchases, etc.)\n- A new plan or SKU needs to be added to your catalogue\n\nReturns: the created Stripe Product object.\nStripe docs: https://stripe.com/docs/api/products/create`,\n inputSchema: {\n type: 'object',\n properties: {\n name: { type: 'string', description: 'Product name (displayable to the customer). Required.' },\n description: {\n type: 'string',\n description: 'Long-form description of the product (displayable to the customer)',\n },\n images: {\n type: 'array',\n items: { type: 'string' },\n description: 'Up to 8 image URLs for this product',\n },\n default_price: {\n type: 'string',\n description: 'ID of an existing Price to set as this product\\u2019s default price',\n },\n metadata: {\n type: 'object',\n description:\n 'Arbitrary key-value pairs attached to the product (keys and values are strings)',\n additionalProperties: { type: 'string' },\n },\n active: {\n type: 'boolean',\n description: 'Whether the product is available for purchase. Defaults to true.',\n },\n },\n required: ['name'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.products.create(\n buildStripeParams<Stripe.ProductCreateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n product_id: z\n .string()\n .min(1)\n .describe('Stripe product ID (e.g. \"prod_1a2b3c\")'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Commonly useful values: \"default_price\".'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_products_get',\n description: `Retrieve a single Stripe product by ID.\n\nUse this when:\n- You need the full product object (name, description, images, default price, active flag)\n- You want to expand the default_price relationship\n\nReturns: the Stripe Product object.\nStripe docs: https://stripe.com/docs/api/products/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n product_id: { type: 'string', description: 'Stripe product ID (e.g. \"prod_1a2b3c\")' },\n expand: {\n type: 'array',\n items: { type: 'string' },\n description: 'Fields to expand. Commonly useful values: \"default_price\".',\n },\n },\n required: ['product_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.products.retrieve(\n parsed.data.product_id,\n buildStripeParams<Stripe.ProductRetrieveParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n product_id: z\n .string()\n .min(1)\n .describe('Stripe product ID to update (e.g. \"prod_1a2b3c\")'),\n name: z.string().min(1).optional().describe('New product name'),\n description: z.string().optional().describe('New product description'),\n images: z\n .array(z.string().url())\n .max(8)\n .optional()\n .describe('New list of up to 8 image URLs (replaces the existing list)'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Arbitrary key-value pairs to attach. Pass an empty string to unset a key.'),\n active: z.boolean().optional().describe('Whether the product is available for purchase'),\n default_price: z\n .string()\n .optional()\n .describe('ID of a Price to set as this product\\u2019s new default price'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_products_update',\n description: `Update an existing Stripe product.\n\nUse this when:\n- You need to rename a product, change its description, or swap images\n- You want to change the default price for a product\n- You want to (de)activate a product without fully archiving it (use archive-product for the standard archive flow)\n\nReturns: the updated Stripe Product object.\nStripe docs: https://stripe.com/docs/api/products/update`,\n inputSchema: {\n type: 'object',\n properties: {\n product_id: { type: 'string', description: 'Stripe product ID to update (e.g. \"prod_1a2b3c\")' },\n name: { type: 'string', description: 'New product name' },\n description: { type: 'string', description: 'New product description' },\n images: {\n type: 'array',\n items: { type: 'string' },\n description: 'New list of up to 8 image URLs (replaces the existing list)',\n },\n metadata: {\n type: 'object',\n description: 'Arbitrary key-value pairs to attach. Pass an empty string to unset a key.',\n additionalProperties: { type: 'string' },\n },\n active: { type: 'boolean', description: 'Whether the product is available for purchase' },\n default_price: {\n type: 'string',\n description: 'ID of a Price to set as this product\\u2019s new default price',\n },\n },\n required: ['product_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { product_id: productId, ...rest } = parsed.data;\n const result = await stripe.products.update(\n productId,\n buildStripeParams<Stripe.ProductUpdateParams>(rest),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\n\nconst inputSchema = z.object({\n product_id: z\n .string()\n .min(1)\n .describe('Stripe product ID to archive (e.g. \"prod_1a2b3c\")'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_products_archive',\n description: `Archive a Stripe product by marking it inactive (\\`active: false\\`).\n\nUse this when:\n- A product is no longer sold but should remain in your historical records\n- You want to hide a product from new checkouts without deleting it\n\nArchiving (not deleting) is the Stripe-recommended way to retire a product, because existing subscriptions and invoices still reference it. The product can be reactivated later by updating \\`active\\` to \\`true\\`.\n\nReturns: the updated Stripe Product object with \\`active: false\\`.\nStripe docs: https://stripe.com/docs/api/products/update`,\n inputSchema: {\n type: 'object',\n properties: {\n product_id: {\n type: 'string',\n description: 'Stripe product ID to archive (e.g. \"prod_1a2b3c\")',\n },\n },\n required: ['product_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.products.update(parsed.data.product_id, { active: false });\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Page size (1-100). Results are auto-paginated up to max_items.'),\n active: z\n .boolean()\n .optional()\n .describe('Filter: only return active (true) or inactive (false) products'),\n ids: z\n .array(z.string())\n .optional()\n .describe('Only return products with these IDs (cannot be used with starting_after)'),\n starting_after: z\n .string()\n .optional()\n .describe('Cursor: a product ID to start after (manual pagination)'),\n max_items: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Cap on total returned items (default 1000).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_products_list',\n description: `List Stripe products with auto-pagination.\n\nUse this when:\n- You need to enumerate all or many products (e.g. for a catalogue or sync)\n- You want to filter by active/inactive status or by a set of IDs\n\nThis tool auto-paginates through every page up to \\`max_items\\` (default 1000). The response is wrapped as \\`{ total_count, has_more, data }\\` where \\`has_more\\` is true only if the cap was hit before exhausting all results.\n\nReturns: an object with \\`total_count\\`, \\`has_more\\`, and \\`data\\` (array of Product objects).\nStripe docs: https://stripe.com/docs/api/products/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: {\n type: 'integer',\n minimum: 1,\n maximum: 100,\n description: 'Page size (1-100). Results are auto-paginated up to max_items.',\n },\n active: {\n type: 'boolean',\n description: 'Filter: only return active (true) or inactive (false) products',\n },\n ids: {\n type: 'array',\n items: { type: 'string' },\n description: 'Only return products with these IDs (cannot be used with starting_after)',\n },\n starting_after: {\n type: 'string',\n description: 'Cursor: a product ID to start after (manual pagination)',\n },\n max_items: {\n type: 'integer',\n minimum: 1,\n description: 'Cap on total returned items (default 1000).',\n },\n },\n required: [],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const maxItems = parsed.data.max_items ?? 1000;\n const all = await paginateAll<Stripe.Product>(\n (p) =>\n stripe.products.list({\n ...p,\n ...(parsed.data.active !== undefined ? { active: parsed.data.active } : {}),\n ...(parsed.data.ids ? { ids: parsed.data.ids } : {}),\n }),\n { maxItems },\n );\n const hasMore = all.length >= maxItems;\n return JSON.stringify(\n { total_count: all.length, has_more: hasMore, data: all },\n null,\n 2,\n );\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createProduct } from './create-product.js';\nimport { toolDefinition as getProduct } from './get-product.js';\nimport { toolDefinition as updateProduct } from './update-product.js';\nimport { toolDefinition as archiveProduct } from './archive-product.js';\nimport { toolDefinition as listProducts } from './list-products.js';\n\nexport const tools: ToolDefinition[] = [\n createProduct,\n getProduct,\n updateProduct,\n archiveProduct,\n listProducts,\n];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst recurringSchema = z\n .object({\n interval: z\n .enum(['day', 'week', 'month', 'year'])\n .describe('Billing frequency: day, week, month, or year'),\n interval_count: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe(\n 'Number of intervals between billings. E.g. interval=month, interval_count=3 bills every 3 months. Max 3 years.',\n ),\n })\n .describe('Recurring price configuration. Omit for a one-time price.');\n\nconst productDataSchema = z\n .object({\n name: z.string().min(1).describe('Name of the new product to create alongside this price'),\n })\n .describe('Use this to create a new product inline. Mutually exclusive with `product`.');\n\nconst inputSchema = z\n .object({\n unit_amount: z\n .number()\n .int()\n .min(0)\n .describe(\n 'Price amount in the smallest currency unit (e.g. cents for USD). 0 for a free price.',\n ),\n currency: z\n .string()\n .min(3)\n .max(3)\n .regex(/^[a-z]{3}$/, 'currency must be a lowercase 3-letter ISO code')\n .describe('Lowercase 3-letter ISO currency code (e.g. \"usd\", \"eur\", \"jpy\")'),\n product: z\n .string()\n .optional()\n .describe(\n 'ID of an existing product this price belongs to. Either this or `product_data` is required (one of them).',\n ),\n product_data: productDataSchema.optional(),\n recurring: recurringSchema.optional(),\n nickname: z\n .string()\n .optional()\n .describe('Internal nickname for the price (hidden from customers)'),\n lookup_key: z\n .string()\n .optional()\n .describe('Lookup key used to retrieve prices dynamically from a static string'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Arbitrary key-value pairs attached to the price'),\n active: z\n .boolean()\n .optional()\n .describe('Whether the price can be used for new purchases. Defaults to true.'),\n })\n .refine(\n (data) => data.product !== undefined || data.product_data !== undefined,\n {\n message:\n 'Either \"product\" (existing product ID) or \"product_data\" (inline new product) must be provided.',\n },\n );\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_prices_create',\n description: `Create a new Price in Stripe.\n\nUse this when:\n- You want to charge a fixed amount for a product (one-time or recurring)\n- You need a new pricing tier (e.g. monthly vs yearly) for an existing product\n\nYou must provide exactly one of \\`product\\` (existing product ID) or \\`product_data\\` (to create a new product inline). \\`unit_amount\\` is in the smallest currency unit (cents for USD/EUR, whole units for zero-decimal currencies like JPY).\n\nReturns: the created Stripe Price object.\nStripe docs: https://stripe.com/docs/api/prices/create`,\n inputSchema: {\n type: 'object',\n properties: {\n unit_amount: {\n type: 'integer',\n minimum: 0,\n description:\n 'Price amount in the smallest currency unit (e.g. cents for USD). 0 for a free price.',\n },\n currency: {\n type: 'string',\n description: 'Lowercase 3-letter ISO currency code (e.g. \"usd\", \"eur\", \"jpy\")',\n },\n product: {\n type: 'string',\n description:\n 'ID of an existing product this price belongs to. Either this or `product_data` is required (one of them).',\n },\n product_data: {\n type: 'object',\n description: 'Use this to create a new product inline. Mutually exclusive with `product`.',\n properties: {\n name: { type: 'string', description: 'Name of the new product to create alongside this price' },\n },\n required: ['name'],\n },\n recurring: {\n type: 'object',\n description: 'Recurring price configuration. Omit for a one-time price.',\n properties: {\n interval: {\n type: 'string',\n enum: ['day', 'week', 'month', 'year'],\n description: 'Billing frequency: day, week, month, or year',\n },\n interval_count: {\n type: 'integer',\n minimum: 1,\n description:\n 'Number of intervals between billings. E.g. interval=month, interval_count=3 bills every 3 months. Max 3 years.',\n },\n },\n required: ['interval'],\n },\n nickname: {\n type: 'string',\n description: 'Internal nickname for the price (hidden from customers)',\n },\n lookup_key: {\n type: 'string',\n description: 'Lookup key used to retrieve prices dynamically from a static string',\n },\n metadata: {\n type: 'object',\n description: 'Arbitrary key-value pairs attached to the price',\n additionalProperties: { type: 'string' },\n },\n active: {\n type: 'boolean',\n description: 'Whether the price can be used for new purchases. Defaults to true.',\n },\n },\n required: ['unit_amount', 'currency'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.prices.create(\n buildStripeParams<Stripe.PriceCreateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n price_id: z.string().min(1).describe('Stripe price ID (e.g. \"price_1a2b3c\")'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand. Commonly useful values: \"product\", \"tiers\".'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_prices_get',\n description: `Retrieve a single Stripe price by ID.\n\nUse this when:\n- You need the full Price object (amount, currency, recurring config, product link)\n- You want to expand the related Product object\n\nReturns: the Stripe Price object.\nStripe docs: https://stripe.com/docs/api/prices/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n price_id: { type: 'string', description: 'Stripe price ID (e.g. \"price_1a2b3c\")' },\n expand: {\n type: 'array',\n items: { type: 'string' },\n description: 'Fields to expand. Commonly useful values: \"product\", \"tiers\".',\n },\n },\n required: ['price_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.prices.retrieve(\n parsed.data.price_id,\n buildStripeParams<Stripe.PriceRetrieveParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n price_id: z.string().min(1).describe('Stripe price ID to update (e.g. \"price_1a2b3c\")'),\n nickname: z\n .string()\n .optional()\n .describe('New internal nickname for the price (hidden from customers)'),\n lookup_key: z\n .string()\n .optional()\n .describe(\n 'New lookup key used to retrieve prices dynamically. Pass an empty string to unset.',\n ),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Arbitrary key-value pairs to attach. Pass an empty string to unset a key.'),\n active: z\n .boolean()\n .optional()\n .describe(\n 'Whether the price can be used for new purchases. Set to false to deprecate a price without deleting it.',\n ),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_prices_update',\n description: `Update an existing Stripe price.\n\nUse this when:\n- You want to rename (nick) a price for internal clarity\n- You want to set or update a lookup_key\n- You want to deactivate a price so it can\\u2019t be used for new purchases (without deleting it)\n\nNote: Stripe does NOT allow updating \\`unit_amount\\`, \\`currency\\`, \\`recurring\\`, or \\`product\\` on an existing price \\u2014 create a new price instead.\n\nReturns: the updated Stripe Price object.\nStripe docs: https://stripe.com/docs/api/prices/update`,\n inputSchema: {\n type: 'object',\n properties: {\n price_id: { type: 'string', description: 'Stripe price ID to update (e.g. \"price_1a2b3c\")' },\n nickname: {\n type: 'string',\n description: 'New internal nickname for the price (hidden from customers)',\n },\n lookup_key: {\n type: 'string',\n description:\n 'New lookup key used to retrieve prices dynamically. Pass an empty string to unset.',\n },\n metadata: {\n type: 'object',\n description: 'Arbitrary key-value pairs to attach. Pass an empty string to unset a key.',\n additionalProperties: { type: 'string' },\n },\n active: {\n type: 'boolean',\n description:\n 'Whether the price can be used for new purchases. Set to false to deprecate a price without deleting it.',\n },\n },\n required: ['price_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { price_id: priceId, ...rest } = parsed.data;\n const result = await stripe.prices.update(\n priceId,\n buildStripeParams<Stripe.PriceUpdateParams>(rest),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Page size (1-100). Results are auto-paginated up to max_items.'),\n active: z\n .boolean()\n .optional()\n .describe('Filter: only return active (true) or inactive (false) prices'),\n product: z\n .string()\n .optional()\n .describe('Only return prices for this product ID'),\n type: z\n .enum(['one_time', 'recurring'])\n .optional()\n .describe('Filter by price type: one_time or recurring'),\n starting_after: z\n .string()\n .optional()\n .describe('Cursor: a price ID to start after (manual pagination)'),\n max_items: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe('Cap on total returned items (default 1000).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_prices_list',\n description: `List Stripe prices with auto-pagination.\n\nUse this when:\n- You need to enumerate all or many prices (e.g. for a pricing page or sync)\n- You want to filter by active status, product, or type (one_time/recurring)\n\nThis tool auto-paginates through every page up to \\`max_items\\` (default 1000). The response is wrapped as \\`{ total_count, has_more, data }\\` where \\`has_more\\` is true only if the cap was hit before exhausting all results.\n\nReturns: an object with \\`total_count\\`, \\`has_more\\`, and \\`data\\` (array of Price objects).\nStripe docs: https://stripe.com/docs/api/prices/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: {\n type: 'integer',\n minimum: 1,\n maximum: 100,\n description: 'Page size (1-100). Results are auto-paginated up to max_items.',\n },\n active: {\n type: 'boolean',\n description: 'Filter: only return active (true) or inactive (false) prices',\n },\n product: {\n type: 'string',\n description: 'Only return prices for this product ID',\n },\n type: {\n type: 'string',\n enum: ['one_time', 'recurring'],\n description: 'Filter by price type: one_time or recurring',\n },\n starting_after: {\n type: 'string',\n description: 'Cursor: a price ID to start after (manual pagination)',\n },\n max_items: {\n type: 'integer',\n minimum: 1,\n description: 'Cap on total returned items (default 1000).',\n },\n },\n required: [],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const maxItems = parsed.data.max_items ?? 1000;\n const all = await paginateAll<Stripe.Price>(\n (p) =>\n stripe.prices.list({\n ...p,\n ...(parsed.data.active !== undefined ? { active: parsed.data.active } : {}),\n ...(parsed.data.product ? { product: parsed.data.product } : {}),\n ...(parsed.data.type ? { type: parsed.data.type } : {}),\n }),\n { maxItems },\n );\n const hasMore = all.length >= maxItems;\n return JSON.stringify(\n { total_count: all.length, has_more: hasMore, data: all },\n null,\n 2,\n );\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createPrice } from './create-price.js';\nimport { toolDefinition as getPrice } from './get-price.js';\nimport { toolDefinition as updatePrice } from './update-price.js';\nimport { toolDefinition as listPrices } from './list-prices.js';\n\nexport const tools: ToolDefinition[] = [createPrice, getPrice, updatePrice, listPrices];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n customer: z\n .string()\n .describe('ID of the customer to subscribe (cus_...)'),\n items: z\n .array(\n z.object({\n price: z.string().describe('ID of the Price to subscribe to (price_...)'),\n quantity: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Quantity of the item to subscribe to (often 1). Defaults to 1.'),\n }),\n )\n .nonempty()\n .describe('Array of subscription items, each binding a Price to a quantity.'),\n coupon: z\n .string()\n .optional()\n .describe('ID of a coupon to apply to the subscription (coupon_... or promotion code).'),\n trial_period_days: z\n .number()\n .int()\n .nonnegative()\n .optional()\n .describe('Days to trial before the first charge. Overrides any price-level trial.'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Arbitrary key-value metadata (max 50 keys, keys & values are strings).'),\n default_payment_method: z\n .string()\n .optional()\n .describe('ID of the PaymentMethod to use as the default for this subscription (pm_...).'),\n proration_behavior: z\n .enum(['none', 'create_prorations', 'always_invoice'])\n .optional()\n .describe('How to handle prorations on the initial invoice. Defaults to create_prorations.'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Stripe expandable fields (e.g. [\"latest_invoice\", \"customer\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_subscriptions_create',\n description: `Create a new subscription for a customer.\n\nUse this when:\n- A customer upgrades to a paid plan\n- You need to start recurring billing\n- You want to add a new line item to recurring billing\n\nReturns: the created Stripe Subscription object.\nStripe docs: https://stripe.com/docs/api/subscriptions/create`,\n inputSchema: {\n type: 'object',\n properties: {\n customer: {\n type: 'string',\n description: 'ID of the customer to subscribe (cus_...)',\n },\n items: {\n type: 'array',\n description: 'Array of subscription items, each binding a Price to a quantity.',\n items: {\n type: 'object',\n properties: {\n price: { type: 'string', description: 'ID of the Price (price_...)' },\n quantity: {\n type: 'integer',\n description: 'Quantity of the item to subscribe to (often 1).',\n minimum: 1,\n },\n },\n required: ['price'],\n },\n },\n coupon: {\n type: 'string',\n description: 'ID of a coupon to apply (coupon_... or promotion code).',\n },\n trial_period_days: {\n type: 'integer',\n description: 'Days to trial before the first charge.',\n minimum: 0,\n },\n metadata: {\n type: 'object',\n description: 'Arbitrary key-value metadata (max 50 keys).',\n },\n default_payment_method: {\n type: 'string',\n description: 'ID of the PaymentMethod to use as default (pm_...).',\n },\n proration_behavior: {\n type: 'string',\n enum: ['none', 'create_prorations', 'always_invoice'],\n description: 'How to handle prorations on the initial invoice.',\n },\n expand: {\n type: 'array',\n description: 'Stripe expandable fields (e.g. [\"latest_invoice\",\"customer\"]).',\n items: { type: 'string' },\n },\n },\n required: ['customer', 'items'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.subscriptions.create(\n buildStripeParams<Stripe.SubscriptionCreateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n subscription_id: z\n .string()\n .describe('ID of the subscription to retrieve (sub_...).'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Stripe expandable fields (e.g. [\"customer\",\"latest_invoice.payment_intent\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_subscriptions_get',\n description: `Retrieve a subscription by ID.\n\nUse this when:\n- You need to inspect a subscription's status, items, or billing cycle\n- You want to verify the current state before updating or canceling\n\nReturns: the Stripe Subscription object.\nStripe docs: https://stripe.com/docs/api/subscriptions/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n subscription_id: {\n type: 'string',\n description: 'ID of the subscription to retrieve (sub_...).',\n },\n expand: {\n type: 'array',\n description: 'Stripe expandable fields (e.g. [\"customer\",\"latest_invoice.payment_intent\"]).',\n items: { type: 'string' },\n },\n },\n required: ['subscription_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.subscriptions.retrieve(\n parsed.data.subscription_id,\n buildStripeParams<Stripe.SubscriptionRetrieveParams>({\n expand: parsed.data.expand,\n }),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n subscription_id: z\n .string()\n .describe('ID of the subscription to update (sub_...).'),\n items: z\n .array(\n z.object({\n id: z\n .string()\n .optional()\n .describe('Existing subscription item ID (si_...) — required to update an existing item.'),\n price: z\n .string()\n .optional()\n .describe('ID of the new Price (price_...) — set to swap the price on an item.'),\n quantity: z\n .number()\n .int()\n .nonnegative()\n .optional()\n .describe('New quantity. Set to 0 to remove the item.'),\n deleted: z\n .boolean()\n .optional()\n .describe('Set to true (with the item id) to delete that subscription item.'),\n }),\n )\n .optional()\n .describe('Subscription items to add, update, or remove.'),\n coupon: z\n .string()\n .optional()\n .describe('ID of a coupon to apply (pass empty string to clear).'),\n proration_behavior: z\n .enum(['none', 'create_prorations', 'always_invoice'])\n .optional()\n .describe('How to handle prorations from this update.'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Arbitrary key-value metadata (max 50 keys).'),\n default_payment_method: z\n .string()\n .optional()\n .describe('ID of the PaymentMethod to use as default (pm_...).'),\n cancel_at_period_end: z\n .boolean()\n .optional()\n .describe('If true, the subscription will cancel at the end of the current period.'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Stripe expandable fields (e.g. [\"latest_invoice\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_subscriptions_update',\n description: `Update an existing subscription.\n\nUse this when:\n- Upgrading or downgrading a customer's plan\n- Changing item quantities\n- Applying or removing a coupon\n- Scheduling cancellation at period end\n\nReturns: the updated Stripe Subscription object.\nStripe docs: https://stripe.com/docs/api/subscriptions/update`,\n inputSchema: {\n type: 'object',\n properties: {\n subscription_id: {\n type: 'string',\n description: 'ID of the subscription to update (sub_...).',\n },\n items: {\n type: 'array',\n description: 'Subscription items to add, update, or remove.',\n items: {\n type: 'object',\n properties: {\n id: { type: 'string', description: 'Existing subscription item ID (si_...).' },\n price: { type: 'string', description: 'ID of the new Price (price_...).' },\n quantity: {\n type: 'integer',\n description: 'New quantity. Set to 0 to remove the item.',\n minimum: 0,\n },\n deleted: {\n type: 'boolean',\n description: 'Set to true (with the item id) to delete that item.',\n },\n },\n },\n },\n coupon: { type: 'string', description: 'ID of a coupon to apply.' },\n proration_behavior: {\n type: 'string',\n enum: ['none', 'create_prorations', 'always_invoice'],\n description: 'How to handle prorations from this update.',\n },\n metadata: {\n type: 'object',\n description: 'Arbitrary key-value metadata (max 50 keys).',\n },\n default_payment_method: {\n type: 'string',\n description: 'ID of the PaymentMethod to use as default (pm_...).',\n },\n cancel_at_period_end: {\n type: 'boolean',\n description: 'If true, the subscription cancels at the end of the current period.',\n },\n expand: {\n type: 'array',\n description: 'Stripe expandable fields (e.g. [\"latest_invoice\"]).',\n items: { type: 'string' },\n },\n },\n required: ['subscription_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { subscription_id, ...rest } = parsed.data;\n const result = await stripe.subscriptions.update(\n subscription_id,\n buildStripeParams<Stripe.SubscriptionUpdateParams>(rest),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n subscription_id: z\n .string()\n .describe('ID of the subscription to cancel (sub_...).'),\n prorate: z\n .boolean()\n .optional()\n .describe('If true, generate a proration invoice item for unused time. Defaults to false.'),\n invoice_now: z\n .boolean()\n .optional()\n .describe('If true, generate a final invoice for un-invoiced metered usage and prorations. Defaults to false.'),\n cancellation_details: z\n .object({\n comment: z\n .string()\n .optional()\n .describe('Free-text reason for the cancellation (maps to Stripe cancellation_details.comment).'),\n feedback: z\n .enum([\n 'customer_service',\n 'low_quality',\n 'missing_features',\n 'other',\n 'switched_service',\n 'too_complex',\n 'too_expensive',\n 'unused',\n ])\n .optional()\n .describe('Customer-submitted cancellation feedback reason.'),\n })\n .optional()\n .describe('Details about why the subscription was cancelled.'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Stripe expandable fields (e.g. [\"customer\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_subscriptions_cancel',\n description: `Cancel a subscription immediately.\n\nUse this when:\n- A customer churns and you want to stop billing now\n- The customer requests immediate cancellation\n- You need to halt recurring billing on a disputed subscription\n\nReturns: the cancelled Stripe Subscription object (status: 'canceled').\nStripe docs: https://stripe.com/docs/api/subscriptions/cancel`,\n inputSchema: {\n type: 'object',\n properties: {\n subscription_id: {\n type: 'string',\n description: 'ID of the subscription to cancel (sub_...).',\n },\n prorate: {\n type: 'boolean',\n description: 'If true, generate a proration invoice item for unused time.',\n },\n invoice_now: {\n type: 'boolean',\n description: 'If true, generate a final invoice for un-invoiced metered usage.',\n },\n cancellation_details: {\n type: 'object',\n description: 'Details about why the subscription was cancelled.',\n properties: {\n comment: {\n type: 'string',\n description: 'Free-text reason for the cancellation.',\n },\n feedback: {\n type: 'string',\n enum: [\n 'customer_service',\n 'low_quality',\n 'missing_features',\n 'other',\n 'switched_service',\n 'too_complex',\n 'too_expensive',\n 'unused',\n ],\n description: 'Customer-submitted cancellation feedback reason.',\n },\n },\n },\n expand: {\n type: 'array',\n description: 'Stripe expandable fields (e.g. [\"customer\"]).',\n items: { type: 'string' },\n },\n },\n required: ['subscription_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { subscription_id, ...rest } = parsed.data;\n const result = await stripe.subscriptions.cancel(\n subscription_id,\n buildStripeParams<Stripe.SubscriptionCancelParams>(rest),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n subscription_id: z\n .string()\n .describe('ID of the subscription to pause (sub_...). Must use charge_automatically collection.'),\n behavior: z\n .enum(['void', 'mark_uncollectible', 'keep_as_draft'])\n .optional()\n .describe('How to handle invoices generated while paused. Defaults to void.'),\n resumes_at: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Unix timestamp (seconds) when the subscription should automatically resume.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_subscriptions_pause',\n description: `Pause a subscription's collection cycle.\n\nUse this when:\n- A customer temporarily suspends service (vacation, seasonal)\n- You want to stop billing without cancelling\n- Trial extension scenarios\n\nBehind the scenes this calls \\`subscriptions.update\\` with \\`pause_collection\\`.\nReturns: the updated Stripe Subscription object (with pause_collection populated).\nStripe docs: https://stripe.com/docs/billing/subscriptions/pause`,\n inputSchema: {\n type: 'object',\n properties: {\n subscription_id: {\n type: 'string',\n description: 'ID of the subscription to pause (sub_...).',\n },\n behavior: {\n type: 'string',\n enum: ['void', 'mark_uncollectible', 'keep_as_draft'],\n description: 'How to handle invoices generated while paused. Defaults to void.',\n },\n resumes_at: {\n type: 'integer',\n description: 'Unix timestamp (seconds) when the subscription should resume.',\n minimum: 1,\n },\n },\n required: ['subscription_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { subscription_id, behavior, resumes_at } = parsed.data;\n const pauseCollection: Stripe.SubscriptionUpdateParams.PauseCollection = {\n // Stripe requires `behavior` on pause_collection. Default to 'void'\n // (Stripe's documented default) when the caller doesn't specify one.\n behavior: behavior ?? 'void',\n ...(resumes_at ? { resumes_at } : {}),\n };\n const result = await stripe.subscriptions.update(\n subscription_id,\n buildStripeParams<Stripe.SubscriptionUpdateParams>({\n pause_collection: pauseCollection,\n }),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n subscription_id: z\n .string()\n .describe('ID of the paused subscription to resume (sub_...).'),\n billing_cycle_anchor: z\n .enum(['now', 'unchanged'])\n .optional()\n .describe('Whether to reset the billing cycle anchor when resuming. Defaults to now.'),\n proration_behavior: z\n .enum(['none', 'create_prorations', 'always_invoice'])\n .optional()\n .describe('How to handle prorations when resuming. Defaults to create_prorations.'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Stripe expandable fields (e.g. [\"latest_invoice\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_subscriptions_resume',\n description: `Resume a paused subscription.\n\nUse this when:\n- A customer returns from a paused state\n- The \\`resumes_at\\` time arrives and you want to resume early\n- Re-activating after a billing holiday\n\nOnly available for subscriptions using \\`charge_automatically\\` collection.\nReturns: the resumed Stripe Subscription object (status: 'active').\nStripe docs: https://stripe.com/docs/api/subscriptions/resume`,\n inputSchema: {\n type: 'object',\n properties: {\n subscription_id: {\n type: 'string',\n description: 'ID of the paused subscription to resume (sub_...).',\n },\n billing_cycle_anchor: {\n type: 'string',\n enum: ['now', 'unchanged'],\n description: 'Whether to reset the billing cycle anchor when resuming.',\n },\n proration_behavior: {\n type: 'string',\n enum: ['none', 'create_prorations', 'always_invoice'],\n description: 'How to handle prorations when resuming.',\n },\n expand: {\n type: 'array',\n description: 'Stripe expandable fields (e.g. [\"latest_invoice\"]).',\n items: { type: 'string' },\n },\n },\n required: ['subscription_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { subscription_id, ...rest } = parsed.data;\n const result = await stripe.subscriptions.resume(\n subscription_id,\n buildStripeParams<Stripe.SubscriptionResumeParams>(rest),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Page size for each Stripe request (1-100). Use max_items for total cap.'),\n status: z\n .enum([\n 'active',\n 'past_due',\n 'canceled',\n 'unpaid',\n 'all',\n 'trialing',\n 'incomplete',\n 'incomplete_expired',\n 'paused',\n ])\n .optional()\n .describe('Filter by subscription status. Defaults to all non-canceled subscriptions.'),\n customer: z\n .string()\n .optional()\n .describe('Only return subscriptions for this customer (cus_...).'),\n price: z\n .string()\n .optional()\n .describe('Only return subscriptions that contain this Price ID (price_...).'),\n current_period_end: z\n .number()\n .int()\n .optional()\n .describe('Unix timestamp (seconds). Filters subscriptions whose current period ends at this exact time. Use Stripe range query syntax by passing a number directly.'),\n starting_after: z\n .string()\n .optional()\n .describe('Pagination cursor — ID of the last object from the previous page (sub_...).'),\n max_items: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Hard cap on the total number of items returned. Defaults to 1000.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_subscriptions_list',\n description: `List subscriptions with optional filters.\n\nUse this when:\n- Showing all of a customer's subscriptions\n- Finding past_due or unpaid subscriptions for recovery workflows\n- Auditing active subscriptions across the account\n\nAuto-paginates through all matching subscriptions (capped by max_items).\nReturns: \\`{ total_count, has_more, data }\\` envelope.\nStripe docs: https://stripe.com/docs/api/subscriptions/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: {\n type: 'integer',\n description: 'Page size for each Stripe request (1-100).',\n minimum: 1,\n maximum: 100,\n },\n status: {\n type: 'string',\n enum: [\n 'active',\n 'past_due',\n 'canceled',\n 'unpaid',\n 'all',\n 'trialing',\n 'incomplete',\n 'incomplete_expired',\n 'paused',\n ],\n description: 'Filter by subscription status.',\n },\n customer: {\n type: 'string',\n description: 'Only return subscriptions for this customer (cus_...).',\n },\n price: {\n type: 'string',\n description: 'Only return subscriptions that contain this Price ID (price_...).',\n },\n current_period_end: {\n type: 'integer',\n description: 'Unix timestamp (seconds) to filter by current period end.',\n },\n starting_after: {\n type: 'string',\n description: 'Pagination cursor — ID of the last object from the previous page.',\n },\n max_items: {\n type: 'integer',\n description: 'Hard cap on total items returned. Defaults to 1000.',\n minimum: 1,\n },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const all = await paginateAll<Stripe.Subscription>(\n (p) =>\n stripe.subscriptions.list({\n ...p,\n ...(parsed.data.status ? { status: parsed.data.status } : {}),\n ...(parsed.data.customer ? { customer: parsed.data.customer } : {}),\n ...(parsed.data.price ? { price: parsed.data.price } : {}),\n ...(parsed.data.current_period_end\n ? { current_period_end: parsed.data.current_period_end }\n : {}),\n }),\n { maxItems: parsed.data.max_items ?? 1000 },\n );\n return JSON.stringify(\n { total_count: all.length, has_more: false, data: all },\n null,\n 2,\n );\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n query: z\n .string()\n .describe(\n 'Stripe Search Query Language string. Supported fields: status, customer, plan.id, price.id, metadata.<key>. Examples: \"status:\\'active\\'\", \"customer:\\'cus_abc\\' AND metadata.order_id:\\'42\\'\".',\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Maximum number of results (1-100). Defaults to 10.'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Stripe expandable fields (e.g. [\"data.customer\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_subscriptions_search',\n description: `Search subscriptions using Stripe Search Query Language.\n\nUse this when:\n- Looking up subscriptions by metadata, status, or plan attributes\n- Building dashboard-style filtered views\n- Finding subscriptions matching a complex boolean query\n\nSearch results are eventually consistent (not for read-after-write flows).\nReturns: \\`{ total_count, has_more, data }\\` envelope.\nStripe docs: https://stripe.com/docs/api/subscriptions/search`,\n inputSchema: {\n type: 'object',\n properties: {\n query: {\n type: 'string',\n description:\n 'Stripe Search Query Language string. Supported fields: status, customer, plan.id, price.id, metadata.<key>.',\n },\n limit: {\n type: 'integer',\n description: 'Maximum number of results (1-100). Defaults to 10.',\n minimum: 1,\n maximum: 100,\n },\n expand: {\n type: 'array',\n description: 'Stripe expandable fields (e.g. [\"data.customer\"]).',\n items: { type: 'string' },\n },\n },\n required: ['query'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { query, ...rest } = parsed.data;\n const result = await stripe.subscriptions.search(\n buildStripeParams<Stripe.SubscriptionSearchParams>({ query, ...rest }),\n );\n // Search results are paginated via `next_page`, not `has_more`. We return\n // the first page (Stripe's search limit is 100 per page). Auto-pagination\n // across search pages is intentionally omitted to keep search responsive.\n const data = result.data as Stripe.Subscription[];\n return JSON.stringify(\n { total_count: data.length, has_more: result.has_more, data },\n null,\n 2,\n );\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createSubscription } from './create-subscription.js';\nimport { toolDefinition as getSubscription } from './get-subscription.js';\nimport { toolDefinition as updateSubscription } from './update-subscription.js';\nimport { toolDefinition as cancelSubscription } from './cancel-subscription.js';\nimport { toolDefinition as pauseSubscription } from './pause-subscription.js';\nimport { toolDefinition as resumeSubscription } from './resume-subscription.js';\nimport { toolDefinition as listSubscriptions } from './list-subscriptions.js';\nimport { toolDefinition as searchSubscriptions } from './search-subscriptions.js';\n\n/**\n * Subscription tools — full lifecycle: create, read, update, cancel, pause,\n * resume, list, and search. Ordered to mirror the Stripe API resource.\n */\nexport const tools: ToolDefinition[] = [\n createSubscription,\n getSubscription,\n updateSubscription,\n cancelSubscription,\n pauseSubscription,\n resumeSubscription,\n listSubscriptions,\n searchSubscriptions,\n];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n invoice_id: z\n .string()\n .describe('ID of the invoice to retrieve (in_...).'),\n expand: z\n .array(z.string())\n .optional()\n .describe(\n 'Stripe expandable fields (e.g. [\"customer\",\"subscription\",\"payment_intent\",\"lines.data.price\"]).',\n ),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_invoices_get',\n description: `Retrieve an invoice by ID.\n\nUse this when:\n- Inspecting a single invoice's line items, totals, or status\n- Confirming an invoice was paid before granting access\n- Showing a customer their invoice history detail\n\nReturns: the Stripe Invoice object.\nStripe docs: https://stripe.com/docs/api/invoices/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n invoice_id: {\n type: 'string',\n description: 'ID of the invoice to retrieve (in_...).',\n },\n expand: {\n type: 'array',\n description:\n 'Stripe expandable fields (e.g. [\"customer\",\"subscription\",\"payment_intent\"]).',\n items: { type: 'string' },\n },\n },\n required: ['invoice_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.invoices.retrieve(\n parsed.data.invoice_id,\n buildStripeParams<Stripe.InvoiceRetrieveParams>({\n expand: parsed.data.expand,\n }),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Page size for each Stripe request (1-100). Use max_items for total cap.'),\n customer: z\n .string()\n .optional()\n .describe('Only return invoices for this customer (cus_...).'),\n status: z\n .enum(['draft', 'open', 'paid', 'uncollectible', 'void'])\n .optional()\n .describe('Filter by invoice status. Stripe accepts: draft, open, paid, uncollectible, void.'),\n subscription: z\n .string()\n .optional()\n .describe('Only return invoices for this subscription (sub_...).'),\n starting_after: z\n .string()\n .optional()\n .describe('Pagination cursor — ID of the last object from the previous page (in_...).'),\n max_items: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Hard cap on total items returned. Defaults to 1000.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_invoices_list',\n description: `List invoices with optional filters.\n\nUse this when:\n- Showing a customer their invoice history\n- Finding open or past-due invoices for collection workflows\n- Auditing drafts before finalization\n\nAuto-paginates through all matching invoices (capped by max_items).\nReturns: \\`{ total_count, has_more, data }\\` envelope.\nStripe docs: https://stripe.com/docs/api/invoices/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: {\n type: 'integer',\n description: 'Page size for each Stripe request (1-100).',\n minimum: 1,\n maximum: 100,\n },\n customer: {\n type: 'string',\n description: 'Only return invoices for this customer (cus_...).',\n },\n status: {\n type: 'string',\n enum: ['draft', 'open', 'paid', 'uncollectible', 'void'],\n description: 'Filter by invoice status.',\n },\n subscription: {\n type: 'string',\n description: 'Only return invoices for this subscription (sub_...).',\n },\n starting_after: {\n type: 'string',\n description: 'Pagination cursor — ID of the last object from the previous page.',\n },\n max_items: {\n type: 'integer',\n description: 'Hard cap on total items returned. Defaults to 1000.',\n minimum: 1,\n },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const all = await paginateAll<Stripe.Invoice>(\n (p) =>\n stripe.invoices.list({\n ...p,\n ...(parsed.data.customer ? { customer: parsed.data.customer } : {}),\n ...(parsed.data.status ? { status: parsed.data.status } : {}),\n ...(parsed.data.subscription ? { subscription: parsed.data.subscription } : {}),\n }),\n { maxItems: parsed.data.max_items ?? 1000 },\n );\n return JSON.stringify(\n { total_count: all.length, has_more: false, data: all },\n null,\n 2,\n );\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n invoice_id: z\n .string()\n .describe('ID of the invoice to pay (in_...). Must be in draft or open status.'),\n paid_out_of_band: z\n .boolean()\n .optional()\n .describe(\n 'If true, mark the invoice as paid without charging through Stripe (e.g. cash, wire). Defaults to false.',\n ),\n source: z\n .string()\n .optional()\n .describe('ID of a payment source (card_..., src_..., etc.) to charge. Must belong to the invoice customer.'),\n payment_method: z\n .string()\n .optional()\n .describe('ID of a PaymentMethod (pm_...) to charge. Must belong to the invoice customer.'),\n mandate: z\n .string()\n .optional()\n .describe('ID of a Mandate to use for this payment. Must correspond to the payment method.'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Stripe expandable fields (e.g. [\"payment_intent\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_invoices_pay',\n description: `Pay an invoice (draft or open) immediately.\n\nUse this when:\n- A customer clicks \"Pay now\" on an open invoice\n- You need to advance an invoice to paid status outside the normal billing cycle\n- Marking an invoice as paid out-of-band (cash, check, wire transfer)\n\nReturns: the Stripe Invoice object after payment is attempted (status: 'paid' or 'open').\nStripe docs: https://stripe.com/docs/api/invoices/pay`,\n inputSchema: {\n type: 'object',\n properties: {\n invoice_id: {\n type: 'string',\n description: 'ID of the invoice to pay (in_...).',\n },\n paid_out_of_band: {\n type: 'boolean',\n description: 'If true, mark as paid without charging through Stripe.',\n },\n source: {\n type: 'string',\n description: 'ID of a payment source (card_..., src_...) to charge.',\n },\n payment_method: {\n type: 'string',\n description: 'ID of a PaymentMethod (pm_...) to charge.',\n },\n mandate: {\n type: 'string',\n description: 'ID of a Mandate to use for this payment.',\n },\n expand: {\n type: 'array',\n description: 'Stripe expandable fields (e.g. [\"payment_intent\"]).',\n items: { type: 'string' },\n },\n },\n required: ['invoice_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { invoice_id, ...rest } = parsed.data;\n const result = await stripe.invoices.pay(\n invoice_id,\n buildStripeParams<Stripe.InvoicePayParams>(rest),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n invoice_id: z\n .string()\n .describe('ID of the invoice to void (in_...). Must be in open status.'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Stripe expandable fields (e.g. [\"customer\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_invoices_void',\n description: `Mark an open invoice as void.\n\nUse this when:\n- An invoice was issued in error and the customer should never be charged\n- A disputed charge results in cancellation of the invoice\n- You need to cleanly cancel an invoice without deleting it (for audit trail)\n\nVoiding is irreversible. The invoice remains visible but is no longer payable.\nReturns: the Stripe Invoice object (status: 'void').\nStripe docs: https://stripe.com/docs/api/invoices/void`,\n inputSchema: {\n type: 'object',\n properties: {\n invoice_id: {\n type: 'string',\n description: 'ID of the invoice to void (in_...). Must be in open status.',\n },\n expand: {\n type: 'array',\n description: 'Stripe expandable fields (e.g. [\"customer\"]).',\n items: { type: 'string' },\n },\n },\n required: ['invoice_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { invoice_id, ...rest } = parsed.data;\n const result = await stripe.invoices.voidInvoice(\n invoice_id,\n buildStripeParams<Stripe.InvoiceVoidInvoiceParams>(rest),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n invoice_id: z\n .string()\n .describe('ID of the draft invoice to finalize (in_...). Must be in draft status.'),\n auto_advance: z\n .boolean()\n .optional()\n .describe(\n 'If true (default), Stripe auto-advances the invoice through the billing cycle. Set false to require manual advancement.',\n ),\n expand: z\n .array(z.string())\n .optional()\n .describe('Stripe expandable fields (e.g. [\"customer\",\"payment_intent\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_invoices_finalize',\n description: `Finalize a draft invoice, advancing it to open status.\n\nUse this when:\n- You want to lock in line items and email the customer\n- Triggering payment collection on a manually-created draft\n- Converting a draft to an open invoice before charging\n\nReturns: the Stripe Invoice object (status: 'open').\nStripe docs: https://stripe.com/docs/api/invoices/finalize`,\n inputSchema: {\n type: 'object',\n properties: {\n invoice_id: {\n type: 'string',\n description: 'ID of the draft invoice to finalize (in_...).',\n },\n auto_advance: {\n type: 'boolean',\n description:\n 'If true (default), Stripe auto-advances the invoice through the billing cycle.',\n },\n expand: {\n type: 'array',\n description: 'Stripe expandable fields (e.g. [\"customer\",\"payment_intent\"]).',\n items: { type: 'string' },\n },\n },\n required: ['invoice_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { invoice_id, ...rest } = parsed.data;\n const result = await stripe.invoices.finalizeInvoice(\n invoice_id,\n buildStripeParams<Stripe.InvoiceFinalizeInvoiceParams>(rest),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n invoice_id: z\n .string()\n .describe('ID of the invoice to email (in_...). Must be in open status with collection_method=send_invoice.'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Stripe expandable fields (e.g. [\"customer\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_invoices_send',\n description: `Email an invoice to the customer.\n\nUse this when:\n- The invoice uses \\`send_invoice\\` collection method and you want to email it\n- Re-sending a reminder to the customer\n- Manually triggering invoice delivery outside the auto-advance flow\n\nReturns: the Stripe Invoice object (sent to the customer email on file).\nStripe docs: https://stripe.com/docs/api/invoices/send`,\n inputSchema: {\n type: 'object',\n properties: {\n invoice_id: {\n type: 'string',\n description: 'ID of the invoice to email (in_...).',\n },\n expand: {\n type: 'array',\n description: 'Stripe expandable fields (e.g. [\"customer\"]).',\n items: { type: 'string' },\n },\n },\n required: ['invoice_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { invoice_id, ...rest } = parsed.data;\n const result = await stripe.invoices.sendInvoice(\n invoice_id,\n buildStripeParams<Stripe.InvoiceSendInvoiceParams>(rest),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as getInvoice } from './get-invoice.js';\nimport { toolDefinition as listInvoices } from './list-invoices.js';\nimport { toolDefinition as payInvoice } from './pay-invoice.js';\nimport { toolDefinition as voidInvoice } from './void-invoice.js';\nimport { toolDefinition as finalizeInvoice } from './finalize-invoice.js';\nimport { toolDefinition as sendInvoice } from './send-invoice.js';\n\n/**\n * Invoice tools — lifecycle from retrieval/listing through finalization,\n * payment, emailing, and voiding. Ordered to mirror common billing flows.\n */\nexport const tools: ToolDefinition[] = [\n getInvoice,\n listInvoices,\n payInvoice,\n voidInvoice,\n finalizeInvoice,\n sendInvoice,\n];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n amount: z.number().int().min(1).describe('Amount in the smallest currency unit (e.g. cents)'),\n currency: z.string().describe('Three-letter ISO currency code, lowercase (e.g. usd)'),\n customer: z.string().optional().describe('ID of the customer to attach this PaymentIntent to'),\n description: z.string().optional().describe('Arbitrary description for the PaymentIntent'),\n metadata: z.record(z.string(), z.string()).optional().describe('Set of key-value pairs to attach to the object'),\n payment_method: z.string().optional().describe('ID of the payment method to use with this PaymentIntent'),\n confirm: z.boolean().optional().describe('If true, attempt to confirm the PaymentIntent immediately'),\n automatic_payment_methods: z\n .object({ enabled: z.boolean().describe('Enable automatic payment methods') })\n .optional()\n .describe('Configure automatic payment methods'),\n receipt_email: z.string().optional().describe('Email to send the receipt to'),\n statement_descriptor: z.string().optional().describe('Information about the charge for the customer\\u2019s statement'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payment_intents_create',\n description: `Create a PaymentIntent to collect payment from a customer.\n\nUse this when:\n- You need to charge a customer a one-time amount\n- You're building a custom checkout flow\n\nReturns: the created Stripe PaymentIntent object (includes client_secret).\nStripe docs: https://stripe.com/docs/api/payment_intents/create`,\n inputSchema: {\n type: 'object',\n properties: {\n amount: { type: 'integer', description: 'Amount in the smallest currency unit (e.g. cents)' },\n currency: { type: 'string', description: 'Three-letter ISO currency code, lowercase (e.g. usd)' },\n customer: { type: 'string', description: 'ID of the customer to attach this PaymentIntent to' },\n description: { type: 'string', description: 'Arbitrary description for the PaymentIntent' },\n metadata: { type: 'object', description: 'Set of key-value pairs to attach to the object' },\n payment_method: { type: 'string', description: 'ID of the payment method to use with this PaymentIntent' },\n confirm: { type: 'boolean', description: 'If true, attempt to confirm the PaymentIntent immediately' },\n automatic_payment_methods: {\n type: 'object',\n description: 'Configure automatic payment methods',\n properties: { enabled: { type: 'boolean', description: 'Enable automatic payment methods' } },\n },\n receipt_email: { type: 'string', description: 'Email to send the receipt to' },\n statement_descriptor: {\n type: 'string',\n description: 'Information about the charge for the customer\\u2019s statement',\n },\n },\n required: ['amount', 'currency'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.paymentIntents.create(\n buildStripeParams<Stripe.PaymentIntentCreateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n payment_intent_id: z.string().describe('ID of the PaymentIntent to retrieve (e.g. pi_1abc23)'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payment_intents_get',\n description: `Retrieve a single PaymentIntent by ID.\n\nUse this when:\n- You need to check the status of a payment\n- You want to inspect the charges, amount, or metadata on a PaymentIntent\n\nReturns: the Stripe PaymentIntent object.\nStripe docs: https://stripe.com/docs/api/payment_intents/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n payment_intent_id: { type: 'string', description: 'ID of the PaymentIntent to retrieve (e.g. pi_1abc23)' },\n },\n required: ['payment_intent_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.paymentIntents.retrieve(\n parsed.data.payment_intent_id,\n buildStripeParams<Stripe.PaymentIntentRetrieveParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n payment_intent_id: z.string().describe('ID of the PaymentIntent to confirm (e.g. pi_1abc23)'),\n payment_method: z.string().optional().describe('ID of the payment method to use for confirmation'),\n receipt_email: z.string().optional().describe('Email to send the receipt to'),\n return_url: z.string().optional().describe('URL to redirect the customer back to after authentication'),\n mandate: z.string().optional().describe('ID of the mandate to use for this confirmation'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payment_intents_confirm',\n description: `Confirm a PaymentIntent, kickstarting payment processing.\n\nUse this when:\n- You previously created a PaymentIntent and now want to collect payment\n- A PaymentIntent requires additional confirmation (e.g. after SCA challenge)\n\nReturns: the confirmed (or still-pending) Stripe PaymentIntent object.\nStripe docs: https://stripe.com/docs/api/payment_intents/confirm`,\n inputSchema: {\n type: 'object',\n properties: {\n payment_intent_id: { type: 'string', description: 'ID of the PaymentIntent to confirm (e.g. pi_1abc23)' },\n payment_method: { type: 'string', description: 'ID of the payment method to use for confirmation' },\n receipt_email: { type: 'string', description: 'Email to send the receipt to' },\n return_url: { type: 'string', description: 'URL to redirect the customer back to after authentication' },\n mandate: { type: 'string', description: 'ID of the mandate to use for this confirmation' },\n },\n required: ['payment_intent_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.paymentIntents.confirm(\n parsed.data.payment_intent_id,\n buildStripeParams<Stripe.PaymentIntentConfirmParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n payment_intent_id: z.string().describe('ID of the PaymentIntent to cancel (e.g. pi_1abc23)'),\n cancellation_reason: z\n .enum(['duplicate', 'fraudulent', 'requested_by_customer', 'abandoned'])\n .optional()\n .describe('Reason for the cancellation'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payment_intents_cancel',\n description: `Cancel a PaymentIntent that has not yet been captured.\n\nUse this when:\n- A customer abandons checkout\n- A payment is suspected to be fraudulent\n- The PaymentIntent was created in error\n\nReturns: the canceled Stripe PaymentIntent object.\nStripe docs: https://stripe.com/docs/api/payment_intents/cancel`,\n inputSchema: {\n type: 'object',\n properties: {\n payment_intent_id: { type: 'string', description: 'ID of the PaymentIntent to cancel (e.g. pi_1abc23)' },\n cancellation_reason: {\n type: 'string',\n enum: ['duplicate', 'fraudulent', 'requested_by_customer', 'abandoned'],\n description: 'Reason for the cancellation',\n },\n },\n required: ['payment_intent_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.paymentIntents.cancel(\n parsed.data.payment_intent_id,\n buildStripeParams<Stripe.PaymentIntentCancelParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\nimport { paginateAll, listEnvelope } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z.number().int().min(1).max(100).optional().describe('Page size per request (max 100, default 100)'),\n customer: z.string().optional().describe('Only return PaymentIntents for this customer ID'),\n status: z\n .enum([\n 'requires_payment_method',\n 'requires_confirmation',\n 'succeeded',\n 'canceled',\n 'processing',\n 'requires_action',\n ])\n .optional()\n .describe('Only return PaymentIntents with this status'),\n starting_after: z.string().optional().describe('Cursor: ID of the object to start after'),\n max_items: z.number().int().min(1).optional().describe('Hard cap on total items to fetch across all pages'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payment_intents_list',\n description: `List PaymentIntents, with optional filtering and auto-pagination.\n\nUse this when:\n- You want to review recent payments\n- You need to find PaymentIntents for a specific customer or status\n\nReturns: \\`{ total_count, has_more, data }\\` envelope of Stripe PaymentIntent objects.\nStripe docs: https://stripe.com/docs/api/payment_intents/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: { type: 'integer', description: 'Page size per request (max 100, default 100)' },\n customer: { type: 'string', description: 'Only return PaymentIntents for this customer ID' },\n status: {\n type: 'string',\n enum: [\n 'requires_payment_method',\n 'requires_confirmation',\n 'succeeded',\n 'canceled',\n 'processing',\n 'requires_action',\n ],\n description: 'Only return PaymentIntents with this status',\n },\n starting_after: { type: 'string', description: 'Cursor: ID of the object to start after' },\n max_items: { type: 'integer', description: 'Hard cap on total items to fetch across all pages' },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const listParams = buildStripeParams<Stripe.PaymentIntentListParams>({\n customer: parsed.data.customer,\n status: parsed.data.status,\n limit: parsed.data.limit,\n starting_after: parsed.data.starting_after,\n });\n const data = await paginateAll<Stripe.PaymentIntent>(\n (p) => stripe.paymentIntents.list({ ...listParams, ...p }),\n parsed.data.max_items !== undefined ? { maxItems: parsed.data.max_items } : undefined,\n );\n return JSON.stringify(listEnvelope<Stripe.PaymentIntent>(data), null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createPaymentIntent } from './create-payment-intent.js';\nimport { toolDefinition as getPaymentIntent } from './get-payment-intent.js';\nimport { toolDefinition as confirmPaymentIntent } from './confirm-payment-intent.js';\nimport { toolDefinition as cancelPaymentIntent } from './cancel-payment-intent.js';\nimport { toolDefinition as listPaymentIntents } from './list-payment-intents.js';\n\nexport const tools: ToolDefinition[] = [\n createPaymentIntent,\n getPaymentIntent,\n confirmPaymentIntent,\n cancelPaymentIntent,\n listPaymentIntents,\n];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z\n .object({\n payment_intent: z.string().optional().describe('ID of the PaymentIntent to refund (e.g. pi_1abc23)'),\n charge: z.string().optional().describe('ID of the charge to refund (e.g. ch_1abc23)'),\n amount: z.number().int().min(1).optional().describe('Amount to refund in smallest currency unit; defaults to full refund'),\n reason: z\n .enum(['duplicate', 'fraudulent', 'requested_by_customer', 'expired_uncaptured_charge'])\n .optional()\n .describe('Reason for the refund'),\n metadata: z.record(z.string(), z.string()).optional().describe('Set of key-value pairs to attach to the object'),\n refund_application_fee: z.boolean().optional().describe('Refund the application fee on a Connect charge'),\n reverse_transfer: z.boolean().optional().describe('Reverse the transfer on a Connect charge'),\n })\n .refine((data) => Boolean(data.payment_intent || data.charge), {\n message: 'Either payment_intent or charge is required to identify what to refund.',\n });\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_refunds_create',\n description: `Create a refund for a previously captured charge or PaymentIntent.\n\nUse this when:\n- A customer requests a refund\n- A payment was made in error\n\nReturns: the created Stripe Refund object.\nStripe docs: https://stripe.com/docs/api/refunds/create`,\n inputSchema: {\n type: 'object',\n properties: {\n payment_intent: { type: 'string', description: 'ID of the PaymentIntent to refund (e.g. pi_1abc23)' },\n charge: { type: 'string', description: 'ID of the charge to refund (e.g. ch_1abc23)' },\n amount: { type: 'integer', description: 'Amount to refund in smallest currency unit; defaults to full refund' },\n reason: {\n type: 'string',\n enum: ['duplicate', 'fraudulent', 'requested_by_customer', 'expired_uncaptured_charge'],\n description: 'Reason for the refund',\n },\n metadata: { type: 'object', description: 'Set of key-value pairs to attach to the object' },\n refund_application_fee: { type: 'boolean', description: 'Refund the application fee on a Connect charge' },\n reverse_transfer: { type: 'boolean', description: 'Reverse the transfer on a Connect charge' },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.refunds.create(\n buildStripeParams<Stripe.RefundCreateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n refund_id: z.string().describe('ID of the refund to retrieve (e.g. re_1abc23)'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_refunds_get',\n description: `Retrieve a single refund by ID.\n\nUse this when:\n- You want to check the status of a refund\n- You need to inspect the metadata or amount on a refund\n\nReturns: the Stripe Refund object.\nStripe docs: https://stripe.com/docs/api/refunds/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n refund_id: { type: 'string', description: 'ID of the refund to retrieve (e.g. re_1abc23)' },\n },\n required: ['refund_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.refunds.retrieve(\n parsed.data.refund_id,\n buildStripeParams<Stripe.RefundRetrieveParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\nimport { paginateAll, listEnvelope } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z.number().int().min(1).max(100).optional().describe('Page size per request (max 100, default 100)'),\n payment_intent: z.string().optional().describe('Only return refunds for this PaymentIntent ID'),\n charge: z.string().optional().describe('Only return refunds for this charge ID'),\n starting_after: z.string().optional().describe('Cursor: ID of the object to start after'),\n max_items: z.number().int().min(1).optional().describe('Hard cap on total items to fetch across all pages'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_refunds_list',\n description: `List refunds, with optional filtering and auto-pagination.\n\nUse this when:\n- You want to review recent refunds\n- You need to find refunds for a specific charge or PaymentIntent\n\nReturns: \\`{ total_count, has_more, data }\\` envelope of Stripe Refund objects.\nStripe docs: https://stripe.com/docs/api/refunds/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: { type: 'integer', description: 'Page size per request (max 100, default 100)' },\n payment_intent: { type: 'string', description: 'Only return refunds for this PaymentIntent ID' },\n charge: { type: 'string', description: 'Only return refunds for this charge ID' },\n starting_after: { type: 'string', description: 'Cursor: ID of the object to start after' },\n max_items: { type: 'integer', description: 'Hard cap on total items to fetch across all pages' },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const listParams = buildStripeParams<Stripe.RefundListParams>({\n payment_intent: parsed.data.payment_intent,\n charge: parsed.data.charge,\n limit: parsed.data.limit,\n starting_after: parsed.data.starting_after,\n });\n const data = await paginateAll<Stripe.Refund>(\n (p) => stripe.refunds.list({ ...listParams, ...p }),\n parsed.data.max_items !== undefined ? { maxItems: parsed.data.max_items } : undefined,\n );\n return JSON.stringify(listEnvelope<Stripe.Refund>(data), null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createRefund } from './create-refund.js';\nimport { toolDefinition as getRefund } from './get-refund.js';\nimport { toolDefinition as listRefunds } from './list-refunds.js';\n\nexport const tools: ToolDefinition[] = [createRefund, getRefund, listRefunds];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n dispute_id: z.string().describe('ID of the dispute to retrieve (e.g. dp_1abc23)'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_disputes_get',\n description: `Retrieve a single dispute by ID.\n\nUse this when:\n- You need to inspect the evidence on a chargeback\n- You want to check the status or amount of a dispute\n\nReturns: the Stripe Dispute object.\nStripe docs: https://stripe.com/docs/api/disputes/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n dispute_id: { type: 'string', description: 'ID of the dispute to retrieve (e.g. dp_1abc23)' },\n },\n required: ['dispute_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.disputes.retrieve(\n parsed.data.dispute_id,\n buildStripeParams<Stripe.DisputeRetrieveParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n dispute_id: z.string().describe('ID of the dispute to update (e.g. dp_1abc23)'),\n evidence: z\n .record(z.string(), z.string())\n .optional()\n .describe('Key-value map of evidence fields (e.g. access_activity_log, billing_address)'),\n submit: z.boolean().optional().describe('Whether to submit evidence immediately (closes the dispute)'),\n metadata: z.record(z.string(), z.string()).optional().describe('Set of key-value pairs to attach to the object'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_disputes_update',\n description: `Update a dispute with evidence or metadata, optionally submitting it.\n\nUse this when:\n- You are responding to a chargeback with evidence\n- You want to attach metadata to track dispute status internally\n\nReturns: the updated Stripe Dispute object.\nStripe docs: https://stripe.com/docs/api/disputes/update`,\n inputSchema: {\n type: 'object',\n properties: {\n dispute_id: { type: 'string', description: 'ID of the dispute to update (e.g. dp_1abc23)' },\n evidence: {\n type: 'object',\n description: 'Key-value map of evidence fields (e.g. access_activity_log, billing_address)',\n },\n submit: { type: 'boolean', description: 'Whether to submit evidence immediately (closes the dispute)' },\n metadata: { type: 'object', description: 'Set of key-value pairs to attach to the object' },\n },\n required: ['dispute_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.disputes.update(\n parsed.data.dispute_id,\n buildStripeParams<Stripe.DisputeUpdateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\n\nconst inputSchema = z.object({\n dispute_id: z.string().describe('ID of the dispute to close (e.g. dp_1abc23)'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_disputes_close',\n description: `Close a dispute, forfeiting the dispute to the customer.\n\nUse this when:\n- You decide NOT to challenge a dispute\n- You want to accept the chargeback immediately\n\nReturns: the closed Stripe Dispute object (status: lost).\nStripe docs: https://stripe.com/docs/api/disputes/close`,\n inputSchema: {\n type: 'object',\n properties: {\n dispute_id: { type: 'string', description: 'ID of the dispute to close (e.g. dp_1abc23)' },\n },\n required: ['dispute_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.disputes.close(parsed.data.dispute_id);\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\nimport { paginateAll, listEnvelope } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z.number().int().min(1).max(100).optional().describe('Page size per request (max 100, default 100)'),\n payment_intent: z.string().optional().describe('Only return disputes for this PaymentIntent ID'),\n charge: z.string().optional().describe('Only return disputes for this charge ID'),\n starting_after: z.string().optional().describe('Cursor: ID of the object to start after'),\n max_items: z.number().int().min(1).optional().describe('Hard cap on total items to fetch across all pages'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_disputes_list',\n description: `List disputes, with optional filtering and auto-pagination.\n\nUse this when:\n- You want to review recent chargebacks\n- You need to find disputes for a specific charge or PaymentIntent\n\nReturns: \\`{ total_count, has_more, data }\\` envelope of Stripe Dispute objects.\nStripe docs: https://stripe.com/docs/api/disputes/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: { type: 'integer', description: 'Page size per request (max 100, default 100)' },\n payment_intent: { type: 'string', description: 'Only return disputes for this PaymentIntent ID' },\n charge: { type: 'string', description: 'Only return disputes for this charge ID' },\n starting_after: { type: 'string', description: 'Cursor: ID of the object to start after' },\n max_items: { type: 'integer', description: 'Hard cap on total items to fetch across all pages' },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const listParams = buildStripeParams<Stripe.DisputeListParams>({\n payment_intent: parsed.data.payment_intent,\n charge: parsed.data.charge,\n limit: parsed.data.limit,\n starting_after: parsed.data.starting_after,\n });\n const data = await paginateAll<Stripe.Dispute>(\n (p) => stripe.disputes.list({ ...listParams, ...p }),\n parsed.data.max_items !== undefined ? { maxItems: parsed.data.max_items } : undefined,\n );\n return JSON.stringify(listEnvelope<Stripe.Dispute>(data), null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as getDispute } from './get-dispute.js';\nimport { toolDefinition as updateDispute } from './update-dispute.js';\nimport { toolDefinition as closeDispute } from './close-dispute.js';\nimport { toolDefinition as listDisputes } from './list-disputes.js';\n\nexport const tools: ToolDefinition[] = [getDispute, updateDispute, closeDispute, listDisputes];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n url: z.string().url().describe('HTTPS URL of the webhook endpoint to receive events'),\n enabled_events: z\n .array(z.string())\n .min(1)\n .describe('List of event types to subscribe to (e.g. [\"charge.succeeded\", \"invoice.paid\"])'),\n description: z.string().optional().describe('Optional description for the webhook endpoint'),\n metadata: z.record(z.string(), z.string()).optional().describe('Set of key-value pairs to attach to the object'),\n api_version: z.string().optional().describe('Stripe API version the endpoint should use (e.g. 2024-12-18.acacia)'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_webhooks_create',\n description: `Create a webhook endpoint to receive Stripe event notifications.\n\nUse this when:\n- You want to be notified of events like charge.succeeded or invoice.paid\n- You are configuring a new backend service to react to Stripe events\n\nReturns: the created Stripe WebhookEndpoint object (includes a signing secret).\nStripe docs: https://stripe.com/docs/api/webhook_endpoints/create`,\n inputSchema: {\n type: 'object',\n properties: {\n url: { type: 'string', description: 'HTTPS URL of the webhook endpoint to receive events' },\n enabled_events: {\n type: 'array',\n items: { type: 'string' },\n description: 'List of event types to subscribe to (e.g. [\"charge.succeeded\", \"invoice.paid\"])',\n },\n description: { type: 'string', description: 'Optional description for the webhook endpoint' },\n metadata: { type: 'object', description: 'Set of key-value pairs to attach to the object' },\n api_version: {\n type: 'string',\n description: 'Stripe API version the endpoint should use (e.g. 2024-12-18.acacia)',\n },\n },\n required: ['url', 'enabled_events'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.webhookEndpoints.create(\n buildStripeParams<Stripe.WebhookEndpointCreateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n webhook_id: z.string().describe('ID of the webhook endpoint to retrieve (e.g. we_1abc23)'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_webhooks_get',\n description: `Retrieve a single webhook endpoint by ID.\n\nUse this when:\n- You want to inspect a webhook endpoint configuration\n- You need to verify which events a webhook is subscribed to\n\nReturns: the Stripe WebhookEndpoint object.\nStripe docs: https://stripe.com/docs/api/webhook_endpoints/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n webhook_id: { type: 'string', description: 'ID of the webhook endpoint to retrieve (e.g. we_1abc23)' },\n },\n required: ['webhook_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.webhookEndpoints.retrieve(\n parsed.data.webhook_id,\n buildStripeParams<Stripe.WebhookEndpointRetrieveParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n webhook_id: z.string().describe('ID of the webhook endpoint to update (e.g. we_1abc23)'),\n url: z.string().url().optional().describe('New HTTPS URL for the webhook endpoint'),\n enabled_events: z\n .array(z.string())\n .optional()\n .describe('New list of event types to subscribe to'),\n description: z.string().optional().describe('Optional description for the webhook endpoint'),\n metadata: z.record(z.string(), z.string()).optional().describe('Set of key-value pairs to attach to the object'),\n disabled: z.boolean().optional().describe('If true, the endpoint is disabled and will not receive events'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_webhooks_update',\n description: `Update a webhook endpoint (URL, events, description, enabled state, metadata).\n\nUse this when:\n- Your webhook receiver URL has changed\n- You want to add or remove subscribed events\n- You need to temporarily disable an endpoint\n\nReturns: the updated Stripe WebhookEndpoint object.\nStripe docs: https://stripe.com/docs/api/webhook_endpoints/update`,\n inputSchema: {\n type: 'object',\n properties: {\n webhook_id: { type: 'string', description: 'ID of the webhook endpoint to update (e.g. we_1abc23)' },\n url: { type: 'string', description: 'New HTTPS URL for the webhook endpoint' },\n enabled_events: { type: 'array', items: { type: 'string' }, description: 'New list of event types to subscribe to' },\n description: { type: 'string', description: 'Optional description for the webhook endpoint' },\n metadata: { type: 'object', description: 'Set of key-value pairs to attach to the object' },\n disabled: { type: 'boolean', description: 'If true, the endpoint is disabled and will not receive events' },\n },\n required: ['webhook_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.webhookEndpoints.update(\n parsed.data.webhook_id,\n buildStripeParams<Stripe.WebhookEndpointUpdateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\n\nconst inputSchema = z.object({\n webhook_id: z.string().describe('ID of the webhook endpoint to delete (e.g. we_1abc23)'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_webhooks_delete',\n description: `Permanently delete a webhook endpoint.\n\nUse this when:\n- The webhook receiver is decommissioned\n- You want to stop all event delivery to a URL\n\nReturns: the Stripe deletion response (\\`{ id, deleted: true, object: 'webhook_endpoint' }\\`).\nStripe docs: https://stripe.com/docs/api/webhook_endpoints/delete`,\n inputSchema: {\n type: 'object',\n properties: {\n webhook_id: { type: 'string', description: 'ID of the webhook endpoint to delete (e.g. we_1abc23)' },\n },\n required: ['webhook_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.webhookEndpoints.del(parsed.data.webhook_id);\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\nimport { paginateAll, listEnvelope } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z.number().int().min(1).max(100).optional().describe('Page size per request (max 100, default 100)'),\n starting_after: z.string().optional().describe('Cursor: ID of the object to start after'),\n max_items: z.number().int().min(1).optional().describe('Hard cap on total items to fetch across all pages'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_webhooks_list',\n description: `List webhook endpoints with auto-pagination.\n\nUse this when:\n- You want to audit existing webhook configurations\n- You need to find a webhook by URL or event subscription\n\nReturns: \\`{ total_count, has_more, data }\\` envelope of Stripe WebhookEndpoint objects.\nStripe docs: https://stripe.com/docs/api/webhook_endpoints/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: { type: 'integer', description: 'Page size per request (max 100, default 100)' },\n starting_after: { type: 'string', description: 'Cursor: ID of the object to start after' },\n max_items: { type: 'integer', description: 'Hard cap on total items to fetch across all pages' },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const listParams = buildStripeParams<Stripe.WebhookEndpointListParams>({\n limit: parsed.data.limit,\n starting_after: parsed.data.starting_after,\n });\n const data = await paginateAll<Stripe.WebhookEndpoint>(\n (p) => stripe.webhookEndpoints.list({ ...listParams, ...p }),\n parsed.data.max_items !== undefined ? { maxItems: parsed.data.max_items } : undefined,\n );\n return JSON.stringify(listEnvelope<Stripe.WebhookEndpoint>(data), null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createWebhook } from './create-webhook.js';\nimport { toolDefinition as getWebhook } from './get-webhook.js';\nimport { toolDefinition as updateWebhook } from './update-webhook.js';\nimport { toolDefinition as deleteWebhook } from './delete-webhook.js';\nimport { toolDefinition as listWebhooks } from './list-webhooks.js';\n\nexport const tools: ToolDefinition[] = [\n createWebhook,\n getWebhook,\n updateWebhook,\n deleteWebhook,\n listWebhooks,\n];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n percent_off: z\n .number()\n .min(0)\n .max(100)\n .optional()\n .describe('A positive float (0..100) representing the discount percent. Required if amount_off is not given.'),\n amount_off: z\n .number()\n .int()\n .nonnegative()\n .optional()\n .describe('Positive integer (cents) to subtract from an invoice total. Required if percent_off is not given.'),\n currency: z\n .string()\n .optional()\n .describe('Three-letter ISO currency code (lowercase). Required when amount_off is set.'),\n duration: z\n .enum(['once', 'repeating', 'forever'])\n .describe('How long the discount lasts when applied to a subscription.'),\n duration_in_months: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Number of months the discount is in effect. Required when duration=\"repeating\".'),\n max_redemptions: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Maximum number of times this coupon can be redeemed.'),\n redeem_by: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Unix timestamp (seconds) of the last time the coupon can be redeemed.'),\n name: z\n .string()\n .optional()\n .describe('Display name shown to customers on invoices and receipts.'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Arbitrary key-value metadata attached to the coupon.'),\n applies_to: z\n .object({\n products: z.array(z.string()).describe('Product IDs this coupon applies to.'),\n })\n .optional()\n .describe('Restrict the coupon to specific products.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_coupons_create',\n description: `Create a coupon that can be applied to subscriptions or invoices for a discount.\n\nUse this when:\n- you need a percentage discount (e.g. 20% off) on a subscription or invoice\n- you need a fixed-amount discount (e.g. $5 off) in a specific currency\n- you are configuring promotional offers before generating redeemable codes\n\nReturns: the full Stripe Coupon object (id, percent_off/amount_off, duration, validity, metadata).\nStripe docs: https://stripe.com/docs/api/coupons/create`,\n inputSchema: {\n type: 'object',\n properties: {\n percent_off: {\n type: 'number',\n minimum: 0,\n maximum: 100,\n description: 'A positive float (0..100) representing the discount percent. Required if amount_off is not given.',\n },\n amount_off: {\n type: 'integer',\n minimum: 0,\n description: 'Positive integer (cents) to subtract from an invoice total. Required if percent_off is not given.',\n },\n currency: {\n type: 'string',\n description: 'Three-letter ISO currency code (lowercase). Required when amount_off is set.',\n },\n duration: {\n type: 'string',\n enum: ['once', 'repeating', 'forever'],\n description: 'How long the discount lasts when applied to a subscription.',\n },\n duration_in_months: {\n type: 'integer',\n minimum: 1,\n description: 'Number of months the discount is in effect. Required when duration=\"repeating\".',\n },\n max_redemptions: {\n type: 'integer',\n minimum: 1,\n description: 'Maximum number of times this coupon can be redeemed.',\n },\n redeem_by: {\n type: 'integer',\n minimum: 1,\n description: 'Unix timestamp (seconds) of the last time the coupon can be redeemed.',\n },\n name: {\n type: 'string',\n description: 'Display name shown to customers on invoices and receipts.',\n },\n metadata: {\n type: 'object',\n description: 'Arbitrary key-value metadata attached to the coupon.',\n },\n applies_to: {\n type: 'object',\n properties: {\n products: {\n type: 'array',\n items: { type: 'string' },\n description: 'Product IDs this coupon applies to.',\n },\n },\n description: 'Restrict the coupon to specific products.',\n },\n },\n required: ['duration'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.coupons.create(\n buildStripeParams<Stripe.CouponCreateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\n\nconst inputSchema = z.object({\n coupon_id: z\n .string()\n .min(1)\n .describe('The ID of the coupon to retrieve (e.g. \"25OFF\" or \"coupon_1Nabc...\").'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_coupons_get',\n description: `Retrieve a single coupon by its ID.\n\nUse this when:\n- you need to inspect a coupon's discount rules, validity, and redemption counts\n- you want to verify a coupon exists before applying it to a customer\n\nReturns: the full Stripe Coupon object (id, percent_off/amount_off, duration, times_redeemed, etc.).\nStripe docs: https://stripe.com/docs/api/coupons/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n coupon_id: {\n type: 'string',\n description: 'The ID of the coupon to retrieve (e.g. \"25OFF\" or \"coupon_1Nabc...\").',\n },\n },\n required: ['coupon_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.coupons.retrieve(parsed.data.coupon_id);\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\n\nconst inputSchema = z.object({\n coupon_id: z\n .string()\n .min(1)\n .describe('The ID of the coupon to delete (e.g. \"25OFF\" or \"coupon_1Nabc...\").'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_coupons_delete',\n description: `Permanently delete a coupon. Existing customers on the coupon keep their discount.\n\nUse this when:\n- a promotion has ended and you want to prevent new redemptions\n- you are cleaning up test coupons in a non-live environment\n\nReturns: a Stripe deletion confirmation object (\\`{ id, object: \"coupon\", deleted: true }\\`).\nStripe docs: https://stripe.com/docs/api/coupons/delete`,\n inputSchema: {\n type: 'object',\n properties: {\n coupon_id: {\n type: 'string',\n description: 'The ID of the coupon to delete (e.g. \"25OFF\" or \"coupon_1Nabc...\").',\n },\n },\n required: ['coupon_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.coupons.del(parsed.data.coupon_id);\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\nimport { paginateAll, listEnvelope } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Suggested page size hint (Stripe caps at 100). Acts as a max-items cap when max_items is omitted.'),\n starting_after: z\n .string()\n .optional()\n .describe('Cursor: an existing coupon ID to start pagination after.'),\n max_items: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Hard cap on the total number of coupons returned (defaults to 100,000 if omitted).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_coupons_list',\n description: `List all coupons in the account, auto-paginating through every page.\n\nUse this when:\n- you need an inventory of available discounts\n- you are auditing which coupons are still redeemable\n- you want to bulk-export coupons for reporting\n\nReturns: \\`{ total_count, has_more, data: Coupon[] }\\` with all coupons up to max_items.\nStripe docs: https://stripe.com/docs/api/coupons/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: {\n type: 'integer',\n minimum: 1,\n maximum: 100,\n description: 'Suggested page size hint (Stripe caps at 100). Acts as a max-items cap when max_items is omitted.',\n },\n starting_after: {\n type: 'string',\n description: 'Cursor: an existing coupon ID to start pagination after.',\n },\n max_items: {\n type: 'integer',\n minimum: 1,\n description: 'Hard cap on the total number of coupons returned (defaults to 100,000 if omitted).',\n },\n },\n required: [],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { limit, starting_after, max_items } = parsed.data;\n const maxItems = max_items ?? limit;\n let firstCall = true;\n const items = await paginateAll<Stripe.Coupon>(\n (p) => {\n const sa = firstCall ? starting_after : p.starting_after;\n firstCall = false;\n return stripe.coupons.list(\n buildStripeParams<Stripe.CouponListParams>({\n limit: p.limit,\n ...(sa ? { starting_after: sa } : {}),\n }),\n );\n },\n maxItems ? { maxItems } : undefined,\n );\n return JSON.stringify(listEnvelope(items), null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createCoupon } from './create-coupon.js';\nimport { toolDefinition as getCoupon } from './get-coupon.js';\nimport { toolDefinition as deleteCoupon } from './delete-coupon.js';\nimport { toolDefinition as listCoupons } from './list-coupons.js';\n\nexport const tools: ToolDefinition[] = [createCoupon, getCoupon, deleteCoupon, listCoupons];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n coupon: z\n .string()\n .min(1)\n .describe('The ID of the Coupon (e.g. \"25OFF\") this promotion code will redeem.'),\n code: z\n .string()\n .optional()\n .describe('Customer-facing code (a-z, A-Z, 0-9, dashes). If omitted, Stripe generates one.'),\n customer: z\n .string()\n .optional()\n .describe('Customer ID restricted to redeem this code. If omitted, any customer can redeem.'),\n max_redemptions: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Maximum total redemptions allowed for this code.'),\n expires_at: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Unix timestamp (seconds) at which this promotion code expires.'),\n active: z\n .boolean()\n .optional()\n .describe('Whether the promotion code is currently active. Defaults to true.'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Arbitrary key-value metadata attached to the promotion code.'),\n restrictions: z\n .object({\n minimum_amount: z\n .number()\n .int()\n .nonnegative()\n .optional()\n .describe('Minimum order amount (cents) required to redeem.'),\n minimum_amount_currency: z\n .string()\n .optional()\n .describe('Three-letter ISO currency code for minimum_amount.'),\n first_time_transaction: z\n .boolean()\n .optional()\n .describe('If true, only redeemable by customers with no prior successful payments.'),\n })\n .optional()\n .describe('Restrictions applied to redemption of this code.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_promotion_codes_create',\n description: `Create a customer-redeemable promotion code backed by an existing coupon.\n\nUse this when:\n- you have a coupon and want a shareable, customer-facing code (e.g. \"WELCOME20\")\n- you want to restrict redemption to a single customer or a minimum order amount\n- you are launching a marketing campaign with limited-use codes\n\nReturns: the full Stripe PromotionCode object (id, code, coupon, active, restrictions, times_redeemed).\nStripe docs: https://stripe.com/docs/api/promotion_codes/create`,\n inputSchema: {\n type: 'object',\n properties: {\n coupon: {\n type: 'string',\n description: 'The ID of the Coupon (e.g. \"25OFF\") this promotion code will redeem.',\n },\n code: {\n type: 'string',\n description: 'Customer-facing code (a-z, A-Z, 0-9, dashes). If omitted, Stripe generates one.',\n },\n customer: {\n type: 'string',\n description: 'Customer ID restricted to redeem this code. If omitted, any customer can redeem.',\n },\n max_redemptions: {\n type: 'integer',\n minimum: 1,\n description: 'Maximum total redemptions allowed for this code.',\n },\n expires_at: {\n type: 'integer',\n minimum: 1,\n description: 'Unix timestamp (seconds) at which this promotion code expires.',\n },\n active: {\n type: 'boolean',\n description: 'Whether the promotion code is currently active. Defaults to true.',\n },\n metadata: {\n type: 'object',\n description: 'Arbitrary key-value metadata attached to the promotion code.',\n },\n restrictions: {\n type: 'object',\n properties: {\n minimum_amount: {\n type: 'integer',\n minimum: 0,\n description: 'Minimum order amount (cents) required to redeem.',\n },\n minimum_amount_currency: {\n type: 'string',\n description: 'Three-letter ISO currency code for minimum_amount.',\n },\n first_time_transaction: {\n type: 'boolean',\n description: 'If true, only redeemable by customers with no prior successful payments.',\n },\n },\n description: 'Restrictions applied to redemption of this code.',\n },\n },\n required: ['coupon'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n // The Stripe SDK wraps the coupon ID inside `promotion: { coupon, type: 'coupon' }`.\n // We expose it flatly as `coupon` to callers and translate here.\n const { coupon, ...rest } = parsed.data;\n const params = buildStripeParams<Stripe.PromotionCodeCreateParams>({\n ...rest,\n promotion: { coupon, type: 'coupon' as const },\n });\n const result = await stripe.promotionCodes.create(params);\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n promotion_code_id: z\n .string()\n .min(1)\n .describe('The ID of the promotion code to retrieve (e.g. \"promo_1Nabc...\").'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand (e.g. [\"coupon\", \"customer\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_promotion_codes_get',\n description: `Retrieve a single promotion code by its ID.\n\nUse this when:\n- you need to check the active state, redemption count, or restrictions of a code\n- you want to verify a customer-facing code before launching a campaign\n\nReturns: the full Stripe PromotionCode object (id, code, coupon, active, times_redeemed, restrictions).\nStripe docs: https://stripe.com/docs/api/promotion_codes/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n promotion_code_id: {\n type: 'string',\n description: 'The ID of the promotion code to retrieve (e.g. \"promo_1Nabc...\").',\n },\n expand: {\n type: 'array',\n items: { type: 'string' },\n description: 'Fields to expand (e.g. [\"coupon\", \"customer\"]).',\n },\n },\n required: ['promotion_code_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.promotionCodes.retrieve(\n parsed.data.promotion_code_id,\n buildStripeParams<Stripe.PromotionCodeRetrieveParams>({\n expand: parsed.data.expand,\n }),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\nimport { paginateAll, listEnvelope } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Suggested page size hint (Stripe caps at 100). Acts as a max-items cap when max_items is omitted.'),\n coupon: z\n .string()\n .optional()\n .describe('Only return promotion codes for this coupon ID.'),\n active: z\n .boolean()\n .optional()\n .describe('Filter by active state. true returns active codes, false returns inactive.'),\n starting_after: z\n .string()\n .optional()\n .describe('Cursor: an existing promotion code ID to start pagination after.'),\n max_items: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Hard cap on the total number of promotion codes returned (defaults to 100,000 if omitted).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_promotion_codes_list',\n description: `List promotion codes, auto-paginating through every page.\n\nUse this when:\n- you need to audit all redeemable codes for a campaign\n- you want to filter codes by coupon or active state\n- you are reporting on redemption counts across codes\n\nReturns: \\`{ total_count, has_more, data: PromotionCode[] }\\` with all matching codes up to max_items.\nStripe docs: https://stripe.com/docs/api/promotion_codes/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: {\n type: 'integer',\n minimum: 1,\n maximum: 100,\n description: 'Suggested page size hint (Stripe caps at 100). Acts as a max-items cap when max_items is omitted.',\n },\n coupon: {\n type: 'string',\n description: 'Only return promotion codes for this coupon ID.',\n },\n active: {\n type: 'boolean',\n description: 'Filter by active state. true returns active codes, false returns inactive.',\n },\n starting_after: {\n type: 'string',\n description: 'Cursor: an existing promotion code ID to start pagination after.',\n },\n max_items: {\n type: 'integer',\n minimum: 1,\n description: 'Hard cap on the total number of promotion codes returned (defaults to 100,000 if omitted).',\n },\n },\n required: [],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { limit, starting_after, max_items, ...filters } = parsed.data;\n const maxItems = max_items ?? limit;\n let firstCall = true;\n const items = await paginateAll<Stripe.PromotionCode>(\n (p) => {\n const sa = firstCall ? starting_after : p.starting_after;\n firstCall = false;\n return stripe.promotionCodes.list(\n buildStripeParams<Stripe.PromotionCodeListParams>({\n ...filters,\n limit: p.limit,\n ...(sa ? { starting_after: sa } : {}),\n }),\n );\n },\n maxItems ? { maxItems } : undefined,\n );\n return JSON.stringify(listEnvelope(items), null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createPromotionCode } from './create-promotion-code.js';\nimport { toolDefinition as getPromotionCode } from './get-promotion-code.js';\nimport { toolDefinition as listPromotionCodes } from './list-promotion-codes.js';\n\nexport const tools: ToolDefinition[] = [createPromotionCode, getPromotionCode, listPromotionCodes];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n line_items: z\n .array(\n z.object({\n price: z.string().min(1).describe('The ID of the Price object to sell.'),\n quantity: z.number().int().min(1).describe('Quantity of this line item to purchase.'),\n }),\n )\n .min(1)\n .describe('Line items to sell through this payment link (up to 20).'),\n application_fee_amount: z\n .number()\n .int()\n .nonnegative()\n .optional()\n .describe('Connect only: fee in cents to transfer to the platform account.'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Arbitrary key-value metadata copied to checkout sessions created by this link.'),\n allow_promotion_codes: z\n .boolean()\n .optional()\n .describe('If true, customers can redeem promotion codes at checkout.'),\n automatic_tax: z\n .object({\n enabled: z.boolean().describe('Set true to enable Stripe Tax automatic calculation.'),\n })\n .optional()\n .describe('Enable automatic tax calculation based on customer location.'),\n tax_id_collection: z\n .object({\n enabled: z.boolean().describe('Set true to collect tax IDs at checkout.'),\n })\n .optional()\n .describe('Collect customer tax IDs during checkout.'),\n billing_address_collection: z\n .enum(['auto', 'required'])\n .optional()\n .describe('Whether to collect the customer billing address. Defaults to \"auto\".'),\n customer_creation: z\n .enum(['always', 'if_required'])\n .optional()\n .describe('When checkout sessions create a Customer object (payment mode only).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payment_links_create',\n description: `Create a hosted Payment Link that customers can visit to purchase one or more products.\n\nUse this when:\n- you need a shareable URL for a product (e.g. for email, social, QR codes)\n- you want to sell without building a custom checkout\n- you are setting up a no-code storefront\n\nReturns: the full Stripe PaymentLink object (id, url, line_items, active).\nStripe docs: https://stripe.com/docs/api/payment_links/create`,\n inputSchema: {\n type: 'object',\n properties: {\n line_items: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n price: { type: 'string', description: 'The ID of the Price object to sell.' },\n quantity: { type: 'integer', minimum: 1, description: 'Quantity of this line item to purchase.' },\n },\n required: ['price', 'quantity'],\n },\n description: 'Line items to sell through this payment link (up to 20).',\n },\n application_fee_amount: {\n type: 'integer',\n minimum: 0,\n description: 'Connect only: fee in cents to transfer to the platform account.',\n },\n metadata: {\n type: 'object',\n description: 'Arbitrary key-value metadata copied to checkout sessions created by this link.',\n },\n allow_promotion_codes: {\n type: 'boolean',\n description: 'If true, customers can redeem promotion codes at checkout.',\n },\n automatic_tax: {\n type: 'object',\n properties: {\n enabled: { type: 'boolean', description: 'Set true to enable Stripe Tax automatic calculation.' },\n },\n description: 'Enable automatic tax calculation based on customer location.',\n },\n tax_id_collection: {\n type: 'object',\n properties: {\n enabled: { type: 'boolean', description: 'Set true to collect tax IDs at checkout.' },\n },\n description: 'Collect customer tax IDs during checkout.',\n },\n billing_address_collection: {\n type: 'string',\n enum: ['auto', 'required'],\n description: 'Whether to collect the customer billing address. Defaults to \"auto\".',\n },\n customer_creation: {\n type: 'string',\n enum: ['always', 'if_required'],\n description: 'When checkout sessions create a Customer object (payment mode only).',\n },\n },\n required: ['line_items'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.paymentLinks.create(\n buildStripeParams<Stripe.PaymentLinkCreateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n payment_link_id: z\n .string()\n .min(1)\n .describe('The ID of the payment link to retrieve (e.g. \"plink_1Nabc...\").'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand (e.g. [\"line_items\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payment_links_get',\n description: `Retrieve a single payment link by its ID.\n\nUse this when:\n- you need the live URL of an existing payment link\n- you want to inspect line items, tax settings, and active state\n- you are verifying a link before sharing it with customers\n\nReturns: the full Stripe PaymentLink object (id, url, line_items, active, metadata).\nStripe docs: https://stripe.com/docs/api/payment_links/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n payment_link_id: {\n type: 'string',\n description: 'The ID of the payment link to retrieve (e.g. \"plink_1Nabc...\").',\n },\n expand: {\n type: 'array',\n items: { type: 'string' },\n description: 'Fields to expand (e.g. [\"line_items\"]).',\n },\n },\n required: ['payment_link_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.paymentLinks.retrieve(\n parsed.data.payment_link_id,\n buildStripeParams<Stripe.PaymentLinkRetrieveParams>({\n expand: parsed.data.expand,\n }),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n payment_link_id: z\n .string()\n .min(1)\n .describe('The ID of the payment link to update (e.g. \"plink_1Nabc...\").'),\n active: z\n .boolean()\n .optional()\n .describe('Set false to deactivate the link (visitors see an inactive page). Set true to reactivate.'),\n line_items: z\n .array(\n z.object({\n price: z.string().min(1).describe('The ID of the Price object to sell.'),\n quantity: z.number().int().min(1).describe('Quantity of this line item.'),\n }),\n )\n .optional()\n .describe('Replacement line items (up to 20). Replaces the existing set entirely.'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Updated key-value metadata.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payment_links_update',\n description: `Update an existing payment link's active state, line items, or metadata.\n\nUse this when:\n- you need to pause a link without deleting it (set active=false)\n- you want to swap prices or quantities on an existing link\n- you are updating metadata for tracking purposes\n\nReturns: the updated Stripe PaymentLink object.\nStripe docs: https://stripe.com/docs/api/payment_links/update`,\n inputSchema: {\n type: 'object',\n properties: {\n payment_link_id: {\n type: 'string',\n description: 'The ID of the payment link to update (e.g. \"plink_1Nabc...\").',\n },\n active: {\n type: 'boolean',\n description: 'Set false to deactivate the link (visitors see an inactive page). Set true to reactivate.',\n },\n line_items: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n price: { type: 'string', description: 'The ID of the Price object to sell.' },\n quantity: { type: 'integer', minimum: 1, description: 'Quantity of this line item.' },\n },\n required: ['price', 'quantity'],\n },\n description: 'Replacement line items (up to 20). Replaces the existing set entirely.',\n },\n metadata: {\n type: 'object',\n description: 'Updated key-value metadata.',\n },\n },\n required: ['payment_link_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { payment_link_id, ...updates } = parsed.data;\n const result = await stripe.paymentLinks.update(\n payment_link_id,\n buildStripeParams<Stripe.PaymentLinkUpdateParams>(updates),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\nimport { paginateAll, listEnvelope } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Suggested page size hint (Stripe caps at 100). Acts as a max-items cap when max_items is omitted.'),\n starting_after: z\n .string()\n .optional()\n .describe('Cursor: an existing payment link ID to start pagination after.'),\n max_items: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Hard cap on the total number of payment links returned (defaults to 100,000 if omitted).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payment_links_list',\n description: `List all payment links in the account, auto-paginating through every page.\n\nUse this when:\n- you need an inventory of all hosted checkout links\n- you are auditing which links are active vs. deactivated\n- you want to bulk-export links for reporting\n\nReturns: \\`{ total_count, has_more, data: PaymentLink[] }\\` with all links up to max_items.\nStripe docs: https://stripe.com/docs/api/payment_links/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: {\n type: 'integer',\n minimum: 1,\n maximum: 100,\n description: 'Suggested page size hint (Stripe caps at 100). Acts as a max-items cap when max_items is omitted.',\n },\n starting_after: {\n type: 'string',\n description: 'Cursor: an existing payment link ID to start pagination after.',\n },\n max_items: {\n type: 'integer',\n minimum: 1,\n description: 'Hard cap on the total number of payment links returned (defaults to 100,000 if omitted).',\n },\n },\n required: [],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { limit, starting_after, max_items } = parsed.data;\n const maxItems = max_items ?? limit;\n let firstCall = true;\n const items = await paginateAll<Stripe.PaymentLink>(\n (p) => {\n const sa = firstCall ? starting_after : p.starting_after;\n firstCall = false;\n return stripe.paymentLinks.list(\n buildStripeParams<Stripe.PaymentLinkListParams>({\n limit: p.limit,\n ...(sa ? { starting_after: sa } : {}),\n }),\n );\n },\n maxItems ? { maxItems } : undefined,\n );\n return JSON.stringify(listEnvelope(items), null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createPaymentLink } from './create-payment-link.js';\nimport { toolDefinition as getPaymentLink } from './get-payment-link.js';\nimport { toolDefinition as updatePaymentLink } from './update-payment-link.js';\nimport { toolDefinition as listPaymentLinks } from './list-payment-links.js';\n\nexport const tools: ToolDefinition[] = [\n createPaymentLink,\n getPaymentLink,\n updatePaymentLink,\n listPaymentLinks,\n];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n success_url: z\n .string()\n .min(1)\n .describe('URL customers are redirected to after successful payment. Use {CHECKOUT_SESSION_ID} as a placeholder.'),\n cancel_url: z\n .string()\n .min(1)\n .describe('URL customers are redirected to if they cancel checkout.'),\n mode: z\n .enum(['payment', 'setup', 'subscription'])\n .optional()\n .describe('Checkout mode. \"payment\" for one-time, \"subscription\" for recurring, \"setup\" for saving a method off-session.'),\n line_items: z\n .array(\n z.object({\n price: z.string().min(1).describe('The ID of the Price object to charge.'),\n quantity: z.number().int().min(1).describe('Quantity of this line item.'),\n }),\n )\n .optional()\n .describe('Line items to purchase. Required in payment and subscription modes.'),\n payment_method_types: z\n .array(z.string())\n .optional()\n .describe('Payment method types to accept (e.g. [\"card\", \"cashapp\"]). Omit to use dashboard defaults.'),\n customer: z\n .string()\n .optional()\n .describe('Existing customer ID to associate with this checkout session.'),\n customer_email: z\n .string()\n .optional()\n .describe('Email to prefill for new customers (ignored if customer is set).'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Arbitrary key-value metadata attached to the session.'),\n allow_promotion_codes: z\n .boolean()\n .optional()\n .describe('If true, customers can redeem promotion codes at checkout.'),\n billing_address_collection: z\n .enum(['auto', 'required'])\n .optional()\n .describe('Whether to collect the customer billing address. Defaults to \"auto\".'),\n tax_id_collection: z\n .object({\n enabled: z.boolean().describe('Set true to collect tax IDs at checkout.'),\n })\n .optional()\n .describe('Collect customer tax IDs during checkout.'),\n automatic_tax: z\n .object({\n enabled: z.boolean().describe('Set true to enable Stripe Tax automatic calculation.'),\n })\n .optional()\n .describe('Enable automatic tax calculation based on customer location.'),\n subscription_data: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Subscription-mode settings (e.g. { trial_period_days: 14, metadata: {...} }). See Stripe docs.'),\n payment_intent_data: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Payment-mode PaymentIntent settings (e.g. { description, statement_descriptor, capture_method }). See Stripe docs.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_checkout_create_session',\n description: `Create a Checkout Session for a one-time payment, subscription, or payment-method setup.\n\nUse this when:\n- you need a hosted Stripe Checkout URL to send to a customer\n- you are building a \"pay now\" flow without a custom UI\n- you want to start a subscription through hosted checkout\n\nReturns: the full Stripe Checkout Session object (id, url, payment_intent, mode, status).\nStripe docs: https://stripe.com/docs/api/checkout/sessions/create`,\n inputSchema: {\n type: 'object',\n properties: {\n success_url: {\n type: 'string',\n description: 'URL customers are redirected to after successful payment. Use {CHECKOUT_SESSION_ID} as a placeholder.',\n },\n cancel_url: {\n type: 'string',\n description: 'URL customers are redirected to if they cancel checkout.',\n },\n mode: {\n type: 'string',\n enum: ['payment', 'setup', 'subscription'],\n description: 'Checkout mode. \"payment\" for one-time, \"subscription\" for recurring, \"setup\" for saving a method off-session.',\n },\n line_items: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n price: { type: 'string', description: 'The ID of the Price object to charge.' },\n quantity: { type: 'integer', minimum: 1, description: 'Quantity of this line item.' },\n },\n required: ['price', 'quantity'],\n },\n description: 'Line items to purchase. Required in payment and subscription modes.',\n },\n payment_method_types: {\n type: 'array',\n items: { type: 'string' },\n description: 'Payment method types to accept (e.g. [\"card\", \"cashapp\"]). Omit to use dashboard defaults.',\n },\n customer: {\n type: 'string',\n description: 'Existing customer ID to associate with this checkout session.',\n },\n customer_email: {\n type: 'string',\n description: 'Email to prefill for new customers (ignored if customer is set).',\n },\n metadata: {\n type: 'object',\n description: 'Arbitrary key-value metadata attached to the session.',\n },\n allow_promotion_codes: {\n type: 'boolean',\n description: 'If true, customers can redeem promotion codes at checkout.',\n },\n billing_address_collection: {\n type: 'string',\n enum: ['auto', 'required'],\n description: 'Whether to collect the customer billing address. Defaults to \"auto\".',\n },\n tax_id_collection: {\n type: 'object',\n properties: {\n enabled: { type: 'boolean', description: 'Set true to collect tax IDs at checkout.' },\n },\n description: 'Collect customer tax IDs during checkout.',\n },\n automatic_tax: {\n type: 'object',\n properties: {\n enabled: { type: 'boolean', description: 'Set true to enable Stripe Tax automatic calculation.' },\n },\n description: 'Enable automatic tax calculation based on customer location.',\n },\n subscription_data: {\n type: 'object',\n description: 'Subscription-mode settings (e.g. { trial_period_days: 14, metadata: {...} }). See Stripe docs.',\n },\n payment_intent_data: {\n type: 'object',\n description: 'Payment-mode PaymentIntent settings (e.g. { description, statement_descriptor, capture_method }). See Stripe docs.',\n },\n },\n required: ['success_url', 'cancel_url'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.checkout.sessions.create(\n buildStripeParams<Stripe.Checkout.SessionCreateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n session_id: z\n .string()\n .min(1)\n .describe('The ID of the Checkout Session to retrieve (e.g. \"cs_test_...\").'),\n expand: z\n .array(z.string())\n .optional()\n .describe('Fields to expand (e.g. [\"line_items\", \"customer\", \"payment_intent\"]).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_checkout_get_session',\n description: `Retrieve a single Checkout Session by its ID.\n\nUse this when:\n- you need to confirm a session completed and inspect the payment status\n- you want to retrieve customer details or line items after redirect\n- you are verifying webhook events against the originating session\n\nReturns: the full Stripe Checkout Session object (id, status, payment_status, customer_details, amount_total).\nStripe docs: https://stripe.com/docs/api/checkout/sessions/retrieve`,\n inputSchema: {\n type: 'object',\n properties: {\n session_id: {\n type: 'string',\n description: 'The ID of the Checkout Session to retrieve (e.g. \"cs_test_...\").',\n },\n expand: {\n type: 'array',\n items: { type: 'string' },\n description: 'Fields to expand (e.g. [\"line_items\", \"customer\", \"payment_intent\"]).',\n },\n },\n required: ['session_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.checkout.sessions.retrieve(\n parsed.data.session_id,\n buildStripeParams<Stripe.Checkout.SessionRetrieveParams>({\n expand: parsed.data.expand,\n }),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n session_id: z\n .string()\n .min(1)\n .describe('The ID of an open Checkout Session to expire (e.g. \"cs_test_...\").'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_checkout_expire_session',\n description: `Expire an open Checkout Session so it can no longer be completed by customers.\n\nUse this when:\n- a customer abandoned checkout and you want to free the inventory or pricing hold\n- you need to invalidate a stale session programmatically\n- you are cleaning up sessions as part of an order-cancellation flow\n\nReturns: the expired Stripe Checkout Session object with status=\"expired\".\nStripe docs: https://stripe.com/docs/api/checkout/sessions/expire`,\n inputSchema: {\n type: 'object',\n properties: {\n session_id: {\n type: 'string',\n description: 'The ID of an open Checkout Session to expire (e.g. \"cs_test_...\").',\n },\n },\n required: ['session_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.checkout.sessions.expire(\n parsed.data.session_id,\n buildStripeParams<Stripe.Checkout.SessionExpireParams>({}),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\nimport { paginateAll, listEnvelope } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Suggested page size hint (Stripe caps at 100). Acts as a max-items cap when max_items is omitted.'),\n status: z\n .enum(['open', 'complete', 'expired'])\n .optional()\n .describe('Filter by Checkout Session status.'),\n payment_link: z\n .string()\n .optional()\n .describe('Only return sessions created by this Payment Link ID.'),\n customer: z\n .string()\n .optional()\n .describe('Only return sessions for this Customer ID.'),\n starting_after: z\n .string()\n .optional()\n .describe('Cursor: an existing session ID to start pagination after.'),\n max_items: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Hard cap on the total number of sessions returned (defaults to 100,000 if omitted).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_checkout_list_sessions',\n description: `List Checkout Sessions, auto-paginating through every page.\n\nUse this when:\n- you need to find sessions by customer, status, or originating payment link\n- you are reconciling abandoned vs. completed checkouts\n- you want to export checkout activity for reporting\n\nReturns: \\`{ total_count, has_more, data: Session[] }\\` with all matching sessions up to max_items.\nStripe docs: https://stripe.com/docs/api/checkout/sessions/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: {\n type: 'integer',\n minimum: 1,\n maximum: 100,\n description: 'Suggested page size hint (Stripe caps at 100). Acts as a max-items cap when max_items is omitted.',\n },\n status: {\n type: 'string',\n enum: ['open', 'complete', 'expired'],\n description: 'Filter by Checkout Session status.',\n },\n payment_link: {\n type: 'string',\n description: 'Only return sessions created by this Payment Link ID.',\n },\n customer: {\n type: 'string',\n description: 'Only return sessions for this Customer ID.',\n },\n starting_after: {\n type: 'string',\n description: 'Cursor: an existing session ID to start pagination after.',\n },\n max_items: {\n type: 'integer',\n minimum: 1,\n description: 'Hard cap on the total number of sessions returned (defaults to 100,000 if omitted).',\n },\n },\n required: [],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { limit, starting_after, max_items, ...filters } = parsed.data;\n const maxItems = max_items ?? limit;\n let firstCall = true;\n const items = await paginateAll<Stripe.Checkout.Session>(\n (p) => {\n const sa = firstCall ? starting_after : p.starting_after;\n firstCall = false;\n return stripe.checkout.sessions.list(\n buildStripeParams<Stripe.Checkout.SessionListParams>({\n ...filters,\n limit: p.limit,\n ...(sa ? { starting_after: sa } : {}),\n }),\n );\n },\n maxItems ? { maxItems } : undefined,\n );\n return JSON.stringify(listEnvelope(items), null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createCheckoutSession } from './create-checkout-session.js';\nimport { toolDefinition as getCheckoutSession } from './get-checkout-session.js';\nimport { toolDefinition as expireCheckoutSession } from './expire-checkout-session.js';\nimport { toolDefinition as listCheckoutSessions } from './list-checkout-sessions.js';\n\nexport const tools: ToolDefinition[] = [\n createCheckoutSession,\n getCheckoutSession,\n expireCheckoutSession,\n listCheckoutSessions,\n];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n customer: z\n .string()\n .min(1)\n .describe('The ID of an existing customer who will access the billing portal.'),\n return_url: z\n .string()\n .optional()\n .describe('URL the customer is redirected to after leaving the portal.'),\n configuration: z\n .string()\n .optional()\n .describe('ID of a portal configuration to use. If omitted, the default configuration is used.'),\n flow_data: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Deep-link flow config (e.g. { type: \"subscription_cancel\", subscription_cancel: { subscription: \"sub_...\" } }). See Stripe portal deep-links docs.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_billing_portal_create_session',\n description: `Create a short-lived Stripe Customer Portal session URL for a customer to self-manage subscriptions and billing details.\n\nUse this when:\n- a customer wants to update their payment method or subscription plan\n- you need to deep-link the customer into a specific portal flow (e.g. cancel a subscription)\n- you are building an account/billing page in your app\n\nReturns: the Stripe Billing Portal Session object (id, url, customer, return_url).\nStripe docs: https://stripe.com/docs/api/customer_portal/sessions/create`,\n inputSchema: {\n type: 'object',\n properties: {\n customer: {\n type: 'string',\n description: 'The ID of an existing customer who will access the billing portal.',\n },\n return_url: {\n type: 'string',\n description: 'URL the customer is redirected to after leaving the portal.',\n },\n configuration: {\n type: 'string',\n description: 'ID of a portal configuration to use. If omitted, the default configuration is used.',\n },\n flow_data: {\n type: 'object',\n description: 'Deep-link flow config (e.g. { type: \"subscription_cancel\", subscription_cancel: { subscription: \"sub_...\" } }). See Stripe portal deep-links docs.',\n },\n },\n required: ['customer'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.billingPortal.sessions.create(\n buildStripeParams<Stripe.BillingPortal.SessionCreateParams>(parsed.data),\n );\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createPortalSession } from './create-portal-session.js';\n\nexport const tools: ToolDefinition[] = [createPortalSession];\n","import { z } from 'zod';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\n\nconst inputSchema = z.object({});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_balance_get',\n description: `Retrieve the current Stripe account balance across all currencies.\n\nUse this when:\n- you need to show available vs. pending funds in a dashboard\n- you are reconciling your Stripe balance against your bank payouts\n- you want a quick health check that the Stripe API key is configured\n\nReturns: the Stripe Balance object (available, pending, instant_available, livemode).\nStripe docs: https://stripe.com/docs/api/balance/balance_retrieve`,\n inputSchema: {\n type: 'object',\n properties: {},\n required: [],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const result = await stripe.balance.retrieve();\n return JSON.stringify(result, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\nimport { paginateAll, listEnvelope } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe('Suggested page size hint (Stripe caps at 100). Acts as a max-items cap when max_items is omitted.'),\n payout: z\n .string()\n .optional()\n .describe('Only return transactions paid out on this Payout ID (automatic payouts only).'),\n type: z\n .enum([\n 'charge',\n 'refund',\n 'payout',\n 'transfer',\n 'payment',\n 'payment_failure_refund',\n 'payment_refund',\n 'payment_reversal',\n 'adjustment',\n 'application_fee',\n 'application_fee_refund',\n 'stripe_fee',\n 'stripe_fx_fee',\n 'topup',\n 'topup_reversal',\n 'payout_cancel',\n 'payout_failure',\n 'transfer_cancel',\n 'transfer_refund',\n 'reserve_transaction',\n ])\n .optional()\n .describe('Filter transactions by type. See https://stripe.com/docs/reports/balance-transaction-types for the full list.'),\n starting_after: z\n .string()\n .optional()\n .describe('Cursor: an existing balance transaction ID to start pagination after.'),\n max_items: z\n .number()\n .int()\n .positive()\n .optional()\n .describe('Hard cap on the total number of transactions returned (defaults to 100,000 if omitted).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_balance_list_transactions',\n description: `List transactions that have contributed to the Stripe account balance, auto-paginating through every page.\n\nUse this when:\n- you need a full ledger of charges, refunds, payouts, and fees\n- you are reconciling Stripe activity against your accounting system\n- you want to filter balance activity by type or by payout\n\nReturns: \\`{ total_count, has_more, data: BalanceTransaction[] }\\` with all matching transactions up to max_items.\nStripe docs: https://stripe.com/docs/api/balance_transactions/list`,\n inputSchema: {\n type: 'object',\n properties: {\n limit: {\n type: 'integer',\n minimum: 1,\n maximum: 100,\n description: 'Suggested page size hint (Stripe caps at 100). Acts as a max-items cap when max_items is omitted.',\n },\n payout: {\n type: 'string',\n description: 'Only return transactions paid out on this Payout ID (automatic payouts only).',\n },\n type: {\n type: 'string',\n enum: [\n 'charge',\n 'refund',\n 'payout',\n 'transfer',\n 'payment',\n 'payment_failure_refund',\n 'payment_refund',\n 'payment_reversal',\n 'adjustment',\n 'application_fee',\n 'application_fee_refund',\n 'stripe_fee',\n 'stripe_fx_fee',\n 'topup',\n 'topup_reversal',\n 'payout_cancel',\n 'payout_failure',\n 'transfer_cancel',\n 'transfer_refund',\n 'reserve_transaction',\n ],\n description: 'Filter transactions by type. See https://stripe.com/docs/reports/balance-transaction-types for the full list.',\n },\n starting_after: {\n type: 'string',\n description: 'Cursor: an existing balance transaction ID to start pagination after.',\n },\n max_items: {\n type: 'integer',\n minimum: 1,\n description: 'Hard cap on the total number of transactions returned (defaults to 100,000 if omitted).',\n },\n },\n required: [],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) {\n return `Validation error: ${parsed.error.message}`;\n }\n const stripe = getStripeClient();\n try {\n const { limit, starting_after, max_items, ...filters } = parsed.data;\n const maxItems = max_items ?? limit;\n let firstCall = true;\n const items = await paginateAll<Stripe.BalanceTransaction>(\n (p) => {\n const sa = firstCall ? starting_after : p.starting_after;\n firstCall = false;\n return stripe.balanceTransactions.list(\n buildStripeParams<Stripe.BalanceTransactionListParams>({\n ...filters,\n limit: p.limit,\n ...(sa ? { starting_after: sa } : {}),\n }),\n );\n },\n maxItems ? { maxItems } : undefined,\n );\n return JSON.stringify(listEnvelope(items), null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as getBalance } from './get-balance.js';\nimport { toolDefinition as listBalanceTransactions } from './list-balance-transactions.js';\n\nexport const tools: ToolDefinition[] = [getBalance, listBalanceTransactions];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n amount: z\n .number()\n .int()\n .positive()\n .describe('Positive integer in cents (or local equivalent) representing how much to payout.'),\n currency: z\n .string()\n .min(3)\n .max(3)\n .describe('Three-letter ISO currency code, in lowercase (e.g. \"usd\", \"eur\").'),\n destination: z\n .string()\n .optional()\n .describe('ID of a bank account or card to send the payout to. If omitted, Stripe uses the default external account for the currency.'),\n method: z\n .enum(['standard', 'instant'])\n .optional()\n .describe('Payout method: \"standard\" (1-2 business days) or \"instant\" (minutes, supported in certain countries).'),\n statement_descriptor: z\n .string()\n .max(22)\n .optional()\n .describe('String that displays on the recipient bank/card statement (up to 22 characters).'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Set of key-value pairs attached to the payout for your internal use.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payouts_create',\n description:\n 'Create an outgoing payout to a bank account or debit card. Use this to manually withdraw funds from your Stripe available balance. Returns the created payout object.',\n inputSchema: {\n type: 'object',\n properties: {\n amount: {\n type: 'integer',\n minimum: 1,\n description: 'Positive integer in cents (or local equivalent) representing how much to payout.',\n },\n currency: { type: 'string', description: 'Three-letter ISO currency code, lowercase (e.g. \"usd\").' },\n destination: { type: 'string', description: 'Bank account or card ID to send the payout to.' },\n method: { type: 'string', enum: ['standard', 'instant'], description: 'Payout method.' },\n statement_descriptor: { type: 'string', description: 'Statement descriptor (max 22 chars).' },\n metadata: {\n type: 'object',\n description: 'Key-value pairs for internal use.',\n additionalProperties: { type: 'string' },\n },\n },\n required: ['amount', 'currency'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const stripe = getStripeClient();\n try {\n const params = buildStripeParams<Stripe.PayoutCreateParams>({\n amount: parsed.data.amount,\n currency: parsed.data.currency,\n destination: parsed.data.destination,\n method: parsed.data.method,\n statement_descriptor: parsed.data.statement_descriptor,\n metadata: parsed.data.metadata,\n });\n const payout = await stripe.payouts.create(params);\n return JSON.stringify(payout, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\n\nconst inputSchema = z.object({\n payout_id: z\n .string()\n .min(1)\n .describe('The ID of the payout to retrieve (e.g. \"po_...\").'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payouts_get',\n description:\n 'Retrieve the details of an existing payout by ID. Returns the full payout object including status, amount, currency, arrival date, and destination.',\n inputSchema: {\n type: 'object',\n properties: {\n payout_id: { type: 'string', description: 'The payout ID (e.g. \"po_...\").' },\n },\n required: ['payout_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const stripe = getStripeClient();\n try {\n const payout = await stripe.payouts.retrieve(parsed.data.payout_id);\n return JSON.stringify(payout, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\n\nconst inputSchema = z.object({\n payout_id: z\n .string()\n .min(1)\n .describe('The ID of the payout to cancel (must be in \"pending\" status).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payouts_cancel',\n description:\n 'Cancel a previously created payout. Only payouts in \"pending\" status can be canceled; Stripe refunds the funds to your available balance. Automatic Stripe payouts cannot be canceled.',\n inputSchema: {\n type: 'object',\n properties: {\n payout_id: { type: 'string', description: 'The payout ID to cancel (e.g. \"po_...\").' },\n },\n required: ['payout_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const stripe = getStripeClient();\n try {\n const payout = await stripe.payouts.cancel(parsed.data.payout_id);\n return JSON.stringify(payout, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll, listEnvelope } from '../../utils/pagination.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n limit: z.number().int().min(1).max(100).optional().describe('Page size (1-100). Ignored if max_items is used.'),\n status: z\n .enum(['paid', 'pending', 'in_transit', 'canceled', 'failed'])\n .optional()\n .describe('Filter payouts by status.'),\n arrival_date: z\n .number()\n .int()\n .optional()\n .describe('Unix timestamp (seconds) — only return payouts expected to arrive on this date.'),\n destination: z\n .string()\n .optional()\n .describe('External account ID — only return payouts sent to this account.'),\n starting_after: z\n .string()\n .optional()\n .describe('Cursor: ID of the last payout from the previous page.'),\n max_items: z\n .number()\n .int()\n .min(1)\n .max(1000)\n .optional()\n .describe('Cap on total payouts returned (auto-paginates up to this count).'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_payouts_list',\n description:\n 'List payouts with optional filters (status, destination, arrival_date). Auto-paginates up to max_items (default 100). Returns { total_count, has_more, data }.',\n inputSchema: {\n type: 'object',\n properties: {\n limit: { type: 'integer', minimum: 1, maximum: 100, description: 'Page size.' },\n status: {\n type: 'string',\n enum: ['paid', 'pending', 'in_transit', 'canceled', 'failed'],\n description: 'Filter by status.',\n },\n arrival_date: { type: 'integer', description: 'Unix timestamp (seconds).' },\n destination: { type: 'string', description: 'External account ID.' },\n starting_after: { type: 'string', description: 'Pagination cursor.' },\n max_items: { type: 'integer', minimum: 1, maximum: 1000, description: 'Total cap.' },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const stripe = getStripeClient();\n try {\n const filters = buildStripeParams<Stripe.PayoutListParams>({\n status: parsed.data.status,\n arrival_date: parsed.data.arrival_date,\n destination: parsed.data.destination,\n });\n const all = await paginateAll<Stripe.Payout>(\n (p) => stripe.payouts.list({ ...p, ...filters }),\n { maxItems: parsed.data.max_items ?? 100 },\n );\n return JSON.stringify(listEnvelope(all, false), null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createPayout } from './create-payout.js';\nimport { toolDefinition as getPayout } from './get-payout.js';\nimport { toolDefinition as cancelPayout } from './cancel-payout.js';\nimport { toolDefinition as listPayouts } from './list-payouts.js';\n\nexport const tools: ToolDefinition[] = [createPayout, getPayout, cancelPayout, listPayouts];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n display_name: z\n .string()\n .min(1)\n .describe('Display name of the tax rate, shown to users (e.g. \"Sales Tax\", \"VAT\").'),\n percentage: z\n .number()\n .min(0)\n .max(100)\n .describe('Tax rate percentage out of 100 (e.g. 8.5 for 8.5%).'),\n inclusive: z\n .boolean()\n .describe('Whether the tax is inclusive (already in the listed price) or exclusive (added at checkout).'),\n description: z\n .string()\n .optional()\n .describe('Internal description of the tax rate. Not shown to customers.'),\n jurisdiction: z\n .string()\n .optional()\n .describe('Jurisdiction label (e.g. \"US-CA\", \"EU\"). Appears on customer invoices.'),\n active: z\n .boolean()\n .optional()\n .default(true)\n .describe('Whether the tax rate is active. Defaults to true.'),\n metadata: z\n .record(z.string(), z.string())\n .optional()\n .describe('Key-value pairs for internal use.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_tax_create_rate',\n description:\n 'Create a manual tax rate with a display name, percentage, and inclusive/exclusive flag. Use this for jurisdictions not covered by Stripe Tax automatic calculation.',\n inputSchema: {\n type: 'object',\n properties: {\n display_name: { type: 'string', description: 'Display name (e.g. \"Sales Tax\").' },\n percentage: { type: 'number', minimum: 0, maximum: 100, description: 'Percentage out of 100.' },\n inclusive: { type: 'boolean', description: 'Inclusive (true) or exclusive (false).' },\n description: { type: 'string', description: 'Internal description.' },\n jurisdiction: { type: 'string', description: 'Jurisdiction label (e.g. \"US-CA\").' },\n active: { type: 'boolean', default: true, description: 'Active flag (default true).' },\n metadata: {\n type: 'object',\n additionalProperties: { type: 'string' },\n description: 'Key-value pairs.',\n },\n },\n required: ['display_name', 'percentage', 'inclusive'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const stripe = getStripeClient();\n try {\n const params = buildStripeParams<Stripe.TaxRateCreateParams>({\n display_name: parsed.data.display_name,\n percentage: parsed.data.percentage,\n inclusive: parsed.data.inclusive,\n description: parsed.data.description,\n jurisdiction: parsed.data.jurisdiction,\n active: parsed.data.active,\n metadata: parsed.data.metadata,\n });\n const taxRate = await stripe.taxRates.create(params);\n return JSON.stringify(taxRate, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\n\nconst inputSchema = z.object({\n tax_rate_id: z\n .string()\n .min(1)\n .describe('The ID of the tax rate to retrieve (e.g. \"txr_...\").'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_tax_get_rate',\n description:\n 'Retrieve the details of an existing tax rate by ID. Returns the full tax rate object including percentage, jurisdiction, and active flag.',\n inputSchema: {\n type: 'object',\n properties: {\n tax_rate_id: { type: 'string', description: 'The tax rate ID (e.g. \"txr_...\").' },\n },\n required: ['tax_rate_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const stripe = getStripeClient();\n try {\n const taxRate = await stripe.taxRates.retrieve(parsed.data.tax_rate_id);\n return JSON.stringify(taxRate, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll, listEnvelope } from '../../utils/pagination.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n limit: z.number().int().min(1).max(100).optional().describe('Page size (1-100).'),\n active: z\n .boolean()\n .optional()\n .describe('Filter to only active (true) or archived (false) tax rates.'),\n starting_after: z\n .string()\n .optional()\n .describe('Cursor: ID of the last tax rate from the previous page.'),\n max_items: z\n .number()\n .int()\n .min(1)\n .max(1000)\n .optional()\n .describe('Cap on total tax rates returned.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_tax_list_rates',\n description:\n 'List tax rates with an optional active filter. Auto-paginates up to max_items (default 100). Returns { total_count, has_more, data }.',\n inputSchema: {\n type: 'object',\n properties: {\n limit: { type: 'integer', minimum: 1, maximum: 100, description: 'Page size.' },\n active: { type: 'boolean', description: 'Filter by active flag.' },\n starting_after: { type: 'string', description: 'Pagination cursor.' },\n max_items: { type: 'integer', minimum: 1, maximum: 1000, description: 'Total cap.' },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const stripe = getStripeClient();\n try {\n const filters = buildStripeParams<Stripe.TaxRateListParams>({\n active: parsed.data.active,\n });\n const all = await paginateAll<Stripe.TaxRate>(\n (p) => stripe.taxRates.list({ ...p, ...filters }),\n { maxItems: parsed.data.max_items ?? 100 },\n );\n return JSON.stringify(listEnvelope(all, false), null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createTaxRate } from './create-tax-rate.js';\nimport { toolDefinition as getTaxRate } from './get-tax-rate.js';\nimport { toolDefinition as listTaxRates } from './list-tax-rates.js';\n\nexport const tools: ToolDefinition[] = [createTaxRate, getTaxRate, listTaxRates];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { buildStripeParams } from '../../utils/object.js';\n\nconst inputSchema = z.object({\n display_name: z\n .string()\n .min(1)\n .describe('Human-readable name of the meter (e.g. \"API Calls\"). Not visible to customers.'),\n event_name: z\n .string()\n .min(1)\n .regex(/^[a-z0-9_]+$/, 'event_name must be snake_case (lowercase letters, digits, underscores)')\n .describe('The meter event name in snake_case (e.g. \"api_calls\"). Meter events use this to record usage.'),\n default_aggregation: z\n .object({\n formula: z\n .enum(['sum', 'count', 'last'])\n .describe('How meter events are aggregated: \"sum\" (total value), \"count\" (number of events), or \"last\" (most recent value).'),\n })\n .describe('Default aggregation settings for the meter.'),\n customer_mapping: z\n .object({\n event_payload_key: z\n .string()\n .min(1)\n .describe('Key in the meter event payload that identifies the customer (e.g. \"stripe_customer_id\").'),\n type: z\n .literal('by_id')\n .describe('Mapping type — Stripe only supports \"by_id\" (customer ID lookup).'),\n })\n .optional()\n .describe('How meter events map to a customer. If omitted, events must include a customer ID at the default key.'),\n value_settings: z\n .object({\n event_payload_key: z\n .string()\n .min(1)\n .describe('Key in the meter event payload to use as the numeric value (e.g. \"bytes_used\").'),\n })\n .optional()\n .describe('For \"sum\"/\"last\" formulas: which event payload key holds the numeric value.'),\n event_time_window: z\n .enum(['day', 'hour'])\n .optional()\n .describe('Pre-aggregation time window for meter events. Omit for no pre-aggregation.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_meters_create',\n description:\n 'Create a billing meter for usage-based pricing. Meters aggregate usage events (e.g. API calls, bytes transferred) that can be attached to prices for metered billing. The event_name is in snake_case and is used when recording meter events.',\n inputSchema: {\n type: 'object',\n properties: {\n display_name: { type: 'string', description: 'Human-readable meter name.' },\n event_name: {\n type: 'string',\n description: 'Snake_case event name (e.g. \"api_calls\").',\n },\n default_aggregation: {\n type: 'object',\n properties: {\n formula: { type: 'string', enum: ['sum', 'count', 'last'], description: 'Aggregation formula.' },\n },\n required: ['formula'],\n description: 'Default aggregation settings.',\n },\n customer_mapping: {\n type: 'object',\n properties: {\n event_payload_key: { type: 'string', description: 'Payload key for customer ID.' },\n type: { type: 'string', enum: ['by_id'], description: 'Mapping type (Stripe only supports by_id).' },\n },\n required: ['event_payload_key', 'type'],\n description: 'How events map to a customer.',\n },\n value_settings: {\n type: 'object',\n properties: {\n event_payload_key: { type: 'string', description: 'Payload key for the numeric value.' },\n },\n required: ['event_payload_key'],\n description: 'For sum/last formulas: the value payload key.',\n },\n event_time_window: { type: 'string', enum: ['day', 'hour'], description: 'Pre-aggregation window.' },\n },\n required: ['display_name', 'event_name', 'default_aggregation'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const stripe = getStripeClient();\n try {\n const params = buildStripeParams<Stripe.Billing.MeterCreateParams>({\n display_name: parsed.data.display_name,\n event_name: parsed.data.event_name,\n default_aggregation: parsed.data.default_aggregation,\n customer_mapping: parsed.data.customer_mapping,\n value_settings: parsed.data.value_settings,\n event_time_window: parsed.data.event_time_window,\n });\n const meter = await stripe.billing.meters.create(params);\n return JSON.stringify(meter, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\n\nconst inputSchema = z.object({\n meter_id: z\n .string()\n .min(1)\n .describe('The ID of the billing meter to retrieve (e.g. \"meter_...\").'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_meters_get',\n description:\n 'Retrieve a billing meter by ID. Returns the full meter object including display_name, event_name, default_aggregation, status, and customer_mapping.',\n inputSchema: {\n type: 'object',\n properties: {\n meter_id: { type: 'string', description: 'The meter ID (e.g. \"meter_...\").' },\n },\n required: ['meter_id'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const stripe = getStripeClient();\n try {\n const meter = await stripe.billing.meters.retrieve(parsed.data.meter_id);\n return JSON.stringify(meter, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll, listEnvelope } from '../../utils/pagination.js';\n\nconst inputSchema = z.object({\n limit: z.number().int().min(1).max(100).optional().describe('Page size (1-100).'),\n starting_after: z\n .string()\n .optional()\n .describe('Cursor: ID of the last meter from the previous page.'),\n max_items: z\n .number()\n .int()\n .min(1)\n .max(1000)\n .optional()\n .describe('Cap on total meters returned.'),\n});\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_meters_list',\n description:\n 'List billing meters. Auto-paginates up to max_items (default 100). Returns { total_count, has_more, data }.',\n inputSchema: {\n type: 'object',\n properties: {\n limit: { type: 'integer', minimum: 1, maximum: 100, description: 'Page size.' },\n starting_after: { type: 'string', description: 'Pagination cursor.' },\n max_items: { type: 'integer', minimum: 1, maximum: 1000, description: 'Total cap.' },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const stripe = getStripeClient();\n try {\n const all = await paginateAll<Stripe.Billing.Meter>(\n (p) => stripe.billing.meters.list(p),\n { maxItems: parsed.data.max_items ?? 100 },\n );\n return JSON.stringify(listEnvelope(all, false), null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as createMeter } from './create-meter.js';\nimport { toolDefinition as getMeter } from './get-meter.js';\nimport { toolDefinition as listMeters } from './list-meters.js';\n\nexport const tools: ToolDefinition[] = [createMeter, getMeter, listMeters];\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll } from '../../utils/pagination.js';\nimport { formatAmount, normalizeToMonthly } from '../../utils/currency.js';\nimport { nowUnix, fromUnixTimestamp } from '../../utils/date.js';\n\nconst inputSchema = z.object({\n currency: z\n .string()\n .min(3)\n .max(3)\n .optional()\n .describe(\n 'Primary currency (3-letter lowercase ISO code) used for totals and top customers. Defaults to \"usd\". Subscriptions in other currencies are still broken out in mrr_by_currency.',\n ),\n include_trials: z\n .boolean()\n .optional()\n .default(false)\n .describe('If true, include subscriptions currently in trial. Defaults to false.'),\n});\n\ninterface CustomerMrr {\n customer_id: string;\n email: string | null;\n name: string | null;\n mrr: number;\n}\n\ninterface PlanMrr {\n mrr: number;\n customer_count: number;\n}\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_analytics_get_mrr',\n description:\n 'Compute Monthly Recurring Revenue (MRR) by aggregating all active subscriptions client-side (Stripe has no native MRR endpoint). Returns total MRR, breakdowns by plan and currency, top 10 customers by MRR, and active subscription count. Trial subscriptions are excluded by default.',\n inputSchema: {\n type: 'object',\n properties: {\n currency: {\n type: 'string',\n description: 'Primary currency for totals (default \"usd\").',\n },\n include_trials: {\n type: 'boolean',\n default: false,\n description: 'Include trialing subscriptions in totals.',\n },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const currency = (parsed.data.currency ?? 'usd').toLowerCase();\n const includeTrials = parsed.data.include_trials;\n const stripe = getStripeClient();\n\n try {\n const now = nowUnix();\n\n const subscriptions = await paginateAll<Stripe.Subscription>(\n (p) =>\n stripe.subscriptions.list({\n ...p,\n status: 'active',\n expand: ['data.customer', 'data.items.data.price'],\n }),\n { maxItems: 10_000 },\n );\n\n // Also fetch trialing subscriptions if include_trials is true (status: 'active'\n // returns subs in active cycle, but trials surface separately).\n let trialing: Stripe.Subscription[] = [];\n if (includeTrials) {\n trialing = await paginateAll<Stripe.Subscription>(\n (p) =>\n stripe.subscriptions.list({\n ...p,\n status: 'trialing',\n expand: ['data.customer', 'data.items.data.price'],\n }),\n { maxItems: 10_000 },\n );\n }\n\n const allSubs = [...subscriptions, ...trialing];\n\n const mrrByCurrency: Record<string, number> = {};\n const mrrByPlan: Record<string, PlanMrr> = {};\n const mrrByCustomer: Record<string, CustomerMrr> = {};\n let chosenCurrencyMrr = 0;\n let activeSubscriptionCount = 0;\n\n for (const sub of allSubs) {\n // Skip trials unless include_trials is true.\n const isTrial =\n sub.status === 'trialing' ||\n (typeof sub.trial_end === 'number' && sub.trial_end > now);\n if (isTrial && !includeTrials) continue;\n\n activeSubscriptionCount += 1;\n\n const customerId =\n typeof sub.customer === 'string' ? sub.customer : sub.customer?.id ?? 'unknown';\n\n const customerEmail =\n typeof sub.customer === 'object' && sub.customer && 'email' in sub.customer\n ? ((sub.customer as Stripe.Customer).email ?? null)\n : null;\n const customerName =\n typeof sub.customer === 'object' && sub.customer && 'name' in sub.customer\n ? ((sub.customer as Stripe.Customer).name ?? null)\n : null;\n\n let subMrr = 0;\n let subCurrency: string | null = null;\n\n for (const item of sub.items.data) {\n const price = item.price;\n if (!price || !price.recurring) continue;\n const itemCurrency = price.currency;\n const interval = price.recurring.interval;\n const unitAmount = price.unit_amount ?? 0;\n const quantity = item.quantity ?? 1;\n const monthlyMajor = normalizeToMonthly(unitAmount, itemCurrency, interval) * quantity;\n\n subMrr += monthlyMajor;\n subCurrency = itemCurrency;\n\n // By currency (major units).\n mrrByCurrency[itemCurrency] = (mrrByCurrency[itemCurrency] ?? 0) + monthlyMajor;\n\n // By plan (only for chosen currency, to keep totals consistent).\n if (itemCurrency === currency) {\n const planKey = price.nickname || price.id;\n const existing = mrrByPlan[planKey] ?? { mrr: 0, customer_count: 0 };\n existing.mrr += monthlyMajor;\n existing.customer_count += 1;\n mrrByPlan[planKey] = existing;\n }\n }\n\n if (subCurrency === currency) {\n chosenCurrencyMrr += subMrr;\n }\n\n // Aggregate per-customer MRR across chosen currency only (for top customers).\n if (subCurrency === currency) {\n const existing = mrrByCustomer[customerId];\n if (existing) {\n existing.mrr += subMrr;\n } else {\n mrrByCustomer[customerId] = {\n customer_id: customerId,\n email: customerEmail,\n name: customerName,\n mrr: subMrr,\n };\n }\n }\n }\n\n const topCustomers = Object.values(mrrByCustomer)\n .sort((a, b) => b.mrr - a.mrr)\n .slice(0, 10)\n .map((c) => ({\n customer_id: c.customer_id,\n email: c.email,\n name: c.name,\n mrr: Number(c.mrr.toFixed(2)),\n mrr_formatted: formatAmount(Math.round(c.mrr * 100), currency),\n }));\n\n const totalMrr = Number(chosenCurrencyMrr.toFixed(2));\n\n const summary = {\n total_mrr: totalMrr,\n total_mrr_formatted: formatAmount(Math.round(totalMrr * 100), currency),\n mrr_by_plan: Object.fromEntries(\n Object.entries(mrrByPlan).map(([k, v]) => [\n k,\n { mrr: Number(v.mrr.toFixed(2)), customer_count: v.customer_count },\n ]),\n ),\n mrr_by_currency: Object.fromEntries(\n Object.entries(mrrByCurrency).map(([k, v]) => [k, Number(v.toFixed(2))]),\n ),\n top_customers_by_mrr: topCustomers,\n active_subscription_count: activeSubscriptionCount,\n currency,\n computed_at: fromUnixTimestamp(now),\n };\n\n return JSON.stringify(summary, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","/**\n * Currency formatting utilities.\n *\n * Stripe stores amounts in the smallest currency unit (cents for USD/EUR,\n * whole units for zero-decimal currencies like JPY/KRW). These helpers\n * convert to human-readable strings and major units safely.\n */\n\n// Zero-decimal currencies (ISO 4217) — no fractional units.\n// Source: https://stripe.com/docs/currencies#zero-decimal\nconst ZERO_DECIMAL_CURRENCIES = new Set([\n 'bif', 'clp', 'djf', 'gnf', 'jpy', 'kmf', 'krw', 'mga',\n 'pyg', 'rwf', 'ugx', 'vnd', 'vuv', 'xaf', 'xof', 'xpf',\n]);\n\n// Three-decimal currencies (e.g. Bahraini Dinar).\nconst THREE_DECIMAL_CURRENCIES = new Set(['bhd', 'jod', 'kwd', 'omr', 'tnd']);\n\nconst CURRENCY_SYMBOLS: Record<string, string> = {\n usd: '$', eur: '€', gbp: '£', jpy: '¥', cny: '¥', inr: '₹',\n krw: '₩', rub: '₽', brl: 'R$', cad: 'C$', aud: 'A$', chf: 'CHF',\n sek: 'kr', nok: 'kr', dkk: 'kr', pln: 'zł', try: '₺', mxn: 'MX$',\n sgd: 'S$', hkd: 'HK$', nzd: 'NZ$', zar: 'R', aed: 'AED', sar: 'SAR',\n};\n\n/**\n * Convert a Stripe amount (smallest unit) to a human-readable string.\n * @example formatAmount(1250, 'usd') → '$12.50'\n * @example formatAmount(1000, 'jpy') → '¥1000'\n * @example formatAmount(1250, 'bhd') → 'BHD 1.250'\n */\nexport function formatAmount(amount: number, currency: string): string {\n const c = currency.toLowerCase();\n const rawSymbol = CURRENCY_SYMBOLS[c] ?? c.toUpperCase();\n // For 3-letter currency codes (no dedicated symbol), add a space for\n // readability: \"BHD 1.250\" reads better than \"BHD1.250\".\n const symbol =\n rawSymbol.length === 3 && rawSymbol === c.toUpperCase() ? `${rawSymbol} ` : rawSymbol;\n\n if (ZERO_DECIMAL_CURRENCIES.has(c)) {\n return `${symbol}${amount}`;\n }\n if (THREE_DECIMAL_CURRENCIES.has(c)) {\n const major = (amount / 1000).toFixed(3);\n return `${symbol}${major}`;\n }\n const major = (amount / 100).toFixed(2);\n return `${symbol}${major}`;\n}\n\n/**\n * Convert a Stripe amount (smallest unit) to its major-unit number.\n * @example toMajorUnit(1250, 'usd') → 12.5\n * @example toMajorUnit(1000, 'jpy') → 1000\n */\nexport function toMajorUnit(amount: number, currency: string): number {\n const c = currency.toLowerCase();\n if (ZERO_DECIMAL_CURRENCIES.has(c)) return amount;\n if (THREE_DECIMAL_CURRENCIES.has(c)) return amount / 1000;\n return amount / 100;\n}\n\n/**\n * Normalize a recurring price to a monthly amount (in major units) for MRR.\n * - monthly → amount\n * - yearly → amount / 12\n * - weekly → amount * 52 / 12\n * - daily → amount * 365 / 12\n * Returns 0 for one-time prices.\n */\nexport function normalizeToMonthly(\n amount: number,\n currency: string,\n interval: 'month' | 'year' | 'week' | 'day' | string | null | undefined,\n): number {\n const major = toMajorUnit(amount, currency);\n switch (interval) {\n case 'month':\n return major;\n case 'year':\n return major / 12;\n case 'week':\n return (major * 52) / 12;\n case 'day':\n return (major * 365) / 12;\n default:\n return 0;\n }\n}\n\nexport function isZeroDecimal(currency: string): boolean {\n return ZERO_DECIMAL_CURRENCIES.has(currency.toLowerCase());\n}\n","/**\n * Date utilities for consistent Stripe timestamp handling.\n * Stripe returns Unix timestamps (seconds); we surface both Unix and ISO 8601.\n */\n\nconst RELATIVE_UNITS: Array<{ unit: Intl.RelativeTimeFormatUnit; ms: number }> = [\n { unit: 'year', ms: 365 * 24 * 60 * 60 * 1000 },\n { unit: 'month', ms: 30 * 24 * 60 * 60 * 1000 },\n { unit: 'day', ms: 24 * 60 * 60 * 1000 },\n { unit: 'hour', ms: 60 * 60 * 1000 },\n { unit: 'minute', ms: 60 * 1000 },\n { unit: 'second', ms: 1000 },\n];\n\nconst rtf = new Intl.RelativeTimeFormat('en', { numeric: 'auto' });\n\n/** Convert a Unix timestamp (seconds) to an ISO 8601 string. */\nexport function fromUnixTimestamp(ts: number): string {\n return new Date(ts * 1000).toISOString();\n}\n\n/** Convert an ISO 8601 string to a Unix timestamp (seconds). */\nexport function toUnixTimestamp(iso: string): number {\n return Math.floor(new Date(iso).getTime() / 1000);\n}\n\n/** Human-readable relative time from a Unix timestamp (seconds). */\nexport function formatRelative(ts: number): string {\n const diffMs = ts * 1000 - Date.now();\n const abs = Math.abs(diffMs);\n for (const { unit, ms } of RELATIVE_UNITS) {\n if (abs >= ms || unit === 'second') {\n return rtf.format(Math.round(diffMs / ms), unit);\n }\n }\n return 'just now';\n}\n\n/** Current Unix timestamp in seconds. */\nexport function nowUnix(): number {\n return Math.floor(Date.now() / 1000);\n}\n\n/** Unix timestamp N days ago (seconds). */\nexport function daysAgoUnix(days: number): number {\n return nowUnix() - days * 24 * 60 * 60;\n}\n\n/** Resolve a human period string to a [start, end] unix range (seconds). */\nexport function resolvePeriod(\n period:\n | 'last_7_days'\n | 'last_30_days'\n | 'last_90_days'\n | 'last_12_months'\n | 'month_to_date'\n | 'year_to_date',\n): { start: number; end: number } {\n const end = nowUnix();\n const day = 24 * 60 * 60;\n switch (period) {\n case 'last_7_days':\n return { start: end - 7 * day, end };\n case 'last_30_days':\n return { start: end - 30 * day, end };\n case 'last_90_days':\n return { start: end - 90 * day, end };\n case 'last_12_months':\n return { start: end - 365 * day, end };\n case 'month_to_date': {\n const now = new Date();\n const start = new Date(now.getFullYear(), now.getMonth(), 1);\n return { start: Math.floor(start.getTime() / 1000), end };\n }\n case 'year_to_date': {\n const now = new Date();\n const start = new Date(now.getFullYear(), 0, 1);\n return { start: Math.floor(start.getTime() / 1000), end };\n }\n }\n}\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll } from '../../utils/pagination.js';\nimport { normalizeToMonthly } from '../../utils/currency.js';\nimport { toUnixTimestamp, nowUnix, fromUnixTimestamp, daysAgoUnix } from '../../utils/date.js';\n\nconst inputSchema = z.object({\n period_start: z\n .string()\n .optional()\n .describe('ISO 8601 start of the analysis window. Defaults to 30 days ago.'),\n period_end: z\n .string()\n .optional()\n .describe('ISO 8601 end of the analysis window. Defaults to now.'),\n interval: z\n .enum(['monthly', 'weekly'])\n .optional()\n .describe('Reporting interval label (\"monthly\" or \"weekly\"). Defaults to \"monthly\". Does not change data fetched, only the interval tag.'),\n});\n\ninterface ChurnedCustomer {\n subscription_id: string;\n customer_id: string;\n email: string | null;\n canceled_at: number;\n canceled_at_iso: string;\n lifetime_value_estimate: number;\n cancellation_reason: string | null;\n}\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_analytics_get_churn_rate',\n description:\n 'Compute subscription churn rate for a given period. Fetches all subscriptions created before period_end, identifies those canceled within [period_start, period_end], and estimates the active subscription count at period_start. Returns churn_rate_percent, churned_count, churned_customers detail, and active_at_period_start.',\n inputSchema: {\n type: 'object',\n properties: {\n period_start: { type: 'string', description: 'ISO 8601 start (default: 30 days ago).' },\n period_end: { type: 'string', description: 'ISO 8601 end (default: now).' },\n interval: { type: 'string', enum: ['monthly', 'weekly'], description: 'Interval label.' },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const interval = parsed.data.interval ?? 'monthly';\n\n const periodEnd = parsed.data.period_end\n ? toUnixTimestamp(parsed.data.period_end)\n : nowUnix();\n const periodStart = parsed.data.period_start\n ? toUnixTimestamp(parsed.data.period_start)\n : daysAgoUnix(30);\n\n if (periodStart >= periodEnd) {\n return `Validation error: period_start must be before period_end.`;\n }\n\n const stripe = getStripeClient();\n\n try {\n // Fetch all subscriptions created before period_end with status='all'.\n // This single fetch gives us both churned_in_period and active_at_start.\n const allSubs = await paginateAll<Stripe.Subscription>(\n (p) =>\n stripe.subscriptions.list({\n ...p,\n status: 'all',\n created: { lt: periodEnd },\n expand: ['data.customer', 'data.items.data.price'],\n }),\n { maxItems: 50_000 },\n );\n\n const churned: ChurnedCustomer[] = [];\n let activeAtStart = 0;\n\n for (const sub of allSubs) {\n const created = sub.created ?? 0;\n const canceledAt = sub.canceled_at;\n\n // Was this sub active at period_start?\n // Active = created before period_start AND (not canceled OR canceled after period_start)\n const wasActiveAtStart =\n created <= periodStart && (canceledAt === null || canceledAt > periodStart);\n if (wasActiveAtStart) activeAtStart += 1;\n\n // Churned in period?\n if (canceledAt !== null && canceledAt >= periodStart && canceledAt <= periodEnd) {\n const customerId =\n typeof sub.customer === 'string' ? sub.customer : sub.customer?.id ?? 'unknown';\n const customerEmail =\n typeof sub.customer === 'object' && sub.customer && 'email' in sub.customer\n ? (sub.customer as Stripe.Customer).email\n : null;\n\n // Estimate lifetime value: sum across items of (monthly_value * months_active).\n const monthsActive = Math.max(\n 1,\n (canceledAt - created) / (30 * 24 * 60 * 60),\n );\n let ltv = 0;\n for (const item of sub.items.data) {\n const price = item.price;\n if (!price || !price.recurring) continue;\n const unitAmount = price.unit_amount ?? 0;\n const quantity = item.quantity ?? 1;\n const monthlyMajor = normalizeToMonthly(unitAmount, price.currency, price.recurring.interval) * quantity;\n ltv += monthlyMajor * monthsActive;\n }\n\n const cancellationReason = sub.cancellation_details?.reason ?? null;\n\n churned.push({\n subscription_id: sub.id,\n customer_id: customerId,\n email: customerEmail,\n canceled_at: canceledAt,\n canceled_at_iso: fromUnixTimestamp(canceledAt),\n lifetime_value_estimate: Number(ltv.toFixed(2)),\n cancellation_reason: cancellationReason,\n });\n }\n }\n\n const churnRatePercent =\n activeAtStart > 0 ? Number(((churned.length / activeAtStart) * 100).toFixed(2)) : 0;\n\n const summary = {\n churn_rate_percent: churnRatePercent,\n churned_count: churned.length,\n active_at_period_start: activeAtStart,\n period_start: periodStart,\n period_end: periodEnd,\n period_start_iso: fromUnixTimestamp(periodStart),\n period_end_iso: fromUnixTimestamp(periodEnd),\n interval,\n churned_customers: churned.sort((a, b) => b.canceled_at - a.canceled_at),\n };\n\n return JSON.stringify(summary, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll } from '../../utils/pagination.js';\nimport { formatAmount } from '../../utils/currency.js';\nimport { resolvePeriod, fromUnixTimestamp } from '../../utils/date.js';\n\nconst inputSchema = z.object({\n period: z\n .enum(['last_7_days', 'last_30_days', 'last_90_days', 'last_12_months', 'month_to_date', 'year_to_date'])\n .describe('Predefined time window for the revenue summary.'),\n});\n\ninterface TimeBucket {\n date: string;\n gross: number;\n net: number;\n count: number;\n}\n\nfunction bucketKeyFor(chargeCreated: number, useMonthly: boolean): string {\n const d = new Date(chargeCreated * 1000);\n if (useMonthly) {\n const y = d.getUTCFullYear();\n const m = String(d.getUTCMonth() + 1).padStart(2, '0');\n return `${y}-${m}`;\n }\n const y = d.getUTCFullYear();\n const m = String(d.getUTCMonth() + 1).padStart(2, '0');\n const day = String(d.getUTCDate()).padStart(2, '0');\n return `${y}-${m}-${day}`;\n}\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_analytics_get_revenue_summary',\n description:\n 'Aggregate gross/net revenue, refunds, payment counts, failure rate, and a time series for a given period. Computes client-side from charges. Returns formatted currency strings alongside raw cent amounts.',\n inputSchema: {\n type: 'object',\n properties: {\n period: {\n type: 'string',\n enum: ['last_7_days', 'last_30_days', 'last_90_days', 'last_12_months', 'month_to_date', 'year_to_date'],\n description: 'Predefined window.',\n },\n },\n required: ['period'],\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const period = parsed.data.period;\n\n const stripe = getStripeClient();\n try {\n const { start, end } = resolvePeriod(period);\n const useMonthly = period === 'last_12_months' || period === 'year_to_date';\n\n const charges = await paginateAll<Stripe.Charge>(\n (p) =>\n stripe.charges.list({\n ...p,\n created: { gte: start, lte: end },\n }),\n { maxItems: 50_000 },\n );\n\n let grossRevenue = 0;\n let refundAmount = 0;\n let successfulPayments = 0;\n let failedPayments = 0;\n let primaryCurrency = 'usd';\n\n const buckets: Record<string, TimeBucket> = {};\n\n for (const charge of charges) {\n if (!primaryCurrency && charge.currency) primaryCurrency = charge.currency;\n if (charge.currency === primaryCurrency && charge.currency) {\n // already primary\n } else if (charge.currency) {\n // If first charge's currency differs, still take it as primary.\n if (grossRevenue === 0) primaryCurrency = charge.currency;\n }\n\n const amount = charge.amount ?? 0;\n const refunded = charge.amount_refunded ?? 0;\n const key = bucketKeyFor(charge.created, useMonthly);\n const bucket = (buckets[key] ??= { date: key, gross: 0, net: 0, count: 0 });\n\n if (charge.status === 'succeeded') {\n grossRevenue += amount;\n successfulPayments += 1;\n refundAmount += refunded;\n bucket.gross += amount;\n bucket.net += amount - refunded;\n bucket.count += 1;\n } else if (charge.status === 'failed') {\n failedPayments += 1;\n }\n }\n\n const netRevenue = grossRevenue - refundAmount;\n const totalPayments = successfulPayments + failedPayments;\n const failureRatePercent =\n totalPayments > 0 ? Number(((failedPayments / totalPayments) * 100).toFixed(2)) : 0;\n const refundRatePercent =\n grossRevenue > 0 ? Number(((refundAmount / grossRevenue) * 100).toFixed(2)) : 0;\n const avgTransactionValue =\n successfulPayments > 0 ? Math.round(grossRevenue / successfulPayments) : 0;\n\n const timeSeries = Object.values(buckets).sort((a, b) => a.date.localeCompare(b.date));\n\n const summary = {\n period,\n period_start: start,\n period_end: end,\n period_start_iso: fromUnixTimestamp(start),\n period_end_iso: fromUnixTimestamp(end),\n currency: primaryCurrency,\n gross_revenue: grossRevenue,\n gross_revenue_formatted: formatAmount(grossRevenue, primaryCurrency),\n net_revenue: netRevenue,\n net_revenue_formatted: formatAmount(netRevenue, primaryCurrency),\n refund_amount: refundAmount,\n refund_amount_formatted: formatAmount(refundAmount, primaryCurrency),\n refund_rate_percent: refundRatePercent,\n successful_payments: successfulPayments,\n failed_payments: failedPayments,\n failure_rate_percent: failureRatePercent,\n avg_transaction_value: avgTransactionValue,\n avg_transaction_value_formatted: formatAmount(avgTransactionValue, primaryCurrency),\n time_series: timeSeries,\n };\n\n return JSON.stringify(summary, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll } from '../../utils/pagination.js';\nimport { formatAmount, normalizeToMonthly } from '../../utils/currency.js';\nimport { daysAgoUnix, nowUnix, fromUnixTimestamp } from '../../utils/date.js';\n\nconst inputSchema = z.object({\n limit: z\n .number()\n .int()\n .min(1)\n .max(50)\n .optional()\n .describe('Number of top customers to return (default 10, max 50).'),\n metric: z\n .enum(['lifetime_value', 'mrr', 'payment_count'])\n .optional()\n .describe('Ranking metric: lifetime_value (default), mrr, or payment_count.'),\n period_days: z\n .number()\n .int()\n .min(1)\n .max(3650)\n .optional()\n .describe('If provided, only count charges within the last N days for lifetime_value / payment_count. Ignored for mrr.'),\n});\n\ninterface CustomerAgg {\n customer_id: string;\n email: string | null;\n name: string | null;\n value: number;\n charge_count: number;\n currency: string;\n}\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_analytics_get_top_customers',\n description:\n 'Rank customers by lifetime_value, MRR, or payment_count. For lifetime_value/payment_count, fetches all succeeded charges in the lookback window (or all time) and groups by customer. For MRR, computes per-customer MRR from active subscriptions.',\n inputSchema: {\n type: 'object',\n properties: {\n limit: { type: 'integer', minimum: 1, maximum: 50, description: 'Top N (default 10).' },\n metric: {\n type: 'string',\n enum: ['lifetime_value', 'mrr', 'payment_count'],\n description: 'Ranking metric (default lifetime_value).',\n },\n period_days: {\n type: 'integer',\n minimum: 1,\n maximum: 3650,\n description: 'Lookback window in days for lifetime_value/payment_count.',\n },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const limit = parsed.data.limit ?? 10;\n const metric = parsed.data.metric ?? 'lifetime_value';\n const periodDays = parsed.data.period_days;\n\n const stripe = getStripeClient();\n try {\n const now = nowUnix();\n\n // Fetch all customers so we have email/name even for those without charges in window.\n const customers = await paginateAll<Stripe.Customer>(\n (p) => stripe.customers.list(p),\n { maxItems: 50_000 },\n );\n const customerMap = new Map<string, { email: string | null; name: string | null }>();\n for (const c of customers) {\n customerMap.set(c.id, { email: c.email ?? null, name: c.name ?? null });\n }\n\n const agg = new Map<string, CustomerAgg>();\n\n const ensure = (customerId: string, currency: string): CustomerAgg => {\n let a = agg.get(customerId);\n if (!a) {\n const ident = customerMap.get(customerId);\n a = {\n customer_id: customerId,\n email: ident?.email ?? null,\n name: ident?.name ?? null,\n value: 0,\n charge_count: 0,\n currency,\n };\n agg.set(customerId, a);\n }\n return a;\n };\n\n let primaryCurrency = 'usd';\n let metricLabel: string;\n let valueFormattedFn: (value: number, currency: string) => string;\n\n if (metric === 'mrr') {\n metricLabel = 'MRR';\n const subs = await paginateAll<Stripe.Subscription>(\n (p) =>\n stripe.subscriptions.list({\n ...p,\n status: 'active',\n expand: ['data.customer', 'data.items.data.price'],\n }),\n { maxItems: 50_000 },\n );\n\n for (const sub of subs) {\n const isTrial =\n sub.status === 'trialing' ||\n (typeof sub.trial_end === 'number' && sub.trial_end > now);\n if (isTrial) continue;\n\n const customerId =\n typeof sub.customer === 'string' ? sub.customer : sub.customer?.id ?? 'unknown';\n\n let subMrr = 0;\n let subCurrency = 'usd';\n for (const item of sub.items.data) {\n const price = item.price;\n if (!price || !price.recurring) continue;\n subCurrency = price.currency;\n if (!primaryCurrency) primaryCurrency = subCurrency;\n const unitAmount = price.unit_amount ?? 0;\n const quantity = item.quantity ?? 1;\n subMrr += normalizeToMonthly(unitAmount, subCurrency, price.recurring.interval) * quantity;\n }\n primaryCurrency = subCurrency;\n const a = ensure(customerId, subCurrency);\n a.value += subMrr;\n }\n\n valueFormattedFn = (v: number, currency: string) => formatAmount(Math.round(v * 100), currency);\n } else {\n // lifetime_value or payment_count — both use succeeded charges.\n metricLabel = metric === 'lifetime_value' ? 'Lifetime Value' : 'Payment Count';\n\n const createdFilter =\n periodDays !== undefined ? ({ gte: daysAgoUnix(periodDays) } as const) : undefined;\n\n const charges = await paginateAll<Stripe.Charge>(\n (p) =>\n stripe.charges.list({\n ...p,\n ...(createdFilter ? { created: createdFilter } : {}),\n }),\n { maxItems: 100_000 },\n );\n\n for (const charge of charges) {\n // ChargeListParams does not expose a server-side `status` filter in this\n // SDK version, so we filter succeeded charges client-side.\n if (charge.status !== 'succeeded') continue;\n const customerId = typeof charge.customer === 'string' ? charge.customer : null;\n if (!customerId) continue;\n if (!primaryCurrency && charge.currency) primaryCurrency = charge.currency;\n const a = ensure(customerId, charge.currency ?? primaryCurrency);\n if (metric === 'lifetime_value') {\n a.value += charge.amount ?? 0;\n }\n a.charge_count += 1;\n if (metric === 'payment_count') {\n a.value += 1;\n }\n }\n\n valueFormattedFn =\n metric === 'lifetime_value'\n ? (v: number, currency: string) => formatAmount(v, currency)\n : () => '';\n }\n\n const sorted = Array.from(agg.values())\n .filter((a) => a.value > 0)\n .sort((a, b) => b.value - a.value)\n .slice(0, limit);\n\n const ranked = sorted.map((a, idx) => ({\n rank: idx + 1,\n customer_id: a.customer_id,\n email: a.email,\n name: a.name,\n value: metric === 'lifetime_value' ? a.value : Number(a.value.toFixed(2)),\n value_formatted: metric === 'payment_count' ? `${a.charge_count} payments` : valueFormattedFn(a.value, a.currency),\n metric_label: metricLabel,\n }));\n\n const summary = {\n metric,\n metric_label: metricLabel,\n period_days: periodDays ?? null,\n computed_at_iso: fromUnixTimestamp(now),\n ranked,\n };\n\n return JSON.stringify(summary, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import { z } from 'zod';\nimport type Stripe from 'stripe';\nimport type { ToolDefinition } from '../../types/index.js';\nimport { getStripeClient } from '../../config.js';\nimport { formatStripeError } from '../../utils/format-stripe-error.js';\nimport { paginateAll } from '../../utils/pagination.js';\nimport { formatAmount } from '../../utils/currency.js';\nimport { daysAgoUnix, fromUnixTimestamp, nowUnix } from '../../utils/date.js';\n\nconst inputSchema = z.object({\n period_days: z\n .number()\n .int()\n .min(1)\n .max(365)\n .optional()\n .describe('Lookback window in days (default 30).'),\n});\n\ninterface ReasonBreakdown {\n count: number;\n amount: number;\n}\n\ninterface AffectedCustomer {\n customer_id: string;\n email: string | null;\n failed_count: number;\n failed_amount: number;\n failed_amount_formatted: string;\n last_failure_decline_code: string;\n last_failure_at: number;\n last_failure_at_iso: string;\n recovery_suggestion: string;\n}\n\nconst RECOVERY_SUGGESTIONS: Record<string, string> = {\n insufficient_funds: 'Ask customer to use a different card or top up.',\n expired_card: 'Ask customer for a new card.',\n lost_card: 'Do not retry; ask customer for a new card.',\n stolen_card: 'Do not retry; ask customer for a new card.',\n generic_decline: 'Ask customer to contact their bank or use a different card.',\n};\n\nfunction recoverySuggestion(declineCode: string): string {\n return (\n RECOVERY_SUGGESTIONS[declineCode] ??\n 'Retry after the customer updates their payment method.'\n );\n}\n\nexport const toolDefinition: ToolDefinition = {\n definition: {\n name: 'stripe_analytics_get_failed_payments_report',\n description:\n 'Report on failed charges over the last N days. Returns total failed amount, count, a breakdown by decline code, and per-customer failure summaries with recovery suggestions.',\n inputSchema: {\n type: 'object',\n properties: {\n period_days: {\n type: 'integer',\n minimum: 1,\n maximum: 365,\n description: 'Lookback window in days (default 30).',\n },\n },\n },\n },\n async execute(input: unknown): Promise<string> {\n const parsed = inputSchema.safeParse(input);\n if (!parsed.success) return `Validation error: ${parsed.error.message}`;\n const periodDays = parsed.data.period_days ?? 30;\n const start = daysAgoUnix(periodDays);\n\n const stripe = getStripeClient();\n try {\n const charges = await paginateAll<Stripe.Charge>(\n (p) =>\n stripe.charges.list({\n ...p,\n created: { gte: start },\n }),\n { maxItems: 100_000 },\n );\n\n let totalFailedAmount = 0;\n let primaryCurrency = 'usd';\n const reasons: Record<string, ReasonBreakdown> = {};\n const byCustomer = new Map<\n string,\n {\n customer_id: string;\n email: string | null;\n failed_count: number;\n failed_amount: number;\n last_failure_at: number;\n last_failure_decline_code: string;\n }\n >();\n\n let failedCount = 0;\n for (const charge of charges) {\n // ChargeListParams does not expose a server-side `status` filter in this\n // SDK version, so we filter client-side.\n if (charge.status !== 'failed') continue;\n failedCount += 1;\n const amount = charge.amount ?? 0;\n totalFailedAmount += amount;\n if (!primaryCurrency && charge.currency) primaryCurrency = charge.currency;\n\n const declineCode = charge.failure_code ?? 'unknown';\n const r = reasons[declineCode] ?? { count: 0, amount: 0 };\n r.count += 1;\n r.amount += amount;\n reasons[declineCode] = r;\n\n const customerId = typeof charge.customer === 'string' ? charge.customer : null;\n if (!customerId) continue;\n\n const existing = byCustomer.get(customerId);\n if (existing) {\n existing.failed_count += 1;\n existing.failed_amount += amount;\n if (charge.created > existing.last_failure_at) {\n existing.last_failure_at = charge.created;\n existing.last_failure_decline_code = declineCode;\n }\n } else {\n // Best-effort email lookup: charges don't include customer email unless expanded.\n byCustomer.set(customerId, {\n customer_id: customerId,\n email: null,\n failed_count: 1,\n failed_amount: amount,\n last_failure_at: charge.created,\n last_failure_decline_code: declineCode,\n });\n }\n }\n\n // Hydrate customer emails (paginate once, then look up).\n const affectedCustomerIds = new Set(byCustomer.keys());\n const affectedCustomers: AffectedCustomer[] = [];\n if (affectedCustomerIds.size > 0) {\n const customers = await paginateAll<Stripe.Customer>(\n (p) => stripe.customers.list(p),\n { maxItems: 50_000 },\n );\n const emailMap = new Map<string, string | null>();\n for (const c of customers) {\n emailMap.set(c.id, c.email);\n }\n for (const agg of byCustomer.values()) {\n affectedCustomers.push({\n customer_id: agg.customer_id,\n email: emailMap.get(agg.customer_id) ?? null,\n failed_count: agg.failed_count,\n failed_amount: agg.failed_amount,\n failed_amount_formatted: formatAmount(agg.failed_amount, primaryCurrency),\n last_failure_decline_code: agg.last_failure_decline_code,\n last_failure_at: agg.last_failure_at,\n last_failure_at_iso: fromUnixTimestamp(agg.last_failure_at),\n recovery_suggestion: recoverySuggestion(agg.last_failure_decline_code),\n });\n }\n }\n\n affectedCustomers.sort((a, b) => b.failed_amount - a.failed_amount);\n\n const summary = {\n period_days: periodDays,\n period_start: start,\n period_end: nowUnix(),\n period_start_iso: fromUnixTimestamp(start),\n currency: primaryCurrency,\n total_failed_amount: totalFailedAmount,\n total_failed_amount_formatted: formatAmount(totalFailedAmount, primaryCurrency),\n count: failedCount,\n failure_reasons_breakdown: reasons,\n affected_customers: affectedCustomers,\n };\n\n return JSON.stringify(summary, null, 2);\n } catch (error) {\n return formatStripeError(error);\n }\n },\n};\n","import type { ToolDefinition } from '../../types/index.js';\nimport { toolDefinition as getMrr } from './get-mrr.js';\nimport { toolDefinition as getChurnRate } from './get-churn-rate.js';\nimport { toolDefinition as getRevenueSummary } from './get-revenue-summary.js';\nimport { toolDefinition as getTopCustomers } from './get-top-customers.js';\nimport { toolDefinition as getFailedPaymentsReport } from './get-failed-payments-report.js';\n\nexport const tools: ToolDefinition[] = [\n getMrr,\n getChurnRate,\n getRevenueSummary,\n getTopCustomers,\n getFailedPaymentsReport,\n];\n","import type { ToolDefinition } from '../types/index.js';\n\nimport { tools as customersTools } from './customers/index.js';\nimport { tools as productsTools } from './products/index.js';\nimport { tools as pricesTools } from './prices/index.js';\nimport { tools as subscriptionsTools } from './subscriptions/index.js';\nimport { tools as invoicesTools } from './invoices/index.js';\nimport { tools as paymentIntentsTools } from './payment-intents/index.js';\nimport { tools as refundsTools } from './refunds/index.js';\nimport { tools as disputesTools } from './disputes/index.js';\nimport { tools as webhooksTools } from './webhooks/index.js';\nimport { tools as couponsTools } from './coupons/index.js';\nimport { tools as promotionCodesTools } from './promotion-codes/index.js';\nimport { tools as paymentLinksTools } from './payment-links/index.js';\nimport { tools as checkoutTools } from './checkout/index.js';\nimport { tools as billingPortalTools } from './billing-portal/index.js';\nimport { tools as balanceTools } from './balance/index.js';\nimport { tools as payoutsTools } from './payouts/index.js';\nimport { tools as taxTools } from './tax/index.js';\nimport { tools as metersTools } from './meters/index.js';\nimport { tools as analyticsTools } from './analytics/index.js';\n\n/**\n * The complete catalogue of stripe-mcp tools, in registration order.\n * Categories are grouped logically: core resources first, analytics last.\n */\nexport const allTools: ToolDefinition[] = [\n ...customersTools,\n ...productsTools,\n ...pricesTools,\n ...subscriptionsTools,\n ...invoicesTools,\n ...paymentIntentsTools,\n ...refundsTools,\n ...disputesTools,\n ...webhooksTools,\n ...couponsTools,\n ...promotionCodesTools,\n ...paymentLinksTools,\n ...checkoutTools,\n ...billingPortalTools,\n ...balanceTools,\n ...payoutsTools,\n ...taxTools,\n ...metersTools,\n ...analyticsTools,\n];\n\nexport const TOOL_COUNT = allTools.length;\n","import type Stripe from 'stripe';\nimport { getStripeClient, config, resetStripeClient } from './config.js';\nimport { allTools, TOOL_COUNT } from './tools/index.js';\nimport { formatStripeError } from './utils/format-stripe-error.js';\n\n/**\n * Result of a single doctor check. `ok` drives the ✓/✗ marker; `detail` is\n * the human-readable line printed under the check name.\n */\ninterface CheckResult {\n name: string;\n ok: boolean;\n detail: string;\n}\n\n/** Write a line to stderr (the doctor is a human-readable command). */\nfunction line(text: string): void {\n process.stderr.write(`${text}\\n`);\n}\n\n/**\n * Run a full health check of the stripe-mcp install and the configured Stripe\n * account. Prints a friendly report to stderr and returns a boolean\n * \"all checks passed\" so the caller can set the exit code.\n *\n * Checks performed:\n * 1. STRIPE_SECRET_KEY is set and has a recognised prefix.\n * 2. The key authenticates against the Stripe API (balance.retrieve).\n * 3. Account metadata (id, country, default currency, business name).\n * 4. Tool catalogue loads with the expected count.\n * 5. Node.js version meets the >=20 engines requirement.\n *\n * The doctor never throws — every check is wrapped and produces a CheckResult.\n */\nexport async function runDoctor(): Promise<boolean> {\n const banner = `stripe-mcp doctor ${VERSION} — health check\\n${'─'.repeat(56)}`;\n line(banner);\n line('');\n\n const checks: CheckResult[] = [];\n\n // Check 1 — environment / key presence.\n const envCheck = checkEnvironment();\n checks.push(envCheck);\n\n // Check 2 + 3 — live API auth + account metadata (only if a key is present).\n if (envCheck.ok) {\n const authResult = await checkStripeAuth();\n checks.push(authResult);\n } else {\n checks.push({\n name: 'Stripe API auth',\n ok: false,\n detail: 'skipped — no STRIPE_SECRET_KEY set',\n });\n }\n\n // Check 4 — tool catalogue integrity (pure-local, always runs).\n checks.push(checkToolCatalogue());\n\n // Check 5 — Node.js version.\n checks.push(checkNodeVersion());\n\n // Render the report.\n for (const c of checks) {\n const marker = c.ok ? '✓' : '✗';\n const color = c.ok ? '\\x1b[32m' : '\\x1b[31m'; // green / red\n const reset = '\\x1b[0m';\n line(` ${color}${marker}${reset} ${c.name}`);\n if (c.detail) line(` ${c.detail}`);\n }\n\n line('');\n const allOk = checks.every((c) => c.ok);\n if (allOk) {\n line('\\x1b[32m✓ All checks passed.\\x1b[0m stripe-mcp is ready to run.');\n line(' Start the server: stripe-mcp');\n line(' Or add to your MCP client config (see --help).');\n } else {\n line('\\x1b[33m⚠ Some checks failed. See above for details.\\x1b[0m');\n line(' Common fixes:');\n line(' • Set STRIPE_SECRET_KEY in your environment (sk_test_... or sk_live_...).');\n line(' • Get a key at https://dashboard.stripe.com/apikeys');\n line(' • Upgrade Node.js to v20+ if the version check failed.');\n }\n line('');\n return allOk;\n}\n\n/** Check 1: STRIPE_SECRET_KEY presence + prefix recognition. */\nfunction checkEnvironment(): CheckResult {\n const key = process.env.STRIPE_SECRET_KEY;\n if (!key) {\n return {\n name: 'STRIPE_SECRET_KEY',\n ok: false,\n detail: 'not set. Export STRIPE_SECRET_KEY=sk_test_... before running.',\n };\n }\n if (key.startsWith('sk_test_')) {\n return {\n name: 'STRIPE_SECRET_KEY',\n ok: true,\n detail: `set (test mode, ${key.length} chars). No real charges will be made.`,\n };\n }\n if (key.startsWith('sk_live_')) {\n return {\n name: 'STRIPE_SECRET_KEY',\n ok: true,\n detail: `set (\\x1b[33mLIVE mode\\x1b[0m, ${key.length} chars). Real money is affected.`,\n };\n }\n if (key.startsWith('rk_')) {\n return {\n name: 'STRIPE_SECRET_KEY',\n ok: true,\n detail: `set (restricted key, ${key.length} chars). Some tools may lack permission.`,\n };\n }\n return {\n name: 'STRIPE_SECRET_KEY',\n ok: false,\n detail: `set but has an unrecognised prefix (\"${key.slice(0, 8)}…\"). Expected sk_test_ / sk_live_ / rk_.`,\n };\n}\n\n/** Check 2 + 3: authenticate + fetch account metadata via balance.retrieve. */\nasync function checkStripeAuth(): Promise<CheckResult> {\n try {\n const stripe = getStripeClient();\n // balance.retrieve() is the cheapest authenticated call and works for\n // every key type. It also returns the available/pending balances which\n // are useful context for the report.\n const balance = await stripe.balance.retrieve();\n\n // Fetch account metadata for a richer report. This is a second call but\n // gives country/currency/business name — high value for confirming you're\n // hitting the right account.\n let account: Stripe.Account | null = null;\n try {\n // Pass `null` to retrieve the current account (the account the key\n // belongs to). Restricted keys may lack this permission — degrade.\n account = await stripe.accounts.retrieve(null);\n } catch {\n // Restricted keys may lack account:read — degrade gracefully.\n account = null;\n }\n\n const avail = balance.available?.[0];\n const pending = balance.pending?.[0];\n const parts: string[] = [];\n parts.push(\n `authenticated${\n account ? ` as ${account.id}` : ''\n } (${config.stripeMode} mode)`,\n );\n if (account) {\n if (account.country) parts.push(`country: ${account.country}`);\n if (account.default_currency) parts.push(`currency: ${account.default_currency.toUpperCase()}`);\n if (account.business_profile?.name) parts.push(`business: \"${account.business_profile.name}\"`);\n }\n if (avail) {\n parts.push(\n `available: ${formatAmountSafe(avail.amount, avail.currency)} (${avail.amount} ${avail.currency})`,\n );\n }\n if (pending && pending.amount > 0) {\n parts.push(\n `pending: ${formatAmountSafe(pending.amount, pending.currency)} (${pending.amount} ${pending.currency})`,\n );\n }\n return {\n name: 'Stripe API auth',\n ok: true,\n detail: parts.join(' · '),\n };\n } catch (error) {\n return {\n name: 'Stripe API auth',\n ok: false,\n detail: formatStripeError(error).split('\\n')[0] ?? 'unknown error',\n };\n } finally {\n // The doctor may be run before/after the server in the same process; drop\n // the cached client so a key change between runs is picked up.\n resetStripeClient();\n }\n}\n\n/** Check 4: tool catalogue loads + count matches expectation. */\nfunction checkToolCatalogue(): CheckResult {\n const expected = 79;\n if (TOOL_COUNT >= expected && allTools.length === TOOL_COUNT) {\n return {\n name: 'Tool catalogue',\n ok: true,\n detail: `${TOOL_COUNT} tools loaded across 19 categories.`,\n };\n }\n return {\n name: 'Tool catalogue',\n ok: false,\n detail: `expected ≥${expected} tools, found ${TOOL_COUNT}. The build may be corrupted — reinstall stripe-mcp.`,\n };\n}\n\n/** Check 5: Node.js version meets the >=20 engines requirement. */\nfunction checkNodeVersion(): CheckResult {\n const major = Number.parseInt(process.versions.node.split('.')[0] ?? '0', 10);\n if (major >= 20) {\n return {\n name: 'Node.js version',\n ok: true,\n detail: `v${process.versions.node} (meets >=20 requirement).`,\n };\n }\n return {\n name: 'Node.js version',\n ok: false,\n detail: `v${process.versions.node} — stripe-mcp requires Node.js >=20. Upgrade at https://nodejs.org/`,\n };\n}\n\n/** Format a Stripe amount safely (defensive — currency may be missing). */\nfunction formatAmountSafe(amount: number, currency: string): string {\n // Lazy import to avoid a circular dep at module load; currency.ts is pure.\n // We inline a tiny formatter here to keep the doctor self-contained.\n const zeroDecimal = new Set([\n 'bif', 'clp', 'djf', 'gnf', 'jpy', 'kmf', 'krw', 'mga',\n 'pyg', 'rwf', 'ugx', 'vnd', 'vuv', 'xaf', 'xof', 'xpf',\n ]);\n const c = (currency || 'usd').toLowerCase();\n if (zeroDecimal.has(c)) return `${amount} ${c.toUpperCase()}`;\n return `${(amount / 100).toFixed(2)} ${c.toUpperCase()}`;\n}\n\nconst VERSION = '1.0.0';\n","import { allTools, TOOL_COUNT } from './tools/index.js';\nimport { config } from './config.js';\nimport { runDoctor } from './doctor.js';\n\n/**\n * Lightweight CLI argument handling for stripe-mcp.\n *\n * Supported flags:\n * -h, --help Print usage and exit.\n * -v, --version Print package version and exit.\n * --list-tools Print every registered tool (name + description) as\n * JSON to stdout and exit. Useful for IDE integrations,\n * debugging, and generating docs.\n * --list-categories Print the distinct tool categories with counts as\n * JSON and exit.\n * --doctor Run a health check: verifies STRIPE_SECRET_KEY,\n * authenticates against Stripe, prints account info,\n * and checks the tool catalogue + Node version.\n * Prints to stderr; exits 0 on success, 1 on failure.\n * (no args) Run the MCP server over stdio (default behaviour).\n *\n * Returns `true` if a CLI flag was handled (and the process should exit),\n * `false` if the caller should proceed to start the server.\n *\n * The MCP protocol speaks JSON-RPC over stdio, so we write CLI output to\n * stdout for machine-readable flags (--list-tools, --list-categories) and to\n * stderr for human-readable help/version/doctor — this keeps the stdio\n * transport clean when the server runs.\n */\nexport async function handleCliArgs(argv: string[]): Promise<boolean> {\n const args = argv.slice(2);\n\n if (args.length === 0) {\n return false;\n }\n\n const has = (flag: string, ...aliases: string[]): boolean =>\n args.includes(flag) || aliases.some((a) => args.includes(a));\n\n if (has('--help', '-h')) {\n process.stderr.write(HELP_TEXT);\n return true;\n }\n\n if (has('--version', '-v')) {\n process.stderr.write(`stripe-mcp ${VERSION}\\n`);\n return true;\n }\n\n if (has('--list-tools')) {\n const payload = allTools.map((t) => ({\n name: t.definition.name,\n description: t.definition.description ?? '',\n }));\n process.stdout.write(`${JSON.stringify(payload, null, 2)}\\n`);\n return true;\n }\n\n if (has('--list-categories')) {\n const counts = new Map<string, number>();\n for (const t of allTools) {\n const name = t.definition.name;\n const category = KNOWN_CATEGORIES.find((c) =>\n name.startsWith(`stripe_${c.replace(/-/g, '_')}_`),\n );\n counts.set(category ?? 'unknown', (counts.get(category ?? 'unknown') ?? 0) + 1);\n }\n const payload = Array.from(counts.entries())\n .filter(([category]) => category !== 'unknown')\n .map(([category, count]) => ({ category, count }))\n .sort((a, b) => a.category.localeCompare(b.category));\n process.stdout.write(`${JSON.stringify({ total: TOOL_COUNT, categories: payload }, null, 2)}\\n`);\n return true;\n }\n\n if (has('--doctor')) {\n const allOk = await runDoctor();\n // The caller (index.ts main) will exit 0 on return; signal failure via\n // process.exitCode so any pending I/O flushes first.\n if (!allOk) process.exitCode = 1;\n return true;\n }\n\n // Unknown flag — warn on stderr but don't crash; fall through to server.\n process.stderr.write(`stripe-mcp: unknown argument(s): ${args.join(' ')}\\n`);\n process.stderr.write(`Run 'stripe-mcp --help' for usage.\\n`);\n return false;\n}\n\nconst VERSION = '1.0.0';\n\n/**\n * The 19 tool categories in display (hyphenated) form. Sorted longest-first\n * so prefix matching is unambiguous (defensive — current names are disjoint).\n * Used by --list-categories to bucket tools without relying on underscore\n * splitting (which breaks on multi-word actions like `get_mrr`).\n */\nconst KNOWN_CATEGORIES = [\n 'billing-portal',\n 'promotion-codes',\n 'payment-intents',\n 'payment-links',\n 'subscriptions',\n 'customers',\n 'products',\n 'invoices',\n 'refunds',\n 'disputes',\n 'webhooks',\n 'coupons',\n 'checkout',\n 'balance',\n 'payouts',\n 'meters',\n 'prices',\n 'analytics',\n 'tax',\n].sort((a, b) => b.length - a.length);\n\nconst HELP_TEXT = `stripe-mcp ${VERSION} — The most complete MCP server for Stripe.\n\nUSAGE\n stripe-mcp Run the MCP server over stdio (default).\n stripe-mcp <flag> Run a CLI command instead of the server.\n\nFLAGS\n -h, --help Show this help message and exit.\n -v, --version Print the version and exit.\n --list-tools Print all ${TOOL_COUNT} registered tools\n (name + description) as JSON to stdout.\n --list-categories Print tool categories with counts as JSON.\n --doctor Run a health check: verifies your Stripe key,\n authenticates, prints account info, and checks\n the tool catalogue + Node version. Exits 1 on\n failure. Great for debugging install issues.\n\nENVIRONMENT\n STRIPE_SECRET_KEY Required. sk_test_... (test) or sk_live_... (live).\n Get one at https://dashboard.stripe.com/apikeys\n\nCONFIGURATION\n Add to your MCP client config (e.g. claude_desktop_config.json):\n {\n \"mcpServers\": {\n \"stripe\": {\n \"command\": \"stripe-mcp\",\n \"env\": { \"STRIPE_SECRET_KEY\": \"sk_test_...\" }\n }\n }\n }\n\nMODE\n Current key prefix: ${config.stripeMode === 'live' ? 'sk_live_ (LIVE — real money)' : 'sk_test_ (test — safe)'}\n\nDOCS\n README https://github.com/guillaumeCode2012/stripe-mcp#readme\n Stripe https://stripe.com/docs/api\n MCP https://modelcontextprotocol.io\n\nstripe-mcp is MIT licensed.\n`;\n"],"mappings":";;;AAAA,SAAS,4BAA4B;;;ACArC,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,SAAS;;;ACAlB,OAAO,YAAY;AAEnB,IAAI,eAA8B;AAS3B,SAAS,kBAA0B;AACxC,MAAI,CAAC,cAAc;AACjB,UAAM,SAAS,QAAQ,IAAI;AAC3B,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAQA,mBAAe,IAAI,OAAO,QAAQ;AAAA,MAChC,SAAS,EAAE,MAAM,cAAc,SAAS,QAAQ;AAAA,MAChD,YAAY;AAAA,IACd,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAGO,SAAS,oBAA0B;AACxC,iBAAe;AACjB;AAEO,IAAM,SAAS;AAAA,EACpB,YAAY,QAAQ,IAAI,mBAAmB,WAAW,UAAU,IAAI,SAAS;AAC/E;;;AC7BO,SAAS,kBAAkB,OAAwB;AAGxD,QAAM,cAAc;AASpB,MAAI,CAAC,eAAe,OAAO,gBAAgB,UAAU;AACnD,WAAO,kBAAkB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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAwB5B,OAAO,eAAe,SAAS,sCAAiC,6BAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;A5GnJhH,eAAe,OAAsB;AAGnC,MAAI,MAAM,cAAc,QAAQ,IAAI,GAAG;AACrC;AAAA,EACF;AAEA,MAAI,OAAO,eAAe,QAAQ;AAChC,YAAQ,MAAM,2EAA4D;AAAA,EAC5E,OAAO;AACL,YAAQ,MAAM,qCAAgC;AAAA,EAChD;AAEA,QAAM,SAAS,aAAa;AAC5B,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAC9B,UAAQ,MAAM,6BAA6B;AAC7C;AAEA,KAAK,EAAE,MAAM,CAAC,UAAU;AACtB,UAAQ,MAAM,oCAAoC,KAAK;AACvD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","z","inputSchema","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","z","major","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","y","m","toolDefinition","z","inputSchema","z","toolDefinition","z","inputSchema","z","toolDefinition","tools","toolDefinition","tools","VERSION"]}