chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:20:55 +08:00
commit d25d482dc2
13754 changed files with 4996608 additions and 0 deletions
@@ -0,0 +1,82 @@
import type { CancelPaymentIntentParams, PaymentIntentResponse } from '@/tools/stripe/types'
import {
PAYMENT_INTENT_METADATA_OUTPUT_PROPERTIES,
PAYMENT_INTENT_OUTPUT,
} from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeCancelPaymentIntentTool: ToolConfig<
CancelPaymentIntentParams,
PaymentIntentResponse
> = {
id: 'stripe_cancel_payment_intent',
name: 'Stripe Cancel Payment Intent',
description: 'Cancel a Payment Intent',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Payment Intent ID (e.g., pi_1234567890)',
},
cancellation_reason: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Reason for cancellation (duplicate, fraudulent, requested_by_customer, abandoned)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/payment_intents/${params.id}/cancel`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.cancellation_reason) {
formData.append('cancellation_reason', params.cancellation_reason)
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
payment_intent: data,
metadata: {
id: data.id,
status: data.status,
amount: data.amount,
currency: data.currency,
},
},
}
},
outputs: {
payment_intent: {
...PAYMENT_INTENT_OUTPUT,
description: 'The canceled Payment Intent object',
},
metadata: {
type: 'json',
description: 'Payment Intent metadata including ID, status, amount, and currency',
properties: PAYMENT_INTENT_METADATA_OUTPUT_PROPERTIES,
},
},
}
@@ -0,0 +1,88 @@
import type { CancelSubscriptionParams, SubscriptionResponse } from '@/tools/stripe/types'
import { SUBSCRIPTION_METADATA_OUTPUT_PROPERTIES, SUBSCRIPTION_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeCancelSubscriptionTool: ToolConfig<
CancelSubscriptionParams,
SubscriptionResponse
> = {
id: 'stripe_cancel_subscription',
name: 'Stripe Cancel Subscription',
description: 'Cancel a subscription',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Subscription ID (e.g., sub_1234567890)',
},
prorate: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Whether to prorate the cancellation',
},
invoice_now: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Whether to invoice immediately',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/subscriptions/${params.id}`,
method: 'DELETE',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.prorate !== undefined) {
formData.append('prorate', String(params.prorate))
}
if (params.invoice_now !== undefined) {
formData.append('invoice_now', String(params.invoice_now))
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
subscription: data,
metadata: {
id: data.id,
status: data.status,
customer: data.customer,
},
},
}
},
outputs: {
subscription: {
...SUBSCRIPTION_OUTPUT,
description: 'The canceled subscription object',
},
metadata: {
type: 'json',
description: 'Subscription metadata including ID, status, and customer',
properties: SUBSCRIPTION_METADATA_OUTPUT_PROPERTIES,
},
},
}
+82
View File
@@ -0,0 +1,82 @@
import type { CaptureChargeParams, ChargeResponse } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeCaptureChargeTool: ToolConfig<CaptureChargeParams, ChargeResponse> = {
id: 'stripe_capture_charge',
name: 'Stripe Capture Charge',
description: 'Capture an uncaptured charge',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Charge ID (e.g., ch_1234567890)',
},
amount: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Amount to capture in cents (defaults to full amount)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/charges/${params.id}/capture`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.amount) {
formData.append('amount', Number(params.amount).toString())
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
charge: data,
metadata: {
id: data.id,
status: data.status,
amount: data.amount,
currency: data.currency,
paid: data.paid,
},
},
}
},
outputs: {
charge: {
type: 'json',
description: 'The captured Charge object',
},
metadata: {
type: 'json',
description: 'Charge metadata including ID, status, amount, currency, and paid status',
properties: {
id: { type: 'string', description: 'Stripe unique identifier' },
status: { type: 'string', description: 'Current state of the resource' },
amount: { type: 'number', description: 'Amount in smallest currency unit (e.g., cents)' },
currency: { type: 'string', description: 'Three-letter ISO currency code (lowercase)' },
paid: { type: 'boolean', description: 'Whether payment has been received' },
},
},
},
}
@@ -0,0 +1,81 @@
import type { CapturePaymentIntentParams, PaymentIntentResponse } from '@/tools/stripe/types'
import {
PAYMENT_INTENT_METADATA_OUTPUT_PROPERTIES,
PAYMENT_INTENT_OUTPUT,
} from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeCapturePaymentIntentTool: ToolConfig<
CapturePaymentIntentParams,
PaymentIntentResponse
> = {
id: 'stripe_capture_payment_intent',
name: 'Stripe Capture Payment Intent',
description: 'Capture an authorized Payment Intent',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Payment Intent ID (e.g., pi_1234567890)',
},
amount_to_capture: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Amount to capture in cents (defaults to full amount)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/payment_intents/${params.id}/capture`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.amount_to_capture) {
formData.append('amount_to_capture', Number(params.amount_to_capture).toString())
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
payment_intent: data,
metadata: {
id: data.id,
status: data.status,
amount: data.amount,
currency: data.currency,
},
},
}
},
outputs: {
payment_intent: {
...PAYMENT_INTENT_OUTPUT,
description: 'The captured Payment Intent object',
},
metadata: {
type: 'json',
description: 'Payment Intent metadata including ID, status, amount, and currency',
properties: PAYMENT_INTENT_METADATA_OUTPUT_PROPERTIES,
},
},
}
@@ -0,0 +1,79 @@
import type { ConfirmPaymentIntentParams, PaymentIntentResponse } from '@/tools/stripe/types'
import {
PAYMENT_INTENT_METADATA_OUTPUT_PROPERTIES,
PAYMENT_INTENT_OUTPUT,
} from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeConfirmPaymentIntentTool: ToolConfig<
ConfirmPaymentIntentParams,
PaymentIntentResponse
> = {
id: 'stripe_confirm_payment_intent',
name: 'Stripe Confirm Payment Intent',
description: 'Confirm a Payment Intent to complete the payment',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Payment Intent ID (e.g., pi_1234567890)',
},
payment_method: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Payment method ID to confirm with',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/payment_intents/${params.id}/confirm`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.payment_method) formData.append('payment_method', params.payment_method)
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
payment_intent: data,
metadata: {
id: data.id,
status: data.status,
amount: data.amount,
currency: data.currency,
},
},
}
},
outputs: {
payment_intent: {
...PAYMENT_INTENT_OUTPUT,
description: 'The confirmed Payment Intent object',
},
metadata: {
type: 'json',
description: 'Payment Intent metadata including ID, status, amount, and currency',
properties: PAYMENT_INTENT_METADATA_OUTPUT_PROPERTIES,
},
},
}
+122
View File
@@ -0,0 +1,122 @@
import type { ChargeResponse, CreateChargeParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeCreateChargeTool: ToolConfig<CreateChargeParams, ChargeResponse> = {
id: 'stripe_create_charge',
name: 'Stripe Create Charge',
description: 'Create a new charge to process a payment',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
amount: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Amount in cents (e.g., 2000 for $20.00)',
},
currency: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Three-letter ISO currency code (e.g., usd, eur)',
},
customer: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Customer ID to associate with this charge',
},
source: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Payment source ID (e.g., card token or saved card ID)',
},
description: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Description of the charge',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Set of key-value pairs for storing additional information',
},
capture: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Whether to immediately capture the charge (defaults to true)',
},
},
request: {
url: () => 'https://api.stripe.com/v1/charges',
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
formData.append('amount', Number(params.amount).toString())
formData.append('currency', params.currency)
if (params.customer) formData.append('customer', params.customer)
if (params.source) formData.append('source', params.source)
if (params.description) formData.append('description', params.description)
if (params.capture !== undefined) formData.append('capture', String(params.capture))
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
charge: data,
metadata: {
id: data.id,
status: data.status,
amount: data.amount,
currency: data.currency,
paid: data.paid,
},
},
}
},
outputs: {
charge: {
type: 'json',
description: 'The created Charge object',
},
metadata: {
type: 'json',
description: 'Charge metadata including ID, status, amount, currency, and paid status',
properties: {
id: { type: 'string', description: 'Stripe unique identifier' },
status: { type: 'string', description: 'Current state of the resource' },
amount: { type: 'number', description: 'Amount in smallest currency unit (e.g., cents)' },
currency: { type: 'string', description: 'Three-letter ISO currency code (lowercase)' },
paid: { type: 'boolean', description: 'Whether payment has been received' },
},
},
},
}
+120
View File
@@ -0,0 +1,120 @@
import type { CreateCustomerParams, CustomerResponse } from '@/tools/stripe/types'
import { CUSTOMER_METADATA_OUTPUT_PROPERTIES, CUSTOMER_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeCreateCustomerTool: ToolConfig<CreateCustomerParams, CustomerResponse> = {
id: 'stripe_create_customer',
name: 'Stripe Create Customer',
description: 'Create a new customer object',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
email: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Customer email address',
},
name: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Customer full name',
},
phone: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Customer phone number',
},
description: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Description of the customer',
},
address: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Customer address object',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Set of key-value pairs',
},
payment_method: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Payment method ID to attach',
},
},
request: {
url: () => 'https://api.stripe.com/v1/customers',
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.email) formData.append('email', params.email)
if (params.name) formData.append('name', params.name)
if (params.phone) formData.append('phone', params.phone)
if (params.description) formData.append('description', params.description)
if (params.payment_method) formData.append('payment_method', params.payment_method)
if (params.address) {
Object.entries(params.address).forEach(([key, value]) => {
if (value) formData.append(`address[${key}]`, String(value))
})
}
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
customer: data,
metadata: {
id: data.id,
email: data.email ?? null,
name: data.name ?? null,
},
},
}
},
outputs: {
customer: {
...CUSTOMER_OUTPUT,
description: 'The created customer object',
},
metadata: {
type: 'json',
description: 'Customer metadata',
properties: CUSTOMER_METADATA_OUTPUT_PROPERTIES,
},
},
}
+104
View File
@@ -0,0 +1,104 @@
import type { CreateInvoiceParams, InvoiceResponse } from '@/tools/stripe/types'
import { INVOICE_METADATA_OUTPUT_PROPERTIES, INVOICE_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeCreateInvoiceTool: ToolConfig<CreateInvoiceParams, InvoiceResponse> = {
id: 'stripe_create_invoice',
name: 'Stripe Create Invoice',
description: 'Create a new invoice',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
customer: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Customer ID (e.g., cus_1234567890)',
},
description: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Description of the invoice',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Set of key-value pairs',
},
auto_advance: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Auto-finalize the invoice',
},
collection_method: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Collection method: charge_automatically or send_invoice',
},
},
request: {
url: () => 'https://api.stripe.com/v1/invoices',
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
formData.append('customer', params.customer)
if (params.description) formData.append('description', params.description)
if (params.auto_advance !== undefined) {
formData.append('auto_advance', String(params.auto_advance))
}
if (params.collection_method) formData.append('collection_method', params.collection_method)
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
invoice: data,
metadata: {
id: data.id,
status: data.status,
amount_due: data.amount_due,
currency: data.currency,
},
},
}
},
outputs: {
invoice: {
...INVOICE_OUTPUT,
description: 'The created invoice object',
},
metadata: {
type: 'json',
description: 'Invoice metadata',
properties: INVOICE_METADATA_OUTPUT_PROPERTIES,
},
},
}
@@ -0,0 +1,133 @@
import type { CreatePaymentIntentParams, PaymentIntentResponse } from '@/tools/stripe/types'
import {
PAYMENT_INTENT_METADATA_OUTPUT_PROPERTIES,
PAYMENT_INTENT_OUTPUT,
} from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeCreatePaymentIntentTool: ToolConfig<
CreatePaymentIntentParams,
PaymentIntentResponse
> = {
id: 'stripe_create_payment_intent',
name: 'Stripe Create Payment Intent',
description: 'Create a new Payment Intent to process a payment',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
amount: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Amount in cents (e.g., 2000 for $20.00)',
},
currency: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Three-letter ISO currency code (e.g., usd, eur)',
},
customer: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Customer ID to associate with this payment',
},
payment_method: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Payment method ID',
},
description: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Description of the payment',
},
receipt_email: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Email address to send receipt to',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Set of key-value pairs for storing additional information',
},
automatic_payment_methods: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Enable automatic payment methods (e.g., {"enabled": true})',
},
},
request: {
url: () => 'https://api.stripe.com/v1/payment_intents',
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
formData.append('amount', Number(params.amount).toString())
formData.append('currency', params.currency)
if (params.customer) formData.append('customer', params.customer)
if (params.payment_method) formData.append('payment_method', params.payment_method)
if (params.description) formData.append('description', params.description)
if (params.receipt_email) formData.append('receipt_email', params.receipt_email)
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
if (params.automatic_payment_methods?.enabled) {
formData.append('automatic_payment_methods[enabled]', 'true')
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
payment_intent: data,
metadata: {
id: data.id,
status: data.status,
amount: data.amount,
currency: data.currency,
},
},
}
},
outputs: {
payment_intent: {
...PAYMENT_INTENT_OUTPUT,
description: 'The created Payment Intent object',
},
metadata: {
type: 'json',
description: 'Payment Intent metadata including ID, status, amount, and currency',
properties: PAYMENT_INTENT_METADATA_OUTPUT_PROPERTIES,
},
},
}
+124
View File
@@ -0,0 +1,124 @@
import type { CreatePriceParams, PriceResponse } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeCreatePriceTool: ToolConfig<CreatePriceParams, PriceResponse> = {
id: 'stripe_create_price',
name: 'Stripe Create Price',
description: 'Create a new price for a product',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
product: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Product ID (e.g., prod_1234567890)',
},
currency: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Three-letter ISO currency code (e.g., usd, eur)',
},
unit_amount: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Amount in cents (e.g., 1000 for $10.00)',
},
recurring: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Recurring billing configuration (interval: day/week/month/year)',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Set of key-value pairs',
},
billing_scheme: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Billing scheme (per_unit or tiered)',
},
},
request: {
url: () => 'https://api.stripe.com/v1/prices',
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
formData.append('product', params.product)
formData.append('currency', params.currency)
if (params.unit_amount !== undefined)
formData.append('unit_amount', Number(params.unit_amount).toString())
if (params.billing_scheme) formData.append('billing_scheme', params.billing_scheme)
if (params.recurring) {
Object.entries(params.recurring).forEach(([key, value]) => {
if (value) formData.append(`recurring[${key}]`, String(value))
})
}
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
price: data,
metadata: {
id: data.id,
product: data.product,
unit_amount: data.unit_amount ?? null,
currency: data.currency,
},
},
}
},
outputs: {
price: {
type: 'json',
description: 'The created price object',
},
metadata: {
type: 'json',
description: 'Price metadata',
properties: {
id: { type: 'string', description: 'Stripe unique identifier' },
product: { type: 'string', description: 'Associated product ID' },
unit_amount: {
type: 'number',
description: 'Amount in smallest currency unit (e.g., cents)',
optional: true,
},
currency: { type: 'string', description: 'Three-letter ISO currency code (lowercase)' },
},
},
},
}
+109
View File
@@ -0,0 +1,109 @@
import type { CreateProductParams, ProductResponse } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeCreateProductTool: ToolConfig<CreateProductParams, ProductResponse> = {
id: 'stripe_create_product',
name: 'Stripe Create Product',
description: 'Create a new product object',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
name: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Product name',
},
description: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Product description',
},
active: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Whether the product is active',
},
images: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Array of image URLs for the product',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Set of key-value pairs',
},
},
request: {
url: () => 'https://api.stripe.com/v1/products',
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
formData.append('name', params.name)
if (params.description) formData.append('description', params.description)
if (params.active !== undefined) formData.append('active', String(params.active))
if (params.images) {
params.images.forEach((image: string, index: number) => {
formData.append(`images[${index}]`, image)
})
}
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
product: data,
metadata: {
id: data.id,
name: data.name,
active: data.active,
},
},
}
},
outputs: {
product: {
type: 'json',
description: 'The created product object',
},
metadata: {
type: 'json',
description: 'Product metadata',
properties: {
id: { type: 'string', description: 'Stripe unique identifier' },
name: { type: 'string', description: 'Display name' },
active: { type: 'boolean', description: 'Whether the resource is currently active' },
},
},
},
}
@@ -0,0 +1,126 @@
import type { CreateSubscriptionParams, SubscriptionResponse } from '@/tools/stripe/types'
import { SUBSCRIPTION_METADATA_OUTPUT_PROPERTIES, SUBSCRIPTION_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeCreateSubscriptionTool: ToolConfig<
CreateSubscriptionParams,
SubscriptionResponse
> = {
id: 'stripe_create_subscription',
name: 'Stripe Create Subscription',
description: 'Create a new subscription for a customer',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
customer: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Customer ID to subscribe',
},
items: {
type: 'json',
required: true,
visibility: 'user-or-llm',
description: 'Array of items with price IDs (e.g., [{"price": "price_xxx", "quantity": 1}])',
},
trial_period_days: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of trial days',
},
default_payment_method: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Payment method ID',
},
cancel_at_period_end: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Cancel subscription at period end',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Set of key-value pairs for storing additional information',
},
},
request: {
url: () => 'https://api.stripe.com/v1/subscriptions',
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
formData.append('customer', params.customer)
if (params.items && Array.isArray(params.items)) {
params.items.forEach((item, index) => {
formData.append(`items[${index}][price]`, item.price)
if (item.quantity) {
formData.append(`items[${index}][quantity]`, Number(item.quantity).toString())
}
})
}
if (params.trial_period_days !== undefined) {
formData.append('trial_period_days', Number(params.trial_period_days).toString())
}
if (params.default_payment_method) {
formData.append('default_payment_method', params.default_payment_method)
}
if (params.cancel_at_period_end !== undefined) {
formData.append('cancel_at_period_end', String(params.cancel_at_period_end))
}
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
subscription: data,
metadata: {
id: data.id,
status: data.status,
customer: data.customer,
},
},
}
},
outputs: {
subscription: {
...SUBSCRIPTION_OUTPUT,
description: 'The created subscription object',
},
metadata: {
type: 'json',
description: 'Subscription metadata including ID, status, and customer',
properties: SUBSCRIPTION_METADATA_OUTPUT_PROPERTIES,
},
},
}
+50
View File
@@ -0,0 +1,50 @@
import type { CustomerDeleteResponse, DeleteCustomerParams } from '@/tools/stripe/types'
import { DELETE_OUTPUT_PROPERTIES } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeDeleteCustomerTool: ToolConfig<DeleteCustomerParams, CustomerDeleteResponse> = {
id: 'stripe_delete_customer',
name: 'Stripe Delete Customer',
description: 'Permanently delete a customer',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Customer ID (e.g., cus_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/customers/${params.id}`,
method: 'DELETE',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
deleted: data.deleted,
id: data.id,
},
}
},
outputs: {
deleted: DELETE_OUTPUT_PROPERTIES.deleted,
id: DELETE_OUTPUT_PROPERTIES.id,
},
}
+55
View File
@@ -0,0 +1,55 @@
import type { DeleteInvoiceParams, InvoiceDeleteResponse } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeDeleteInvoiceTool: ToolConfig<DeleteInvoiceParams, InvoiceDeleteResponse> = {
id: 'stripe_delete_invoice',
name: 'Stripe Delete Invoice',
description: 'Permanently delete a draft invoice',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Invoice ID (e.g., in_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/invoices/${params.id}`,
method: 'DELETE',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
deleted: data.deleted,
id: data.id,
},
}
},
outputs: {
deleted: {
type: 'boolean',
description: 'Whether the invoice was deleted',
},
id: {
type: 'string',
description: 'The ID of the deleted invoice',
},
},
}
+55
View File
@@ -0,0 +1,55 @@
import type { DeleteProductParams, ProductDeleteResponse } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeDeleteProductTool: ToolConfig<DeleteProductParams, ProductDeleteResponse> = {
id: 'stripe_delete_product',
name: 'Stripe Delete Product',
description: 'Permanently delete a product',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Product ID (e.g., prod_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/products/${params.id}`,
method: 'DELETE',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
deleted: data.deleted,
id: data.id,
},
}
},
outputs: {
deleted: {
type: 'boolean',
description: 'Whether the product was deleted',
},
id: {
type: 'string',
description: 'The ID of the deleted product',
},
},
}
+77
View File
@@ -0,0 +1,77 @@
import type { FinalizeInvoiceParams, InvoiceResponse } from '@/tools/stripe/types'
import { INVOICE_METADATA_OUTPUT_PROPERTIES, INVOICE_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeFinalizeInvoiceTool: ToolConfig<FinalizeInvoiceParams, InvoiceResponse> = {
id: 'stripe_finalize_invoice',
name: 'Stripe Finalize Invoice',
description: 'Finalize a draft invoice',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Invoice ID (e.g., in_1234567890)',
},
auto_advance: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Auto-advance the invoice',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/invoices/${params.id}/finalize`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.auto_advance !== undefined) {
formData.append('auto_advance', String(params.auto_advance))
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
invoice: data,
metadata: {
id: data.id,
status: data.status,
amount_due: data.amount_due,
currency: data.currency,
},
},
}
},
outputs: {
invoice: {
...INVOICE_OUTPUT,
description: 'The finalized invoice object',
},
metadata: {
type: 'json',
description: 'Invoice metadata',
properties: INVOICE_METADATA_OUTPUT_PROPERTIES,
},
},
}
+51
View File
@@ -0,0 +1,51 @@
export { stripeCancelPaymentIntentTool } from './cancel_payment_intent'
export { stripeCancelSubscriptionTool } from './cancel_subscription'
export { stripeCaptureChargeTool } from './capture_charge'
export { stripeCapturePaymentIntentTool } from './capture_payment_intent'
export { stripeConfirmPaymentIntentTool } from './confirm_payment_intent'
export { stripeCreateChargeTool } from './create_charge'
export { stripeCreateCustomerTool } from './create_customer'
export { stripeCreateInvoiceTool } from './create_invoice'
export { stripeCreatePaymentIntentTool } from './create_payment_intent'
export { stripeCreatePriceTool } from './create_price'
export { stripeCreateProductTool } from './create_product'
export { stripeCreateSubscriptionTool } from './create_subscription'
export { stripeDeleteCustomerTool } from './delete_customer'
export { stripeDeleteInvoiceTool } from './delete_invoice'
export { stripeDeleteProductTool } from './delete_product'
export { stripeFinalizeInvoiceTool } from './finalize_invoice'
export { stripeListChargesTool } from './list_charges'
export { stripeListCustomersTool } from './list_customers'
export { stripeListEventsTool } from './list_events'
export { stripeListInvoicesTool } from './list_invoices'
export { stripeListPaymentIntentsTool } from './list_payment_intents'
export { stripeListPricesTool } from './list_prices'
export { stripeListProductsTool } from './list_products'
export { stripeListSubscriptionsTool } from './list_subscriptions'
export { stripePayInvoiceTool } from './pay_invoice'
export { stripeResumeSubscriptionTool } from './resume_subscription'
export { stripeRetrieveChargeTool } from './retrieve_charge'
export { stripeRetrieveCustomerTool } from './retrieve_customer'
export { stripeRetrieveEventTool } from './retrieve_event'
export { stripeRetrieveInvoiceTool } from './retrieve_invoice'
export { stripeRetrievePaymentIntentTool } from './retrieve_payment_intent'
export { stripeRetrievePriceTool } from './retrieve_price'
export { stripeRetrieveProductTool } from './retrieve_product'
export { stripeRetrieveSubscriptionTool } from './retrieve_subscription'
export { stripeSearchChargesTool } from './search_charges'
export { stripeSearchCustomersTool } from './search_customers'
export { stripeSearchInvoicesTool } from './search_invoices'
export { stripeSearchPaymentIntentsTool } from './search_payment_intents'
export { stripeSearchPricesTool } from './search_prices'
export { stripeSearchProductsTool } from './search_products'
export { stripeSearchSubscriptionsTool } from './search_subscriptions'
export { stripeSendInvoiceTool } from './send_invoice'
export * from './types'
export { stripeUpdateChargeTool } from './update_charge'
export { stripeUpdateCustomerTool } from './update_customer'
export { stripeUpdateInvoiceTool } from './update_invoice'
export { stripeUpdatePaymentIntentTool } from './update_payment_intent'
export { stripeUpdatePriceTool } from './update_price'
export { stripeUpdateProductTool } from './update_product'
export { stripeUpdateSubscriptionTool } from './update_subscription'
export { stripeVoidInvoiceTool } from './void_invoice'
+84
View File
@@ -0,0 +1,84 @@
import type { ChargeListResponse, ListChargesParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeListChargesTool: ToolConfig<ListChargesParams, ChargeListResponse> = {
id: 'stripe_list_charges',
name: 'Stripe List Charges',
description: 'List all charges',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
customer: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by customer ID',
},
created: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Filter by creation date (e.g., {"gt": 1633024800})',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/charges')
if (params.limit) url.searchParams.append('limit', params.limit.toString())
if (params.customer) url.searchParams.append('customer', params.customer)
if (params.created) {
Object.entries(params.created).forEach(([key, value]) => {
url.searchParams.append(`created[${key}]`, String(value))
})
}
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
charges: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
charges: {
type: 'json',
description: 'Array of Charge objects',
},
metadata: {
type: 'json',
description: 'List metadata including count and has_more',
properties: {
count: { type: 'number', description: 'Number of items returned' },
has_more: { type: 'boolean', description: 'Whether more items exist beyond this page' },
},
},
},
}
+83
View File
@@ -0,0 +1,83 @@
import type { CustomerListResponse, ListCustomersParams } from '@/tools/stripe/types'
import { CUSTOMER_OUTPUT, LIST_METADATA_OUTPUT_PROPERTIES } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeListCustomersTool: ToolConfig<ListCustomersParams, CustomerListResponse> = {
id: 'stripe_list_customers',
name: 'Stripe List Customers',
description: 'List all customers',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
email: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by email address',
},
created: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Filter by creation date',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/customers')
if (params.limit) url.searchParams.append('limit', params.limit.toString())
if (params.email) url.searchParams.append('email', params.email)
if (params.created) {
Object.entries(params.created).forEach(([key, value]) => {
url.searchParams.append(`created[${key}]`, String(value))
})
}
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
customers: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
customers: {
type: 'array',
description: 'Array of customer objects',
items: CUSTOMER_OUTPUT,
},
metadata: {
type: 'json',
description: 'List metadata',
properties: LIST_METADATA_OUTPUT_PROPERTIES,
},
},
}
+85
View File
@@ -0,0 +1,85 @@
import type { EventListResponse, ListEventsParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeListEventsTool: ToolConfig<ListEventsParams, EventListResponse> = {
id: 'stripe_list_events',
name: 'Stripe List Events',
description: 'List all Events',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
type: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by event type (e.g., payment_intent.created)',
},
created: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Filter by creation date (e.g., {"gt": 1633024800})',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/events')
if (params.limit) url.searchParams.append('limit', params.limit.toString())
if (params.type) url.searchParams.append('type', params.type)
if (params.created) {
Object.entries(params.created).forEach(([key, value]) => {
url.searchParams.append(`created[${key}]`, String(value))
})
}
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
events: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
events: {
type: 'json',
description: 'Array of Event objects',
},
metadata: {
type: 'json',
description: 'List metadata including count and has_more',
properties: {
count: { type: 'number', description: 'Number of items returned' },
has_more: { type: 'boolean', description: 'Whether more items exist beyond this page' },
},
},
},
}
+81
View File
@@ -0,0 +1,81 @@
import type { InvoiceListResponse, ListInvoicesParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeListInvoicesTool: ToolConfig<ListInvoicesParams, InvoiceListResponse> = {
id: 'stripe_list_invoices',
name: 'Stripe List Invoices',
description: 'List all invoices',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
customer: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by customer ID',
},
status: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by invoice status',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/invoices')
if (params.limit) url.searchParams.append('limit', params.limit.toString())
if (params.customer) url.searchParams.append('customer', params.customer)
if (params.status) url.searchParams.append('status', params.status)
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
invoices: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
invoices: {
type: 'json',
description: 'Array of invoice objects',
},
metadata: {
type: 'json',
description: 'List metadata',
properties: {
count: { type: 'number', description: 'Number of items returned' },
has_more: { type: 'boolean', description: 'Whether more items exist beyond this page' },
},
},
},
}
@@ -0,0 +1,86 @@
import type { ListPaymentIntentsParams, PaymentIntentListResponse } from '@/tools/stripe/types'
import { LIST_METADATA_OUTPUT_PROPERTIES, PAYMENT_INTENT_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeListPaymentIntentsTool: ToolConfig<
ListPaymentIntentsParams,
PaymentIntentListResponse
> = {
id: 'stripe_list_payment_intents',
name: 'Stripe List Payment Intents',
description: 'List all Payment Intents',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
customer: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by customer ID',
},
created: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Filter by creation date (e.g., {"gt": 1633024800})',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/payment_intents')
if (params.limit) url.searchParams.append('limit', params.limit.toString())
if (params.customer) url.searchParams.append('customer', params.customer)
if (params.created) {
Object.entries(params.created).forEach(([key, value]) => {
url.searchParams.append(`created[${key}]`, String(value))
})
}
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
payment_intents: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
payment_intents: {
type: 'array',
description: 'Array of Payment Intent objects',
items: PAYMENT_INTENT_OUTPUT,
},
metadata: {
type: 'json',
description: 'List metadata including count and has_more',
properties: LIST_METADATA_OUTPUT_PROPERTIES,
},
},
}
+81
View File
@@ -0,0 +1,81 @@
import type { ListPricesParams, PriceListResponse } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeListPricesTool: ToolConfig<ListPricesParams, PriceListResponse> = {
id: 'stripe_list_prices',
name: 'Stripe List Prices',
description: 'List all prices',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
product: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by product ID',
},
active: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Filter by active status',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/prices')
if (params.limit) url.searchParams.append('limit', params.limit.toString())
if (params.product) url.searchParams.append('product', params.product)
if (params.active !== undefined) url.searchParams.append('active', params.active.toString())
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
prices: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
prices: {
type: 'json',
description: 'Array of price objects',
},
metadata: {
type: 'json',
description: 'List metadata',
properties: {
count: { type: 'number', description: 'Number of items returned' },
has_more: { type: 'boolean', description: 'Whether more items exist beyond this page' },
},
},
},
}
+74
View File
@@ -0,0 +1,74 @@
import type { ListProductsParams, ProductListResponse } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeListProductsTool: ToolConfig<ListProductsParams, ProductListResponse> = {
id: 'stripe_list_products',
name: 'Stripe List Products',
description: 'List all products',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
active: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Filter by active status',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/products')
if (params.limit) url.searchParams.append('limit', params.limit.toString())
if (params.active !== undefined) url.searchParams.append('active', String(params.active))
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
products: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
products: {
type: 'json',
description: 'Array of product objects',
},
metadata: {
type: 'json',
description: 'List metadata',
properties: {
count: { type: 'number', description: 'Number of items returned' },
has_more: { type: 'boolean', description: 'Whether more items exist beyond this page' },
},
},
},
}
@@ -0,0 +1,90 @@
import type { ListSubscriptionsParams, SubscriptionListResponse } from '@/tools/stripe/types'
import { LIST_METADATA_OUTPUT_PROPERTIES, SUBSCRIPTION_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeListSubscriptionsTool: ToolConfig<
ListSubscriptionsParams,
SubscriptionListResponse
> = {
id: 'stripe_list_subscriptions',
name: 'Stripe List Subscriptions',
description: 'List all subscriptions',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
customer: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by customer ID',
},
status: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Filter by status (active, past_due, unpaid, canceled, incomplete, incomplete_expired, trialing, all)',
},
price: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by price ID',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/subscriptions')
if (params.limit) url.searchParams.append('limit', params.limit.toString())
if (params.customer) url.searchParams.append('customer', params.customer)
if (params.status) url.searchParams.append('status', params.status)
if (params.price) url.searchParams.append('price', params.price)
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
subscriptions: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
subscriptions: {
type: 'array',
description: 'Array of subscription objects',
items: SUBSCRIPTION_OUTPUT,
},
metadata: {
type: 'json',
description: 'List metadata',
properties: LIST_METADATA_OUTPUT_PROPERTIES,
},
},
}
+75
View File
@@ -0,0 +1,75 @@
import type { InvoiceResponse, PayInvoiceParams } from '@/tools/stripe/types'
import { INVOICE_METADATA_OUTPUT_PROPERTIES, INVOICE_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripePayInvoiceTool: ToolConfig<PayInvoiceParams, InvoiceResponse> = {
id: 'stripe_pay_invoice',
name: 'Stripe Pay Invoice',
description: 'Pay an invoice',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Invoice ID (e.g., in_1234567890)',
},
paid_out_of_band: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Mark invoice as paid out of band',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/invoices/${params.id}/pay`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.paid_out_of_band !== undefined) {
formData.append('paid_out_of_band', String(params.paid_out_of_band))
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
invoice: data,
metadata: {
id: data.id,
status: data.status,
amount_due: data.amount_due,
currency: data.currency,
},
},
}
},
outputs: {
invoice: {
...INVOICE_OUTPUT,
description: 'The paid invoice object',
},
metadata: {
type: 'json',
description: 'Invoice metadata',
properties: INVOICE_METADATA_OUTPUT_PROPERTIES,
},
},
}
@@ -0,0 +1,68 @@
import type { ResumeSubscriptionParams, SubscriptionResponse } from '@/tools/stripe/types'
import { SUBSCRIPTION_METADATA_OUTPUT_PROPERTIES, SUBSCRIPTION_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeResumeSubscriptionTool: ToolConfig<
ResumeSubscriptionParams,
SubscriptionResponse
> = {
id: 'stripe_resume_subscription',
name: 'Stripe Resume Subscription',
description: 'Resume a subscription that was scheduled for cancellation',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Subscription ID (e.g., sub_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/subscriptions/${params.id}/resume`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: () => {
const formData = new URLSearchParams()
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
subscription: data,
metadata: {
id: data.id,
status: data.status,
customer: data.customer,
},
},
}
},
outputs: {
subscription: {
...SUBSCRIPTION_OUTPUT,
description: 'The resumed subscription object',
},
metadata: {
type: 'json',
description: 'Subscription metadata including ID, status, and customer',
properties: SUBSCRIPTION_METADATA_OUTPUT_PROPERTIES,
},
},
}
+69
View File
@@ -0,0 +1,69 @@
import type { ChargeResponse, RetrieveChargeParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeRetrieveChargeTool: ToolConfig<RetrieveChargeParams, ChargeResponse> = {
id: 'stripe_retrieve_charge',
name: 'Stripe Retrieve Charge',
description: 'Retrieve an existing charge by ID',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Charge ID (e.g., ch_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/charges/${params.id}`,
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
charge: data,
metadata: {
id: data.id,
status: data.status,
amount: data.amount,
currency: data.currency,
paid: data.paid,
},
},
}
},
outputs: {
charge: {
type: 'json',
description: 'The retrieved Charge object',
},
metadata: {
type: 'json',
description: 'Charge metadata including ID, status, amount, currency, and paid status',
properties: {
id: { type: 'string', description: 'Stripe unique identifier' },
status: { type: 'string', description: 'Current state of the resource' },
amount: { type: 'number', description: 'Amount in smallest currency unit (e.g., cents)' },
currency: { type: 'string', description: 'Three-letter ISO currency code (lowercase)' },
paid: { type: 'boolean', description: 'Whether payment has been received' },
},
},
},
}
@@ -0,0 +1,61 @@
import type { CustomerResponse, RetrieveCustomerParams } from '@/tools/stripe/types'
import { CUSTOMER_METADATA_OUTPUT_PROPERTIES, CUSTOMER_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeRetrieveCustomerTool: ToolConfig<RetrieveCustomerParams, CustomerResponse> = {
id: 'stripe_retrieve_customer',
name: 'Stripe Retrieve Customer',
description: 'Retrieve an existing customer by ID',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Customer ID (e.g., cus_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/customers/${params.id}`,
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
customer: data,
metadata: {
id: data.id,
email: data.email ?? null,
name: data.name ?? null,
},
},
}
},
outputs: {
customer: {
...CUSTOMER_OUTPUT,
description: 'The retrieved customer object',
},
metadata: {
type: 'json',
description: 'Customer metadata',
properties: CUSTOMER_METADATA_OUTPUT_PROPERTIES,
},
},
}
+65
View File
@@ -0,0 +1,65 @@
import type { EventResponse, RetrieveEventParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeRetrieveEventTool: ToolConfig<RetrieveEventParams, EventResponse> = {
id: 'stripe_retrieve_event',
name: 'Stripe Retrieve Event',
description: 'Retrieve an existing Event by ID',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Event ID (e.g., evt_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/events/${params.id}`,
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
event: data,
metadata: {
id: data.id,
type: data.type,
created: data.created,
},
},
}
},
outputs: {
event: {
type: 'json',
description: 'The retrieved Event object',
},
metadata: {
type: 'json',
description: 'Event metadata including ID, type, and created timestamp',
properties: {
id: { type: 'string', description: 'Stripe unique identifier' },
type: { type: 'string', description: 'Event type identifier' },
created: { type: 'number', description: 'Unix timestamp of creation' },
},
},
},
}
+62
View File
@@ -0,0 +1,62 @@
import type { InvoiceResponse, RetrieveInvoiceParams } from '@/tools/stripe/types'
import { INVOICE_METADATA_OUTPUT_PROPERTIES, INVOICE_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeRetrieveInvoiceTool: ToolConfig<RetrieveInvoiceParams, InvoiceResponse> = {
id: 'stripe_retrieve_invoice',
name: 'Stripe Retrieve Invoice',
description: 'Retrieve an existing invoice by ID',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Invoice ID (e.g., in_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/invoices/${params.id}`,
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
invoice: data,
metadata: {
id: data.id,
status: data.status,
amount_due: data.amount_due,
currency: data.currency,
},
},
}
},
outputs: {
invoice: {
...INVOICE_OUTPUT,
description: 'The retrieved invoice object',
},
metadata: {
type: 'json',
description: 'Invoice metadata',
properties: INVOICE_METADATA_OUTPUT_PROPERTIES,
},
},
}
@@ -0,0 +1,68 @@
import type { PaymentIntentResponse, RetrievePaymentIntentParams } from '@/tools/stripe/types'
import {
PAYMENT_INTENT_METADATA_OUTPUT_PROPERTIES,
PAYMENT_INTENT_OUTPUT,
} from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeRetrievePaymentIntentTool: ToolConfig<
RetrievePaymentIntentParams,
PaymentIntentResponse
> = {
id: 'stripe_retrieve_payment_intent',
name: 'Stripe Retrieve Payment Intent',
description: 'Retrieve an existing Payment Intent by ID',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Payment Intent ID (e.g., pi_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/payment_intents/${params.id}`,
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
payment_intent: data,
metadata: {
id: data.id,
status: data.status,
amount: data.amount,
currency: data.currency,
},
},
}
},
outputs: {
payment_intent: {
...PAYMENT_INTENT_OUTPUT,
description: 'The retrieved Payment Intent object',
},
metadata: {
type: 'json',
description: 'Payment Intent metadata including ID, status, amount, and currency',
properties: PAYMENT_INTENT_METADATA_OUTPUT_PROPERTIES,
},
},
}
+71
View File
@@ -0,0 +1,71 @@
import type { PriceResponse, RetrievePriceParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeRetrievePriceTool: ToolConfig<RetrievePriceParams, PriceResponse> = {
id: 'stripe_retrieve_price',
name: 'Stripe Retrieve Price',
description: 'Retrieve an existing price by ID',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Price ID (e.g., price_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/prices/${params.id}`,
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
price: data,
metadata: {
id: data.id,
product: data.product,
unit_amount: data.unit_amount ?? null,
currency: data.currency,
},
},
}
},
outputs: {
price: {
type: 'json',
description: 'The retrieved price object',
},
metadata: {
type: 'json',
description: 'Price metadata',
properties: {
id: { type: 'string', description: 'Stripe unique identifier' },
product: { type: 'string', description: 'Associated product ID' },
unit_amount: {
type: 'number',
description: 'Amount in smallest currency unit (e.g., cents)',
optional: true,
},
currency: { type: 'string', description: 'Three-letter ISO currency code (lowercase)' },
},
},
},
}
+65
View File
@@ -0,0 +1,65 @@
import type { ProductResponse, RetrieveProductParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeRetrieveProductTool: ToolConfig<RetrieveProductParams, ProductResponse> = {
id: 'stripe_retrieve_product',
name: 'Stripe Retrieve Product',
description: 'Retrieve an existing product by ID',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Product ID (e.g., prod_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/products/${params.id}`,
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
product: data,
metadata: {
id: data.id,
name: data.name,
active: data.active,
},
},
}
},
outputs: {
product: {
type: 'json',
description: 'The retrieved product object',
},
metadata: {
type: 'json',
description: 'Product metadata',
properties: {
id: { type: 'string', description: 'Stripe unique identifier' },
name: { type: 'string', description: 'Display name' },
active: { type: 'boolean', description: 'Whether the resource is currently active' },
},
},
},
}
@@ -0,0 +1,64 @@
import type { RetrieveSubscriptionParams, SubscriptionResponse } from '@/tools/stripe/types'
import { SUBSCRIPTION_METADATA_OUTPUT_PROPERTIES, SUBSCRIPTION_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeRetrieveSubscriptionTool: ToolConfig<
RetrieveSubscriptionParams,
SubscriptionResponse
> = {
id: 'stripe_retrieve_subscription',
name: 'Stripe Retrieve Subscription',
description: 'Retrieve an existing subscription by ID',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Subscription ID (e.g., sub_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/subscriptions/${params.id}`,
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
subscription: data,
metadata: {
id: data.id,
status: data.status,
customer: data.customer,
},
},
}
},
outputs: {
subscription: {
...SUBSCRIPTION_OUTPUT,
description: 'The retrieved subscription object',
},
metadata: {
type: 'json',
description: 'Subscription metadata including ID, status, and customer',
properties: SUBSCRIPTION_METADATA_OUTPUT_PROPERTIES,
},
},
}
+74
View File
@@ -0,0 +1,74 @@
import type { ChargeListResponse, SearchChargesParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeSearchChargesTool: ToolConfig<SearchChargesParams, ChargeListResponse> = {
id: 'stripe_search_charges',
name: 'Stripe Search Charges',
description: 'Search for charges using query syntax',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: "Search query (e.g., \"status:'succeeded' AND currency:'usd'\")",
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/charges/search')
url.searchParams.append('query', params.query)
if (params.limit) url.searchParams.append('limit', params.limit.toString())
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
charges: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
charges: {
type: 'json',
description: 'Array of matching Charge objects',
},
metadata: {
type: 'json',
description: 'Search metadata including count and has_more',
properties: {
count: { type: 'number', description: 'Number of items returned' },
has_more: { type: 'boolean', description: 'Whether more items exist beyond this page' },
},
},
},
}
+72
View File
@@ -0,0 +1,72 @@
import type { CustomerListResponse, SearchCustomersParams } from '@/tools/stripe/types'
import { CUSTOMER_OUTPUT, LIST_METADATA_OUTPUT_PROPERTIES } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeSearchCustomersTool: ToolConfig<SearchCustomersParams, CustomerListResponse> = {
id: 'stripe_search_customers',
name: 'Stripe Search Customers',
description: 'Search for customers using query syntax',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Search query (e.g., "email:\'customer@example.com\'")',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/customers/search')
url.searchParams.append('query', params.query)
if (params.limit) url.searchParams.append('limit', params.limit.toString())
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
customers: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
customers: {
type: 'array',
description: 'Array of matching customer objects',
items: CUSTOMER_OUTPUT,
},
metadata: {
type: 'json',
description: 'Search metadata',
properties: LIST_METADATA_OUTPUT_PROPERTIES,
},
},
}
+74
View File
@@ -0,0 +1,74 @@
import type { InvoiceListResponse, SearchInvoicesParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeSearchInvoicesTool: ToolConfig<SearchInvoicesParams, InvoiceListResponse> = {
id: 'stripe_search_invoices',
name: 'Stripe Search Invoices',
description: 'Search for invoices using query syntax',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Search query (e.g., "customer:\'cus_1234567890\'")',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/invoices/search')
url.searchParams.append('query', params.query)
if (params.limit) url.searchParams.append('limit', params.limit.toString())
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
invoices: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
invoices: {
type: 'json',
description: 'Array of matching invoice objects',
},
metadata: {
type: 'json',
description: 'Search metadata',
properties: {
count: { type: 'number', description: 'Number of items returned' },
has_more: { type: 'boolean', description: 'Whether more items exist beyond this page' },
},
},
},
}
@@ -0,0 +1,75 @@
import type { PaymentIntentListResponse, SearchPaymentIntentsParams } from '@/tools/stripe/types'
import { LIST_METADATA_OUTPUT_PROPERTIES, PAYMENT_INTENT_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeSearchPaymentIntentsTool: ToolConfig<
SearchPaymentIntentsParams,
PaymentIntentListResponse
> = {
id: 'stripe_search_payment_intents',
name: 'Stripe Search Payment Intents',
description: 'Search for Payment Intents using query syntax',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: "Search query (e.g., \"status:'succeeded' AND currency:'usd'\")",
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/payment_intents/search')
url.searchParams.append('query', params.query)
if (params.limit) url.searchParams.append('limit', params.limit.toString())
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
payment_intents: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
payment_intents: {
type: 'array',
description: 'Array of matching Payment Intent objects',
items: PAYMENT_INTENT_OUTPUT,
},
metadata: {
type: 'json',
description: 'Search metadata including count and has_more',
properties: LIST_METADATA_OUTPUT_PROPERTIES,
},
},
}
+74
View File
@@ -0,0 +1,74 @@
import type { PriceListResponse, SearchPricesParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeSearchPricesTool: ToolConfig<SearchPricesParams, PriceListResponse> = {
id: 'stripe_search_prices',
name: 'Stripe Search Prices',
description: 'Search for prices using query syntax',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: "Search query (e.g., \"active:'true' AND currency:'usd'\")",
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/prices/search')
url.searchParams.append('query', params.query)
if (params.limit) url.searchParams.append('limit', params.limit.toString())
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
prices: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
prices: {
type: 'json',
description: 'Array of matching price objects',
},
metadata: {
type: 'json',
description: 'Search metadata',
properties: {
count: { type: 'number', description: 'Number of items returned' },
has_more: { type: 'boolean', description: 'Whether more items exist beyond this page' },
},
},
},
}
+74
View File
@@ -0,0 +1,74 @@
import type { ProductListResponse, SearchProductsParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeSearchProductsTool: ToolConfig<SearchProductsParams, ProductListResponse> = {
id: 'stripe_search_products',
name: 'Stripe Search Products',
description: 'Search for products using query syntax',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Search query (e.g., "name:\'shirt\'")',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/products/search')
url.searchParams.append('query', params.query)
if (params.limit) url.searchParams.append('limit', params.limit.toString())
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
products: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
products: {
type: 'json',
description: 'Array of matching product objects',
},
metadata: {
type: 'json',
description: 'Search metadata',
properties: {
count: { type: 'number', description: 'Number of items returned' },
has_more: { type: 'boolean', description: 'Whether more items exist beyond this page' },
},
},
},
}
@@ -0,0 +1,75 @@
import type { SearchSubscriptionsParams, SubscriptionListResponse } from '@/tools/stripe/types'
import { LIST_METADATA_OUTPUT_PROPERTIES, SUBSCRIPTION_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeSearchSubscriptionsTool: ToolConfig<
SearchSubscriptionsParams,
SubscriptionListResponse
> = {
id: 'stripe_search_subscriptions',
name: 'Stripe Search Subscriptions',
description: 'Search for subscriptions using query syntax',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: "Search query (e.g., \"status:'active' AND customer:'cus_xxx'\")",
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of results to return (default 10, max 100)',
},
},
request: {
url: (params) => {
const url = new URL('https://api.stripe.com/v1/subscriptions/search')
url.searchParams.append('query', params.query)
if (params.limit) url.searchParams.append('limit', params.limit.toString())
return url.toString()
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
subscriptions: data.data || [],
metadata: {
count: (data.data || []).length,
has_more: data.has_more || false,
},
},
}
},
outputs: {
subscriptions: {
type: 'array',
description: 'Array of matching subscription objects',
items: SUBSCRIPTION_OUTPUT,
},
metadata: {
type: 'json',
description: 'Search metadata',
properties: LIST_METADATA_OUTPUT_PROPERTIES,
},
},
}
+70
View File
@@ -0,0 +1,70 @@
import type { InvoiceResponse, SendInvoiceParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeSendInvoiceTool: ToolConfig<SendInvoiceParams, InvoiceResponse> = {
id: 'stripe_send_invoice',
name: 'Stripe Send Invoice',
description: 'Send an invoice to the customer',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Invoice ID (e.g., in_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/invoices/${params.id}/send`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
invoice: data,
metadata: {
id: data.id,
status: data.status,
amount_due: data.amount_due,
currency: data.currency,
},
},
}
},
outputs: {
invoice: {
type: 'json',
description: 'The sent invoice object',
},
metadata: {
type: 'json',
description: 'Invoice metadata',
properties: {
id: { type: 'string', description: 'Stripe unique identifier' },
status: { type: 'string', description: 'Current state of the resource' },
amount_due: {
type: 'number',
description: 'Amount remaining to be paid in smallest currency unit',
},
currency: { type: 'string', description: 'Three-letter ISO currency code (lowercase)' },
},
},
},
}
File diff suppressed because it is too large Load Diff
+93
View File
@@ -0,0 +1,93 @@
import type { ChargeResponse, UpdateChargeParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeUpdateChargeTool: ToolConfig<UpdateChargeParams, ChargeResponse> = {
id: 'stripe_update_charge',
name: 'Stripe Update Charge',
description: 'Update an existing charge',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Charge ID (e.g., ch_1234567890)',
},
description: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Updated description',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Updated metadata',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/charges/${params.id}`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.description) formData.append('description', params.description)
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
charge: data,
metadata: {
id: data.id,
status: data.status,
amount: data.amount,
currency: data.currency,
paid: data.paid,
},
},
}
},
outputs: {
charge: {
type: 'json',
description: 'The updated Charge object',
},
metadata: {
type: 'json',
description: 'Charge metadata including ID, status, amount, currency, and paid status',
properties: {
id: { type: 'string', description: 'Stripe unique identifier' },
status: { type: 'string', description: 'Current state of the resource' },
amount: { type: 'number', description: 'Amount in smallest currency unit (e.g., cents)' },
currency: { type: 'string', description: 'Three-letter ISO currency code (lowercase)' },
paid: { type: 'boolean', description: 'Whether payment has been received' },
},
},
},
}
+119
View File
@@ -0,0 +1,119 @@
import type { CustomerResponse, UpdateCustomerParams } from '@/tools/stripe/types'
import { CUSTOMER_METADATA_OUTPUT_PROPERTIES, CUSTOMER_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeUpdateCustomerTool: ToolConfig<UpdateCustomerParams, CustomerResponse> = {
id: 'stripe_update_customer',
name: 'Stripe Update Customer',
description: 'Update an existing customer',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Customer ID (e.g., cus_1234567890)',
},
email: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Updated email address',
},
name: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Updated name',
},
phone: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Updated phone number',
},
description: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Updated description',
},
address: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Updated address object',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Updated metadata',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/customers/${params.id}`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.email) formData.append('email', params.email)
if (params.name) formData.append('name', params.name)
if (params.phone) formData.append('phone', params.phone)
if (params.description) formData.append('description', params.description)
if (params.address) {
Object.entries(params.address).forEach(([key, value]) => {
if (value) formData.append(`address[${key}]`, String(value))
})
}
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
customer: data,
metadata: {
id: data.id,
email: data.email ?? null,
name: data.name ?? null,
},
},
}
},
outputs: {
customer: {
...CUSTOMER_OUTPUT,
description: 'The updated customer object',
},
metadata: {
type: 'json',
description: 'Customer metadata',
properties: CUSTOMER_METADATA_OUTPUT_PROPERTIES,
},
},
}
+96
View File
@@ -0,0 +1,96 @@
import type { InvoiceResponse, UpdateInvoiceParams } from '@/tools/stripe/types'
import { INVOICE_METADATA_OUTPUT_PROPERTIES, INVOICE_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeUpdateInvoiceTool: ToolConfig<UpdateInvoiceParams, InvoiceResponse> = {
id: 'stripe_update_invoice',
name: 'Stripe Update Invoice',
description: 'Update an existing invoice',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Invoice ID (e.g., in_1234567890)',
},
description: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Description of the invoice',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Set of key-value pairs',
},
auto_advance: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Auto-finalize the invoice',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/invoices/${params.id}`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.description) formData.append('description', params.description)
if (params.auto_advance !== undefined) {
formData.append('auto_advance', String(params.auto_advance))
}
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
invoice: data,
metadata: {
id: data.id,
status: data.status,
amount_due: data.amount_due,
currency: data.currency,
},
},
}
},
outputs: {
invoice: {
...INVOICE_OUTPUT,
description: 'The updated invoice object',
},
metadata: {
type: 'json',
description: 'Invoice metadata',
properties: INVOICE_METADATA_OUTPUT_PROPERTIES,
},
},
}
@@ -0,0 +1,114 @@
import type { PaymentIntentResponse, UpdatePaymentIntentParams } from '@/tools/stripe/types'
import {
PAYMENT_INTENT_METADATA_OUTPUT_PROPERTIES,
PAYMENT_INTENT_OUTPUT,
} from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeUpdatePaymentIntentTool: ToolConfig<
UpdatePaymentIntentParams,
PaymentIntentResponse
> = {
id: 'stripe_update_payment_intent',
name: 'Stripe Update Payment Intent',
description: 'Update an existing Payment Intent',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Payment Intent ID (e.g., pi_1234567890)',
},
amount: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Updated amount in cents',
},
currency: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Three-letter ISO currency code',
},
customer: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Customer ID',
},
description: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Updated description',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Updated metadata',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/payment_intents/${params.id}`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.amount) formData.append('amount', Number(params.amount).toString())
if (params.currency) formData.append('currency', params.currency)
if (params.customer) formData.append('customer', params.customer)
if (params.description) formData.append('description', params.description)
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
payment_intent: data,
metadata: {
id: data.id,
status: data.status,
amount: data.amount,
currency: data.currency,
},
},
}
},
outputs: {
payment_intent: {
...PAYMENT_INTENT_OUTPUT,
description: 'The updated Payment Intent object',
},
metadata: {
type: 'json',
description: 'Payment Intent metadata including ID, status, amount, and currency',
properties: PAYMENT_INTENT_METADATA_OUTPUT_PROPERTIES,
},
},
}
+95
View File
@@ -0,0 +1,95 @@
import type { PriceResponse, UpdatePriceParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeUpdatePriceTool: ToolConfig<UpdatePriceParams, PriceResponse> = {
id: 'stripe_update_price',
name: 'Stripe Update Price',
description: 'Update an existing price',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Price ID (e.g., price_1234567890)',
},
active: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Whether the price is active',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Updated metadata',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/prices/${params.id}`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.active !== undefined) formData.append('active', String(params.active))
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
price: data,
metadata: {
id: data.id,
product: data.product,
unit_amount: data.unit_amount ?? null,
currency: data.currency,
},
},
}
},
outputs: {
price: {
type: 'json',
description: 'The updated price object',
},
metadata: {
type: 'json',
description: 'Price metadata',
properties: {
id: { type: 'string', description: 'Stripe unique identifier' },
product: { type: 'string', description: 'Associated product ID' },
unit_amount: {
type: 'number',
description: 'Amount in smallest currency unit (e.g., cents)',
optional: true,
},
currency: { type: 'string', description: 'Three-letter ISO currency code (lowercase)' },
},
},
},
}
+115
View File
@@ -0,0 +1,115 @@
import type { ProductResponse, UpdateProductParams } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeUpdateProductTool: ToolConfig<UpdateProductParams, ProductResponse> = {
id: 'stripe_update_product',
name: 'Stripe Update Product',
description: 'Update an existing product',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Product ID (e.g., prod_1234567890)',
},
name: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Updated product name',
},
description: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Updated product description',
},
active: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Updated active status',
},
images: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Updated array of image URLs',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Updated metadata',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/products/${params.id}`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.name) formData.append('name', params.name)
if (params.description) formData.append('description', params.description)
if (params.active !== undefined) formData.append('active', String(params.active))
if (params.images) {
params.images.forEach((image: string, index: number) => {
formData.append(`images[${index}]`, image)
})
}
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
product: data,
metadata: {
id: data.id,
name: data.name,
active: data.active,
},
},
}
},
outputs: {
product: {
type: 'json',
description: 'The updated product object',
},
metadata: {
type: 'json',
description: 'Product metadata',
properties: {
id: { type: 'string', description: 'Stripe unique identifier' },
name: { type: 'string', description: 'Display name' },
active: { type: 'boolean', description: 'Whether the resource is currently active' },
},
},
},
}
@@ -0,0 +1,106 @@
import type { SubscriptionResponse, UpdateSubscriptionParams } from '@/tools/stripe/types'
import { SUBSCRIPTION_METADATA_OUTPUT_PROPERTIES, SUBSCRIPTION_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeUpdateSubscriptionTool: ToolConfig<
UpdateSubscriptionParams,
SubscriptionResponse
> = {
id: 'stripe_update_subscription',
name: 'Stripe Update Subscription',
description: 'Update an existing subscription',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Subscription ID (e.g., sub_1234567890)',
},
items: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Updated array of items with price IDs',
},
cancel_at_period_end: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Cancel subscription at period end',
},
metadata: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Updated metadata',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/subscriptions/${params.id}`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
body: (params) => {
const formData = new URLSearchParams()
if (params.items && Array.isArray(params.items)) {
params.items.forEach((item, index) => {
formData.append(`items[${index}][price]`, item.price)
if (item.quantity) {
formData.append(`items[${index}][quantity]`, String(item.quantity))
}
})
}
if (params.cancel_at_period_end !== undefined) {
formData.append('cancel_at_period_end', String(params.cancel_at_period_end))
}
if (params.metadata) {
Object.entries(params.metadata).forEach(([key, value]) => {
formData.append(`metadata[${key}]`, String(value))
})
}
return { body: formData.toString() }
},
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
subscription: data,
metadata: {
id: data.id,
status: data.status,
customer: data.customer,
},
},
}
},
outputs: {
subscription: {
...SUBSCRIPTION_OUTPUT,
description: 'The updated subscription object',
},
metadata: {
type: 'json',
description: 'Subscription metadata including ID, status, and customer',
properties: SUBSCRIPTION_METADATA_OUTPUT_PROPERTIES,
},
},
}
+62
View File
@@ -0,0 +1,62 @@
import type { InvoiceResponse, VoidInvoiceParams } from '@/tools/stripe/types'
import { INVOICE_METADATA_OUTPUT_PROPERTIES, INVOICE_OUTPUT } from '@/tools/stripe/types'
import type { ToolConfig } from '@/tools/types'
export const stripeVoidInvoiceTool: ToolConfig<VoidInvoiceParams, InvoiceResponse> = {
id: 'stripe_void_invoice',
name: 'Stripe Void Invoice',
description: 'Void an invoice',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Stripe API key (secret key)',
},
id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Invoice ID (e.g., in_1234567890)',
},
},
request: {
url: (params) => `https://api.stripe.com/v1/invoices/${params.id}/void`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/x-www-form-urlencoded',
}),
},
transformResponse: async (response) => {
const data = await response.json()
return {
success: true,
output: {
invoice: data,
metadata: {
id: data.id,
status: data.status,
amount_due: data.amount_due,
currency: data.currency,
},
},
}
},
outputs: {
invoice: {
...INVOICE_OUTPUT,
description: 'The voided invoice object',
},
metadata: {
type: 'json',
description: 'Invoice metadata',
properties: INVOICE_METADATA_OUTPUT_PROPERTIES,
},
},
}