lemonsqueezy-mcp-server 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/ENV_EXAMPLE.md +83 -0
  2. package/LICENSE +21 -0
  3. package/README.md +141 -0
  4. package/SETUP.md +244 -0
  5. package/dist/config.d.ts +25 -0
  6. package/dist/config.d.ts.map +1 -0
  7. package/dist/config.js +80 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/config.test.d.ts +2 -0
  10. package/dist/config.test.d.ts.map +1 -0
  11. package/dist/config.test.js +55 -0
  12. package/dist/config.test.js.map +1 -0
  13. package/dist/connections/firebase.d.ts +3 -0
  14. package/dist/connections/firebase.d.ts.map +1 -0
  15. package/dist/connections/firebase.js +62 -0
  16. package/dist/connections/firebase.js.map +1 -0
  17. package/dist/connections/salesforce.d.ts +3 -0
  18. package/dist/connections/salesforce.d.ts.map +1 -0
  19. package/dist/connections/salesforce.js +307 -0
  20. package/dist/connections/salesforce.js.map +1 -0
  21. package/dist/index.d.ts +3 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +101 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/resources/payment-context.d.ts +14 -0
  26. package/dist/resources/payment-context.d.ts.map +1 -0
  27. package/dist/resources/payment-context.js +111 -0
  28. package/dist/resources/payment-context.js.map +1 -0
  29. package/dist/server.d.ts +36 -0
  30. package/dist/server.d.ts.map +1 -0
  31. package/dist/server.js +14 -0
  32. package/dist/server.js.map +1 -0
  33. package/dist/sync-last-purchase.d.ts +3 -0
  34. package/dist/sync-last-purchase.d.ts.map +1 -0
  35. package/dist/sync-last-purchase.js +113 -0
  36. package/dist/sync-last-purchase.js.map +1 -0
  37. package/dist/tools/definitions.d.ts +3768 -0
  38. package/dist/tools/definitions.d.ts.map +1 -0
  39. package/dist/tools/definitions.js +753 -0
  40. package/dist/tools/definitions.js.map +1 -0
  41. package/dist/tools/handlers/analytics.d.ts +21 -0
  42. package/dist/tools/handlers/analytics.d.ts.map +1 -0
  43. package/dist/tools/handlers/analytics.js +398 -0
  44. package/dist/tools/handlers/analytics.js.map +1 -0
  45. package/dist/tools/handlers/lemonsqueezy.d.ts +436 -0
  46. package/dist/tools/handlers/lemonsqueezy.d.ts.map +1 -0
  47. package/dist/tools/handlers/lemonsqueezy.js +481 -0
  48. package/dist/tools/handlers/lemonsqueezy.js.map +1 -0
  49. package/dist/tools/handlers/salesforce.d.ts +13 -0
  50. package/dist/tools/handlers/salesforce.d.ts.map +1 -0
  51. package/dist/tools/handlers/salesforce.js +54 -0
  52. package/dist/tools/handlers/salesforce.js.map +1 -0
  53. package/dist/tools/handlers/vos.d.ts +26 -0
  54. package/dist/tools/handlers/vos.d.ts.map +1 -0
  55. package/dist/tools/handlers/vos.js +207 -0
  56. package/dist/tools/handlers/vos.js.map +1 -0
  57. package/dist/tools/index.d.ts +7 -0
  58. package/dist/tools/index.d.ts.map +1 -0
  59. package/dist/tools/index.js +202 -0
  60. package/dist/tools/index.js.map +1 -0
  61. package/dist/types.d.ts +24 -0
  62. package/dist/types.d.ts.map +1 -0
  63. package/dist/types.js +2 -0
  64. package/dist/types.js.map +1 -0
  65. package/dist/utils/logger.d.ts +3 -0
  66. package/dist/utils/logger.d.ts.map +1 -0
  67. package/dist/utils/logger.js +8 -0
  68. package/dist/utils/logger.js.map +1 -0
  69. package/dist/utils/response.d.ts +14 -0
  70. package/dist/utils/response.d.ts.map +1 -0
  71. package/dist/utils/response.js +17 -0
  72. package/dist/utils/response.js.map +1 -0
  73. package/dist/utils/retry.d.ts +11 -0
  74. package/dist/utils/retry.d.ts.map +1 -0
  75. package/dist/utils/retry.js +36 -0
  76. package/dist/utils/retry.js.map +1 -0
  77. package/dist/utils/secrets/provider.d.ts +30 -0
  78. package/dist/utils/secrets/provider.d.ts.map +1 -0
  79. package/dist/utils/secrets/provider.js +51 -0
  80. package/dist/utils/secrets/provider.js.map +1 -0
  81. package/dist/utils/secrets.d.ts +7 -0
  82. package/dist/utils/secrets.d.ts.map +1 -0
  83. package/dist/utils/secrets.js +16 -0
  84. package/dist/utils/secrets.js.map +1 -0
  85. package/dist/utils/validation.d.ts +580 -0
  86. package/dist/utils/validation.d.ts.map +1 -0
  87. package/dist/utils/validation.js +250 -0
  88. package/dist/utils/validation.js.map +1 -0
  89. package/dist/webhooks/listener.d.ts +17 -0
  90. package/dist/webhooks/listener.d.ts.map +1 -0
  91. package/dist/webhooks/listener.js +140 -0
  92. package/dist/webhooks/listener.js.map +1 -0
  93. package/dist/webhooks/ngrok.d.ts +8 -0
  94. package/dist/webhooks/ngrok.d.ts.map +1 -0
  95. package/dist/webhooks/ngrok.js +50 -0
  96. package/dist/webhooks/ngrok.js.map +1 -0
  97. package/package.json +68 -0
@@ -0,0 +1,753 @@
1
+ export const TOOLS = {
2
+ // Stores
3
+ GET_STORE: "get_store",
4
+ LIST_STORES: "list_stores",
5
+ // Customers
6
+ GET_CUSTOMER: "get_customer",
7
+ LIST_CUSTOMERS: "list_customers",
8
+ CREATE_CUSTOMER: "create_customer",
9
+ UPDATE_CUSTOMER: "update_customer",
10
+ ARCHIVE_CUSTOMER: "archive_customer",
11
+ // Products
12
+ GET_PRODUCT: "get_product",
13
+ LIST_PRODUCTS: "list_products",
14
+ // Variants
15
+ GET_VARIANT: "get_variant",
16
+ LIST_VARIANTS: "list_variants",
17
+ // Orders
18
+ GET_ORDER: "get_order",
19
+ LIST_ORDERS: "list_orders",
20
+ SEARCH_ORDERS: "search_orders",
21
+ GET_ORDER_ITEM: "get_order_item",
22
+ LIST_ORDER_ITEMS: "list_order_items",
23
+ GENERATE_ORDER_INVOICE: "generate_order_invoice",
24
+ ISSUE_ORDER_REFUND: "issue_order_refund",
25
+ // Subscriptions
26
+ GET_SUBSCRIPTION: "get_subscription",
27
+ LIST_SUBSCRIPTIONS: "list_subscriptions",
28
+ UPDATE_SUBSCRIPTION: "update_subscription",
29
+ CANCEL_SUBSCRIPTION: "cancel_subscription",
30
+ // Subscription Items
31
+ GET_SUBSCRIPTION_ITEM: "get_subscription_item",
32
+ LIST_SUBSCRIPTION_ITEMS: "list_subscription_items",
33
+ GET_SUBSCRIPTION_ITEM_USAGE: "get_subscription_item_usage",
34
+ // Subscription Invoices
35
+ GET_SUBSCRIPTION_INVOICE: "get_subscription_invoice",
36
+ LIST_SUBSCRIPTION_INVOICES: "list_subscription_invoices",
37
+ GENERATE_SUBSCRIPTION_INVOICE: "generate_subscription_invoice",
38
+ ISSUE_SUBSCRIPTION_INVOICE_REFUND: "issue_subscription_invoice_refund",
39
+ // Discounts
40
+ GET_DISCOUNT: "get_discount",
41
+ LIST_DISCOUNTS: "list_discounts",
42
+ CREATE_DISCOUNT: "create_discount",
43
+ DELETE_DISCOUNT: "delete_discount",
44
+ // License Keys
45
+ GET_LICENSE_KEY: "get_license_key",
46
+ LIST_LICENSE_KEYS: "list_license_keys",
47
+ UPDATE_LICENSE_KEY: "update_license_key",
48
+ // Files
49
+ GET_FILE: "get_file",
50
+ LIST_FILES: "list_files",
51
+ // Usage Records
52
+ GET_USAGE_RECORD: "get_usage_record",
53
+ LIST_USAGE_RECORDS: "list_usage_records",
54
+ CREATE_USAGE_RECORD: "create_usage_record",
55
+ // Checkouts
56
+ CREATE_CHECKOUT: "create_checkout",
57
+ // Webhooks
58
+ GET_WEBHOOK: "get_webhook",
59
+ LIST_WEBHOOKS: "list_webhooks",
60
+ CREATE_WEBHOOK: "create_webhook",
61
+ UPDATE_WEBHOOK: "update_webhook",
62
+ DELETE_WEBHOOK: "delete_webhook",
63
+ // Salesforce (Bonus)
64
+ SYNC_CUSTOMER_TO_CRM: "sync_customer_to_crm",
65
+ // VOS Tools
66
+ SEARCH_TRANSACTIONS_NATURAL: "search_transactions_natural",
67
+ ANALYZE_CHURN_RISK: "analyze_churn_risk",
68
+ CANONIZE_DECISION: "canonize_decision",
69
+ // Analytics Tools
70
+ GET_FINANCIAL_METRICS: "get_financial_metrics",
71
+ PREDICT_CHURN_RISK: "predict_churn_risk",
72
+ };
73
+ export function getToolDefinitions() {
74
+ return [
75
+ // Stores
76
+ {
77
+ name: TOOLS.GET_STORE,
78
+ description: "Get details of a specific store by ID.",
79
+ inputSchema: {
80
+ type: "object",
81
+ properties: {
82
+ storeId: { type: "number", description: "The store ID" },
83
+ },
84
+ required: ["storeId"],
85
+ },
86
+ },
87
+ {
88
+ name: TOOLS.LIST_STORES,
89
+ description: "List all stores in your Lemon Squeezy account.",
90
+ inputSchema: {
91
+ type: "object",
92
+ properties: {
93
+ page: { type: "number", description: "Optional: Page number for pagination" },
94
+ },
95
+ required: [],
96
+ },
97
+ },
98
+ // Customers
99
+ {
100
+ name: TOOLS.GET_CUSTOMER,
101
+ description: "Get details of a specific customer by ID.",
102
+ inputSchema: {
103
+ type: "object",
104
+ properties: {
105
+ customerId: { type: "number", description: "The customer ID" },
106
+ },
107
+ required: ["customerId"],
108
+ },
109
+ },
110
+ {
111
+ name: TOOLS.LIST_CUSTOMERS,
112
+ description: "List customers with optional filtering. Useful for finding customer information, subscription status, and order history.",
113
+ inputSchema: {
114
+ type: "object",
115
+ properties: {
116
+ email: { type: "string", description: "Optional: Filter customers by email address" },
117
+ page: { type: "number", description: "Optional: Page number for pagination" },
118
+ },
119
+ required: [],
120
+ },
121
+ },
122
+ {
123
+ name: TOOLS.CREATE_CUSTOMER,
124
+ description: "Create a new customer in a store.",
125
+ inputSchema: {
126
+ type: "object",
127
+ properties: {
128
+ storeId: { type: "number", description: "The store ID" },
129
+ name: { type: "string", description: "Customer name" },
130
+ email: { type: "string", description: "Customer email" },
131
+ city: { type: "string", description: "Optional: Customer city" },
132
+ country: { type: "string", description: "Optional: Customer country" },
133
+ region: { type: "string", description: "Optional: Customer region/state" },
134
+ },
135
+ required: ["storeId", "name", "email"],
136
+ },
137
+ },
138
+ {
139
+ name: TOOLS.UPDATE_CUSTOMER,
140
+ description: "Update an existing customer's information.",
141
+ inputSchema: {
142
+ type: "object",
143
+ properties: {
144
+ customerId: { type: "number", description: "The customer ID" },
145
+ name: { type: "string", description: "Optional: Customer name" },
146
+ email: { type: "string", description: "Optional: Customer email" },
147
+ city: { type: "string", description: "Optional: Customer city" },
148
+ country: { type: "string", description: "Optional: Customer country" },
149
+ region: { type: "string", description: "Optional: Customer region/state" },
150
+ },
151
+ required: ["customerId"],
152
+ },
153
+ },
154
+ {
155
+ name: TOOLS.ARCHIVE_CUSTOMER,
156
+ description: "Archive a customer (soft delete).",
157
+ inputSchema: {
158
+ type: "object",
159
+ properties: {
160
+ customerId: { type: "number", description: "The customer ID" },
161
+ },
162
+ required: ["customerId"],
163
+ },
164
+ },
165
+ // Products
166
+ {
167
+ name: TOOLS.GET_PRODUCT,
168
+ description: "Get details of a specific product by ID.",
169
+ inputSchema: {
170
+ type: "object",
171
+ properties: {
172
+ productId: { type: "number", description: "The product ID" },
173
+ },
174
+ required: ["productId"],
175
+ },
176
+ },
177
+ {
178
+ name: TOOLS.LIST_PRODUCTS,
179
+ description: "List all products, optionally filtered by store.",
180
+ inputSchema: {
181
+ type: "object",
182
+ properties: {
183
+ storeId: { type: "number", description: "Optional: Filter by store ID" },
184
+ page: { type: "number", description: "Optional: Page number for pagination" },
185
+ },
186
+ required: [],
187
+ },
188
+ },
189
+ // Variants
190
+ {
191
+ name: TOOLS.GET_VARIANT,
192
+ description: "Get details of a specific product variant by ID.",
193
+ inputSchema: {
194
+ type: "object",
195
+ properties: {
196
+ variantId: { type: "number", description: "The variant ID" },
197
+ },
198
+ required: ["variantId"],
199
+ },
200
+ },
201
+ {
202
+ name: TOOLS.LIST_VARIANTS,
203
+ description: "List all product variants, optionally filtered by product or store.",
204
+ inputSchema: {
205
+ type: "object",
206
+ properties: {
207
+ productId: { type: "number", description: "Optional: Filter by product ID" },
208
+ page: { type: "number", description: "Optional: Page number for pagination" },
209
+ },
210
+ required: [],
211
+ },
212
+ },
213
+ // Orders
214
+ {
215
+ name: TOOLS.GET_ORDER,
216
+ description: "Retrieve details of a specific Lemon Squeezy order by ID. Use this to verify payment status, order total, and customer information.",
217
+ inputSchema: {
218
+ type: "object",
219
+ properties: {
220
+ orderId: { type: "number", description: "The unique ID of the order" },
221
+ },
222
+ required: ["orderId"],
223
+ },
224
+ },
225
+ {
226
+ name: TOOLS.LIST_ORDERS,
227
+ description: "List all orders with optional filtering. Useful for finding recent payments, the last successful payment, or browsing order history. Returns orders sorted by most recent first.",
228
+ inputSchema: {
229
+ type: "object",
230
+ properties: {
231
+ page: { type: "number", description: "Optional: Page number for pagination" },
232
+ storeId: { type: "number", description: "Optional: Filter orders by store ID" },
233
+ },
234
+ required: [],
235
+ },
236
+ },
237
+ {
238
+ name: TOOLS.SEARCH_ORDERS,
239
+ description: "Search for orders by email or customer email. Useful for finding a payment when you only have a user's email address. Returns all orders matching the email.",
240
+ inputSchema: {
241
+ type: "object",
242
+ properties: {
243
+ userEmail: { type: "string", description: "The email address of the customer" },
244
+ },
245
+ required: ["userEmail"],
246
+ },
247
+ },
248
+ {
249
+ name: TOOLS.GET_ORDER_ITEM,
250
+ description: "Get details of a specific order item by ID.",
251
+ inputSchema: {
252
+ type: "object",
253
+ properties: {
254
+ orderItemId: { type: "number", description: "The order item ID" },
255
+ },
256
+ required: ["orderItemId"],
257
+ },
258
+ },
259
+ {
260
+ name: TOOLS.LIST_ORDER_ITEMS,
261
+ description: "List order items, optionally filtered by order.",
262
+ inputSchema: {
263
+ type: "object",
264
+ properties: {
265
+ orderId: { type: "number", description: "Optional: Filter by order ID" },
266
+ page: { type: "number", description: "Optional: Page number for pagination" },
267
+ },
268
+ required: [],
269
+ },
270
+ },
271
+ {
272
+ name: TOOLS.GENERATE_ORDER_INVOICE,
273
+ description: "Generate an invoice for an order.",
274
+ inputSchema: {
275
+ type: "object",
276
+ properties: {
277
+ orderId: { type: "number", description: "The order ID" },
278
+ name: { type: "string", description: "Optional: Customer name for invoice" },
279
+ email: { type: "string", description: "Optional: Customer email for invoice" },
280
+ address: { type: "string", description: "Optional: Customer address" },
281
+ city: { type: "string", description: "Optional: Customer city" },
282
+ state: { type: "string", description: "Optional: Customer state/region" },
283
+ zip: { type: "string", description: "Optional: Customer zip/postal code" },
284
+ country: { type: "string", description: "Optional: Customer country" },
285
+ },
286
+ required: ["orderId"],
287
+ },
288
+ },
289
+ {
290
+ name: TOOLS.ISSUE_ORDER_REFUND,
291
+ description: "Issue a refund for an order.",
292
+ inputSchema: {
293
+ type: "object",
294
+ properties: {
295
+ orderId: { type: "number", description: "The order ID" },
296
+ amount: { type: "number", description: "The refund amount in cents" },
297
+ },
298
+ required: ["orderId", "amount"],
299
+ },
300
+ },
301
+ // Subscriptions
302
+ {
303
+ name: TOOLS.GET_SUBSCRIPTION,
304
+ description: "Check the status of a subscription. Use this to verify if credits should be active, subscription status, renewal dates, and billing information.",
305
+ inputSchema: {
306
+ type: "object",
307
+ properties: {
308
+ subscriptionId: { type: "number", description: "The ID of the subscription" },
309
+ },
310
+ required: ["subscriptionId"],
311
+ },
312
+ },
313
+ {
314
+ name: TOOLS.LIST_SUBSCRIPTIONS,
315
+ description: "List all subscriptions, optionally filtered by store or customer.",
316
+ inputSchema: {
317
+ type: "object",
318
+ properties: {
319
+ storeId: { type: "number", description: "Optional: Filter by store ID" },
320
+ page: { type: "number", description: "Optional: Page number for pagination" },
321
+ },
322
+ required: [],
323
+ },
324
+ },
325
+ {
326
+ name: TOOLS.UPDATE_SUBSCRIPTION,
327
+ description: "Update a subscription (e.g., change plan, update billing details).",
328
+ inputSchema: {
329
+ type: "object",
330
+ properties: {
331
+ subscriptionId: { type: "number", description: "The subscription ID" },
332
+ variantId: { type: "number", description: "Optional: New variant/plan ID" },
333
+ productId: { type: "number", description: "Optional: New product ID" },
334
+ billingAnchor: { type: "number", description: "Optional: Billing anchor day" },
335
+ },
336
+ required: ["subscriptionId"],
337
+ },
338
+ },
339
+ {
340
+ name: TOOLS.CANCEL_SUBSCRIPTION,
341
+ description: "Cancel a subscription.",
342
+ inputSchema: {
343
+ type: "object",
344
+ properties: {
345
+ subscriptionId: { type: "number", description: "The subscription ID" },
346
+ },
347
+ required: ["subscriptionId"],
348
+ },
349
+ },
350
+ // Subscription Items
351
+ {
352
+ name: TOOLS.GET_SUBSCRIPTION_ITEM,
353
+ description: "Get details of a specific subscription item by ID.",
354
+ inputSchema: {
355
+ type: "object",
356
+ properties: {
357
+ subscriptionItemId: { type: "number", description: "The subscription item ID" },
358
+ },
359
+ required: ["subscriptionItemId"],
360
+ },
361
+ },
362
+ {
363
+ name: TOOLS.LIST_SUBSCRIPTION_ITEMS,
364
+ description: "List subscription items, optionally filtered by subscription.",
365
+ inputSchema: {
366
+ type: "object",
367
+ properties: {
368
+ subscriptionId: { type: "number", description: "Optional: Filter by subscription ID" },
369
+ page: { type: "number", description: "Optional: Page number for pagination" },
370
+ },
371
+ required: [],
372
+ },
373
+ },
374
+ {
375
+ name: TOOLS.GET_SUBSCRIPTION_ITEM_USAGE,
376
+ description: "Get current usage statistics for a subscription item (useful for usage-based billing).",
377
+ inputSchema: {
378
+ type: "object",
379
+ properties: {
380
+ subscriptionItemId: { type: "number", description: "The subscription item ID" },
381
+ },
382
+ required: ["subscriptionItemId"],
383
+ },
384
+ },
385
+ // Subscription Invoices
386
+ {
387
+ name: TOOLS.GET_SUBSCRIPTION_INVOICE,
388
+ description: "Get details of a specific subscription invoice by ID.",
389
+ inputSchema: {
390
+ type: "object",
391
+ properties: {
392
+ subscriptionInvoiceId: { type: "number", description: "The subscription invoice ID" },
393
+ },
394
+ required: ["subscriptionInvoiceId"],
395
+ },
396
+ },
397
+ {
398
+ name: TOOLS.LIST_SUBSCRIPTION_INVOICES,
399
+ description: "List subscription invoices, optionally filtered by subscription.",
400
+ inputSchema: {
401
+ type: "object",
402
+ properties: {
403
+ subscriptionId: { type: "number", description: "Optional: Filter by subscription ID" },
404
+ page: { type: "number", description: "Optional: Page number for pagination" },
405
+ },
406
+ required: [],
407
+ },
408
+ },
409
+ {
410
+ name: TOOLS.GENERATE_SUBSCRIPTION_INVOICE,
411
+ description: "Generate an invoice for a subscription.",
412
+ inputSchema: {
413
+ type: "object",
414
+ properties: {
415
+ subscriptionInvoiceId: { type: "number", description: "The subscription invoice ID" },
416
+ },
417
+ required: ["subscriptionInvoiceId"],
418
+ },
419
+ },
420
+ {
421
+ name: TOOLS.ISSUE_SUBSCRIPTION_INVOICE_REFUND,
422
+ description: "Issue a refund for a subscription invoice.",
423
+ inputSchema: {
424
+ type: "object",
425
+ properties: {
426
+ subscriptionInvoiceId: { type: "number", description: "The subscription invoice ID" },
427
+ amount: { type: "number", description: "The refund amount in cents" },
428
+ },
429
+ required: ["subscriptionInvoiceId", "amount"],
430
+ },
431
+ },
432
+ // Discounts
433
+ {
434
+ name: TOOLS.GET_DISCOUNT,
435
+ description: "Get details of a specific discount by ID.",
436
+ inputSchema: {
437
+ type: "object",
438
+ properties: {
439
+ discountId: { type: "number", description: "The discount ID" },
440
+ },
441
+ required: ["discountId"],
442
+ },
443
+ },
444
+ {
445
+ name: TOOLS.LIST_DISCOUNTS,
446
+ description: "List all discounts, optionally filtered by store.",
447
+ inputSchema: {
448
+ type: "object",
449
+ properties: {
450
+ storeId: { type: "number", description: "Optional: Filter by store ID" },
451
+ page: { type: "number", description: "Optional: Page number for pagination" },
452
+ },
453
+ required: [],
454
+ },
455
+ },
456
+ {
457
+ name: TOOLS.CREATE_DISCOUNT,
458
+ description: "Create a new discount code.",
459
+ inputSchema: {
460
+ type: "object",
461
+ properties: {
462
+ storeId: { type: "number", description: "The store ID" },
463
+ name: { type: "string", description: "Discount name" },
464
+ code: { type: "string", description: "Discount code" },
465
+ amount: { type: "number", description: "Discount amount" },
466
+ amountType: { type: "string", description: "Discount type: 'percent' or 'fixed'" },
467
+ duration: { type: "string", description: "Duration: 'once', 'forever', or 'repeating'" },
468
+ durationInMonths: { type: "number", description: "Optional: Duration in months if repeating" },
469
+ },
470
+ required: ["storeId", "name", "code", "amount", "amountType", "duration"],
471
+ },
472
+ },
473
+ {
474
+ name: TOOLS.DELETE_DISCOUNT,
475
+ description: "Delete a discount.",
476
+ inputSchema: {
477
+ type: "object",
478
+ properties: {
479
+ discountId: { type: "number", description: "The discount ID" },
480
+ },
481
+ required: ["discountId"],
482
+ },
483
+ },
484
+ // License Keys
485
+ {
486
+ name: TOOLS.GET_LICENSE_KEY,
487
+ description: "Get details of a specific license key by ID.",
488
+ inputSchema: {
489
+ type: "object",
490
+ properties: {
491
+ licenseKeyId: { type: "number", description: "The license key ID" },
492
+ },
493
+ required: ["licenseKeyId"],
494
+ },
495
+ },
496
+ {
497
+ name: TOOLS.LIST_LICENSE_KEYS,
498
+ description: "List license keys, optionally filtered by store or order.",
499
+ inputSchema: {
500
+ type: "object",
501
+ properties: {
502
+ storeId: { type: "number", description: "Optional: Filter by store ID" },
503
+ orderId: { type: "number", description: "Optional: Filter by order ID" },
504
+ page: { type: "number", description: "Optional: Page number for pagination" },
505
+ },
506
+ required: [],
507
+ },
508
+ },
509
+ {
510
+ name: TOOLS.UPDATE_LICENSE_KEY,
511
+ description: "Update a license key (e.g., activate, deactivate, update status).",
512
+ inputSchema: {
513
+ type: "object",
514
+ properties: {
515
+ licenseKeyId: { type: "number", description: "The license key ID" },
516
+ status: { type: "string", description: "Optional: Status ('active' or 'inactive')" },
517
+ },
518
+ required: ["licenseKeyId"],
519
+ },
520
+ },
521
+ // Files
522
+ {
523
+ name: TOOLS.GET_FILE,
524
+ description: "Get details of a specific file by ID.",
525
+ inputSchema: {
526
+ type: "object",
527
+ properties: {
528
+ fileId: { type: "number", description: "The file ID" },
529
+ },
530
+ required: ["fileId"],
531
+ },
532
+ },
533
+ {
534
+ name: TOOLS.LIST_FILES,
535
+ description: "List files, optionally filtered by product or variant.",
536
+ inputSchema: {
537
+ type: "object",
538
+ properties: {
539
+ productId: { type: "number", description: "Optional: Filter by product ID" },
540
+ variantId: { type: "number", description: "Optional: Filter by variant ID" },
541
+ page: { type: "number", description: "Optional: Page number for pagination" },
542
+ },
543
+ required: [],
544
+ },
545
+ },
546
+ // Usage Records
547
+ {
548
+ name: TOOLS.GET_USAGE_RECORD,
549
+ description: "Get details of a specific usage record by ID.",
550
+ inputSchema: {
551
+ type: "object",
552
+ properties: {
553
+ usageRecordId: { type: "number", description: "The usage record ID" },
554
+ },
555
+ required: ["usageRecordId"],
556
+ },
557
+ },
558
+ {
559
+ name: TOOLS.LIST_USAGE_RECORDS,
560
+ description: "List usage records, optionally filtered by subscription item.",
561
+ inputSchema: {
562
+ type: "object",
563
+ properties: {
564
+ subscriptionItemId: { type: "number", description: "Optional: Filter by subscription item ID" },
565
+ page: { type: "number", description: "Optional: Page number for pagination" },
566
+ },
567
+ required: [],
568
+ },
569
+ },
570
+ {
571
+ name: TOOLS.CREATE_USAGE_RECORD,
572
+ description: "Create a new usage record for a subscription item (for usage-based billing).",
573
+ inputSchema: {
574
+ type: "object",
575
+ properties: {
576
+ subscriptionItemId: { type: "number", description: "The subscription item ID" },
577
+ quantity: { type: "number", description: "The usage quantity" },
578
+ action: { type: "string", description: "The action (e.g., 'increment', 'set')" },
579
+ },
580
+ required: ["subscriptionItemId", "quantity", "action"],
581
+ },
582
+ },
583
+ // Checkouts
584
+ {
585
+ name: TOOLS.CREATE_CHECKOUT,
586
+ description: "Create a new checkout session for a product variant.",
587
+ inputSchema: {
588
+ type: "object",
589
+ properties: {
590
+ storeId: { type: "number", description: "The store ID" },
591
+ variantId: { type: "number", description: "The variant ID" },
592
+ customPrice: { type: "number", description: "Optional: Custom price in cents" },
593
+ productOptions: { type: "object", description: "Optional: Product options" },
594
+ checkoutOptions: { type: "object", description: "Optional: Checkout options" },
595
+ checkoutData: { type: "object", description: "Optional: Additional checkout data" },
596
+ preview: { type: "boolean", description: "Optional: Preview mode" },
597
+ expiresAt: { type: "string", description: "Optional: Expiration date (ISO 8601)" },
598
+ },
599
+ required: ["storeId", "variantId"],
600
+ },
601
+ },
602
+ // Webhooks
603
+ {
604
+ name: TOOLS.GET_WEBHOOK,
605
+ description: "Get details of a specific webhook by ID.",
606
+ inputSchema: {
607
+ type: "object",
608
+ properties: {
609
+ webhookId: { type: "number", description: "The webhook ID" },
610
+ },
611
+ required: ["webhookId"],
612
+ },
613
+ },
614
+ {
615
+ name: TOOLS.LIST_WEBHOOKS,
616
+ description: "List all webhooks, optionally filtered by store.",
617
+ inputSchema: {
618
+ type: "object",
619
+ properties: {
620
+ storeId: { type: "number", description: "Optional: Filter by store ID" },
621
+ page: { type: "number", description: "Optional: Page number for pagination" },
622
+ },
623
+ required: [],
624
+ },
625
+ },
626
+ {
627
+ name: TOOLS.CREATE_WEBHOOK,
628
+ description: "Create a new webhook.",
629
+ inputSchema: {
630
+ type: "object",
631
+ properties: {
632
+ storeId: { type: "number", description: "The store ID" },
633
+ url: { type: "string", description: "The webhook URL" },
634
+ events: { type: "array", items: { type: "string" }, description: "Array of event types to subscribe to" },
635
+ secret: { type: "string", description: "Optional: Webhook secret for verification" },
636
+ },
637
+ required: ["storeId", "url", "events"],
638
+ },
639
+ },
640
+ {
641
+ name: TOOLS.UPDATE_WEBHOOK,
642
+ description: "Update an existing webhook.",
643
+ inputSchema: {
644
+ type: "object",
645
+ properties: {
646
+ webhookId: { type: "number", description: "The webhook ID" },
647
+ url: { type: "string", description: "Optional: New webhook URL" },
648
+ events: { type: "array", items: { type: "string" }, description: "Optional: New event types" },
649
+ secret: { type: "string", description: "Optional: New webhook secret" },
650
+ },
651
+ required: ["webhookId"],
652
+ },
653
+ },
654
+ {
655
+ name: TOOLS.DELETE_WEBHOOK,
656
+ description: "Delete a webhook.",
657
+ inputSchema: {
658
+ type: "object",
659
+ properties: {
660
+ webhookId: { type: "number", description: "The webhook ID" },
661
+ },
662
+ required: ["webhookId"],
663
+ },
664
+ },
665
+ // Salesforce (Bonus Integration)
666
+ {
667
+ name: TOOLS.SYNC_CUSTOMER_TO_CRM,
668
+ description: "Sync a customer to Salesforce CRM. Checks if a Lead with the email exists, and if not, creates a new Lead with source 'AI Agent'. Returns the Lead ID.",
669
+ inputSchema: {
670
+ type: "object",
671
+ properties: {
672
+ email: { type: "string", description: "Customer email address" },
673
+ name: { type: "string", description: "Customer name" },
674
+ revenue: { type: "number", description: "Optional: Customer revenue/lifetime value" },
675
+ company: { type: "string", description: "Optional: Company name (if not provided, uses customer name)" },
676
+ title: { type: "string", description: "Optional: Job title" },
677
+ },
678
+ required: ["email", "name"],
679
+ },
680
+ },
681
+ // VOS Tools
682
+ {
683
+ name: TOOLS.SEARCH_TRANSACTIONS_NATURAL,
684
+ description: "Search transactions using natural language (e.g., 'refunds from yesterday', 'subscriptions this week'). Cross-references Lemon Squeezy and Firestore.",
685
+ inputSchema: {
686
+ type: "object",
687
+ properties: {
688
+ query: { type: "string", description: "Natural language query" },
689
+ },
690
+ required: ["query"],
691
+ },
692
+ },
693
+ {
694
+ name: TOOLS.ANALYZE_CHURN_RISK,
695
+ description: "Identify users with active subscriptions who haven't logged in recently (>28 days).",
696
+ inputSchema: {
697
+ type: "object",
698
+ properties: {},
699
+ },
700
+ },
701
+ {
702
+ name: TOOLS.CANONIZE_DECISION,
703
+ description: "Record a business decision with a snapshot of current active user metrics.",
704
+ inputSchema: {
705
+ type: "object",
706
+ properties: {
707
+ decision: { type: "string", description: "What was decided" },
708
+ rationale: { type: "string", description: "Why" },
709
+ expectedOutcome: { type: "string", description: "What we expect to happen" },
710
+ category: { type: "string", description: "Optional: 'pricing', 'product', 'marketing', etc." },
711
+ },
712
+ required: ["decision", "rationale", "expectedOutcome"],
713
+ },
714
+ },
715
+ // Analytics Tools
716
+ {
717
+ name: TOOLS.GET_FINANCIAL_METRICS,
718
+ description: "Calculate comprehensive financial metrics including revenue (total, by period, growth rates), MRR/ARR, subscription metrics, order statistics, and customer metrics. Supports date range filtering.",
719
+ inputSchema: {
720
+ type: "object",
721
+ properties: {
722
+ storeId: { type: "number", description: "Optional: Filter by specific store ID" },
723
+ startDate: {
724
+ type: "string",
725
+ description: "Optional: Start date for metrics calculation (ISO 8601 format, e.g., '2024-01-01')",
726
+ },
727
+ endDate: {
728
+ type: "string",
729
+ description: "Optional: End date for metrics calculation (ISO 8601 format, e.g., '2024-12-31')",
730
+ },
731
+ },
732
+ required: [],
733
+ },
734
+ },
735
+ {
736
+ name: TOOLS.PREDICT_CHURN_RISK,
737
+ description: "Predict churn risk for active subscriptions by analyzing payment history, subscription age, status, and activity patterns. Returns risk scores (0-100) and risk levels (low/medium/high/critical) with detailed factors.",
738
+ inputSchema: {
739
+ type: "object",
740
+ properties: {
741
+ storeId: { type: "number", description: "Optional: Filter by specific store ID" },
742
+ minRiskScore: {
743
+ type: "number",
744
+ description: "Optional: Minimum risk score to include (0-100, default: 0)",
745
+ },
746
+ limit: { type: "number", description: "Optional: Maximum number of predictions to return (default: 50)" },
747
+ },
748
+ required: [],
749
+ },
750
+ },
751
+ ];
752
+ }
753
+ //# sourceMappingURL=definitions.js.map