@01.software/cli 0.10.5 → 0.10.6

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.
@@ -1,6 +1,75 @@
1
1
  // src/server.ts
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
 
4
+ // src/resource-inventory.ts
5
+ var MCP_RESOURCE_INVENTORY = [
6
+ { uri: "config://app", label: "config", registeredName: "app-config" },
7
+ {
8
+ uri: "collections://schema",
9
+ label: "collections-schema",
10
+ registeredName: "collections-schema"
11
+ },
12
+ {
13
+ uri: "docs://sdk/getting-started",
14
+ label: "getting-started",
15
+ registeredName: "docs-getting-started"
16
+ },
17
+ { uri: "docs://sdk/guides", label: "guides", registeredName: "docs-guides" },
18
+ { uri: "docs://sdk/api", label: "api", registeredName: "docs-api" },
19
+ {
20
+ uri: "docs://sdk/query-builder",
21
+ label: "query-builder",
22
+ registeredName: "docs-query-builder"
23
+ },
24
+ {
25
+ uri: "docs://sdk/react-query",
26
+ label: "react-query",
27
+ registeredName: "docs-react-query"
28
+ },
29
+ {
30
+ uri: "docs://sdk/server-api",
31
+ label: "server-api",
32
+ registeredName: "docs-server-api"
33
+ },
34
+ {
35
+ uri: "docs://sdk/customer-auth",
36
+ label: "customer-auth",
37
+ registeredName: "docs-customer-auth"
38
+ },
39
+ {
40
+ uri: "docs://sdk/browser-vs-server",
41
+ label: "browser-vs-server",
42
+ registeredName: "docs-browser-vs-server"
43
+ },
44
+ {
45
+ uri: "docs://sdk/file-upload",
46
+ label: "file-upload",
47
+ registeredName: "docs-file-upload"
48
+ },
49
+ {
50
+ uri: "docs://sdk/webhook",
51
+ label: "webhook",
52
+ registeredName: "docs-webhook"
53
+ },
54
+ {
55
+ uri: "docs://sdk/product-detail",
56
+ label: "product-detail",
57
+ registeredName: "docs-product-detail"
58
+ }
59
+ ];
60
+ var MCP_RESOURCE_LABELS = MCP_RESOURCE_INVENTORY.map(
61
+ (resource) => resource.label
62
+ );
63
+ function mcpResourceUri(registeredName) {
64
+ const resource = MCP_RESOURCE_INVENTORY.find(
65
+ (entry) => entry.registeredName === registeredName
66
+ );
67
+ if (!resource) {
68
+ throw new Error(`Unknown MCP resource inventory entry: ${registeredName}`);
69
+ }
70
+ return resource.uri;
71
+ }
72
+
4
73
  // src/lib/request-context.ts
5
74
  import { AsyncLocalStorage } from "async_hooks";
6
75
  var requestContext = new AsyncLocalStorage();
@@ -247,6 +316,38 @@ var transactionStatusSchema = z2.enum([
247
316
  "failed",
248
317
  "canceled"
249
318
  ]);
319
+ var entityIdSchema = z2.union([z2.string(), z2.number()]).transform(String);
320
+ var createOrderItemSchema = z2.object({
321
+ product: entityIdSchema,
322
+ variant: entityIdSchema,
323
+ option: entityIdSchema,
324
+ quantity: z2.number().int().positive("quantity must be a positive integer"),
325
+ unitPrice: z2.number().optional(),
326
+ totalPrice: z2.number().optional()
327
+ });
328
+ var createOrderSchema = z2.object({
329
+ pgPaymentId: z2.string().min(1).optional(),
330
+ orderNumber: z2.string().min(1, "orderNumber is required"),
331
+ customer: entityIdSchema.optional(),
332
+ customerSnapshot: z2.object({
333
+ name: z2.string().optional(),
334
+ email: z2.string().email("Invalid email format"),
335
+ phone: z2.string().optional()
336
+ }),
337
+ shippingAddress: z2.object({
338
+ postalCode: z2.string().optional(),
339
+ address: z2.string().optional(),
340
+ detailAddress: z2.string().optional(),
341
+ deliveryMessage: z2.string().optional(),
342
+ recipientName: z2.string().optional(),
343
+ phone: z2.string().optional()
344
+ }),
345
+ orderItems: z2.array(createOrderItemSchema).min(1, "At least one order item is required").max(100, "Maximum 100 items per order"),
346
+ totalAmount: z2.number().nonnegative("totalAmount must be non-negative"),
347
+ shippingAmount: z2.number().min(0).optional(),
348
+ discountCode: z2.string().optional()
349
+ });
350
+ var CreateOrderSchema = createOrderSchema;
250
351
  var updateTransactionSchema = z2.object({
251
352
  pgPaymentId: z2.string().min(1, "pgPaymentId is required").describe("PG payment ID (required)"),
252
353
  status: transactionStatusSchema.describe(
@@ -281,6 +382,7 @@ var confirmPaymentSchema = z2.object({
281
382
  ]).optional(),
282
383
  metadata: z2.record(z2.string(), z2.unknown()).optional()
283
384
  }).strict();
385
+ var ConfirmPaymentSchema = confirmPaymentSchema;
284
386
  var returnReasonSchema = z2.enum([
285
387
  "change_of_mind",
286
388
  "defective",
@@ -410,6 +512,11 @@ var MCP_TOOL_CONTRACT = {
410
512
  oauthScope: "mcp:write",
411
513
  readOnly: false
412
514
  },
515
+ "confirm-payment": {
516
+ consoleRole: "tenant-admin",
517
+ oauthScope: "mcp:write",
518
+ readOnly: false
519
+ },
413
520
  "update-order": {
414
521
  consoleRole: "tenant-admin",
415
522
  oauthScope: "mcp:write",
@@ -660,6 +767,14 @@ var TOOL_POLICY_MANIFEST = {
660
767
  consoleSurface: "POST /api/orders",
661
768
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
662
769
  },
770
+ "confirm-payment": {
771
+ category: "mutation-transaction",
772
+ oauthScope: MCP_SCOPES.write,
773
+ consoleRole: "tenant-admin",
774
+ consoleSurface: "POST /api/orders/confirm-payment",
775
+ annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
776
+ exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
777
+ },
663
778
  "update-order": {
664
779
  category: "mutation-order",
665
780
  oauthScope: MCP_SCOPES.write,
@@ -753,7 +868,15 @@ var TOOL_POLICY_MANIFEST = {
753
868
  annotationPolicy: READ_ONLY_ANNOTATION
754
869
  }
755
870
  };
756
- function evaluateToolPolicy(toolName, scopes) {
871
+ var CONSOLE_ROLE_RANK = {
872
+ "tenant-viewer": 0,
873
+ "tenant-editor": 1,
874
+ "tenant-admin": 2
875
+ };
876
+ function hasRequiredConsoleRole(tenantRole, requiredRole) {
877
+ return CONSOLE_ROLE_RANK[tenantRole] >= CONSOLE_ROLE_RANK[requiredRole];
878
+ }
879
+ function evaluateToolPolicy(toolName, scopes, tenantRole) {
757
880
  if (!isMcpToolName(toolName)) {
758
881
  return {
759
882
  allowed: false,
@@ -769,6 +892,13 @@ function evaluateToolPolicy(toolName, scopes) {
769
892
  message: `Tool ${toolName} requires ${entry.oauthScope}`
770
893
  };
771
894
  }
895
+ if (!hasRequiredConsoleRole(tenantRole, entry.consoleRole)) {
896
+ return {
897
+ allowed: false,
898
+ reason: "insufficient_role",
899
+ message: `Tool ${toolName} requires ${entry.consoleRole}`
900
+ };
901
+ }
772
902
  return { allowed: true, entry };
773
903
  }
774
904
 
@@ -1261,25 +1391,7 @@ async function getOrder({
1261
1391
  }
1262
1392
 
1263
1393
  // src/tools/create-order.ts
1264
- import { z as z6 } from "zod";
1265
- var schema4 = {
1266
- pgPaymentId: z6.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1267
- orderNumber: z6.string().min(1).describe("Unique order number (required)"),
1268
- customerSnapshot: z6.object({
1269
- name: z6.string().optional().describe("Customer name"),
1270
- email: z6.string().describe("Customer email (required)"),
1271
- phone: z6.string().optional().describe("Customer phone")
1272
- }).describe("Customer snapshot at time of order (required)"),
1273
- shippingAddress: z6.record(z6.string(), z6.unknown()).describe(
1274
- "Shipping address object (required). Fields: postalCode, address1, address2, deliveryMessage, recipientName, phone"
1275
- ),
1276
- orderItems: z6.array(z6.record(z6.string(), z6.unknown())).describe(
1277
- "Array of order item objects (required). Each: { product, variant, option, quantity, unitPrice?, totalPrice? }"
1278
- ),
1279
- totalAmount: z6.number().nonnegative().describe("Total order amount (required, min 0)"),
1280
- shippingAmount: z6.number().nonnegative().optional().describe("Shipping amount (optional, default 0)"),
1281
- discountCode: z6.string().optional().describe("Discount code to apply (optional)")
1282
- };
1394
+ var schema4 = CreateOrderSchema.shape;
1283
1395
  var metadata4 = {
1284
1396
  name: "create-order",
1285
1397
  description: "Create a new order with products and shipping information. Supports idempotency.",
@@ -1293,9 +1405,8 @@ var metadata4 = {
1293
1405
  async function createOrder(params) {
1294
1406
  try {
1295
1407
  const client = getClient();
1296
- const result = await client.commerce.orders.create(
1297
- params
1298
- );
1408
+ const parsed = CreateOrderSchema.parse(params);
1409
+ const result = await client.commerce.orders.create(parsed);
1299
1410
  return toolSuccess({ data: result });
1300
1411
  } catch (error) {
1301
1412
  return toolError(error);
@@ -1303,10 +1414,10 @@ async function createOrder(params) {
1303
1414
  }
1304
1415
 
1305
1416
  // src/tools/update-order.ts
1306
- import { z as z7 } from "zod";
1417
+ import { z as z6 } from "zod";
1307
1418
  var schema5 = {
1308
- orderNumber: z7.string().min(1).describe("Order number (required)"),
1309
- status: z7.enum([
1419
+ orderNumber: z6.string().min(1).describe("Order number (required)"),
1420
+ status: z6.enum([
1310
1421
  "pending",
1311
1422
  "paid",
1312
1423
  "failed",
@@ -1343,15 +1454,15 @@ async function updateOrder({
1343
1454
  }
1344
1455
 
1345
1456
  // src/tools/checkout.ts
1346
- import { z as z8 } from "zod";
1457
+ import { z as z7 } from "zod";
1347
1458
  var schema6 = {
1348
- cartId: z8.string().min(1).describe("Cart ID to convert to order (required)"),
1349
- pgPaymentId: z8.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1350
- orderNumber: z8.string().min(1).describe("Unique order number (required)"),
1351
- customerSnapshot: z8.record(z8.string(), z8.unknown()).describe(
1459
+ cartId: z7.string().min(1).describe("Cart ID to convert to order (required)"),
1460
+ pgPaymentId: z7.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1461
+ orderNumber: z7.string().min(1).describe("Unique order number (required)"),
1462
+ customerSnapshot: z7.record(z7.string(), z7.unknown()).describe(
1352
1463
  "Customer snapshot object (required). Fields: { name?, email, phone? }"
1353
1464
  ),
1354
- discountCode: z8.string().optional().describe("Discount code to apply (optional)")
1465
+ discountCode: z7.string().optional().describe("Discount code to apply (optional)")
1355
1466
  };
1356
1467
  var metadata6 = {
1357
1468
  name: "checkout",
@@ -1376,17 +1487,17 @@ async function checkout(params) {
1376
1487
  }
1377
1488
 
1378
1489
  // src/tools/create-fulfillment.ts
1379
- import { z as z9 } from "zod";
1490
+ import { z as z8 } from "zod";
1380
1491
  var schema7 = {
1381
- orderNumber: z9.string().min(1).describe("Order number (required)"),
1382
- carrier: z9.string().optional().describe("Shipping carrier name (optional)"),
1383
- trackingNumber: z9.string().optional().describe(
1492
+ orderNumber: z8.string().min(1).describe("Order number (required)"),
1493
+ carrier: z8.string().optional().describe("Shipping carrier name (optional)"),
1494
+ trackingNumber: z8.string().optional().describe(
1384
1495
  'Tracking number (optional). Setting carrier + tracking triggers "shipped" status'
1385
1496
  ),
1386
- items: z9.array(
1387
- z9.object({
1388
- orderItem: z9.string().min(1).describe("Order item ID"),
1389
- quantity: z9.number().int().positive().describe("Quantity to fulfill")
1497
+ items: z8.array(
1498
+ z8.object({
1499
+ orderItem: z8.string().min(1).describe("Order item ID"),
1500
+ quantity: z8.number().int().positive().describe("Quantity to fulfill")
1390
1501
  })
1391
1502
  ).describe("Array of items to fulfill (required)")
1392
1503
  };
@@ -1421,16 +1532,16 @@ async function createFulfillment({
1421
1532
  }
1422
1533
 
1423
1534
  // src/tools/update-fulfillment.ts
1424
- import { z as z10 } from "zod";
1535
+ import { z as z9 } from "zod";
1425
1536
  var schema8 = {
1426
- fulfillmentId: z10.string().min(1).describe("Fulfillment ID (required)"),
1427
- status: z10.enum(["packed", "shipped", "delivered", "failed"]).describe(
1537
+ fulfillmentId: z9.string().min(1).describe("Fulfillment ID (required)"),
1538
+ status: z9.enum(["packed", "shipped", "delivered", "failed"]).describe(
1428
1539
  "New fulfillment status (required). FSM: pending\u2192packed/shipped/failed, packed\u2192shipped/failed, shipped\u2192delivered/failed"
1429
1540
  ),
1430
- carrier: z10.string().optional().describe(
1541
+ carrier: z9.string().optional().describe(
1431
1542
  "Shipping carrier (optional, changeable only in pending/packed status)"
1432
1543
  ),
1433
- trackingNumber: z10.string().optional().describe(
1544
+ trackingNumber: z9.string().optional().describe(
1434
1545
  "Tracking number (optional, changeable only in pending/packed status)"
1435
1546
  )
1436
1547
  };
@@ -1501,21 +1612,44 @@ async function updateTransaction({
1501
1612
  }
1502
1613
  }
1503
1614
 
1615
+ // src/tools/confirm-payment.ts
1616
+ var schema10 = ConfirmPaymentSchema.shape;
1617
+ var metadata10 = {
1618
+ name: "confirm-payment",
1619
+ description: "Confirm a provider-verified ecommerce payment through the generic payment confirmation flow.",
1620
+ annotations: {
1621
+ title: "Confirm payment",
1622
+ readOnlyHint: false,
1623
+ destructiveHint: true,
1624
+ idempotentHint: true
1625
+ }
1626
+ };
1627
+ async function confirmPayment(params) {
1628
+ try {
1629
+ const client = getClient();
1630
+ const parsed = ConfirmPaymentSchema.parse(params);
1631
+ const result = await client.commerce.orders.confirmPayment(parsed);
1632
+ return toolSuccess({ data: result });
1633
+ } catch (error) {
1634
+ return toolError(error);
1635
+ }
1636
+ }
1637
+
1504
1638
  // src/tools/create-return.ts
1505
- import { z as z11 } from "zod";
1506
- var schema10 = {
1507
- orderNumber: z11.string().min(1).describe("Order number (required)"),
1508
- reason: z11.enum(["change_of_mind", "defective", "wrong_delivery", "damaged", "other"]).optional().describe("Return reason (optional)"),
1509
- reasonDetail: z11.string().optional().describe("Detailed reason text (optional)"),
1510
- returnItems: z11.array(
1511
- z11.object({
1512
- orderItem: z11.string().min(1).describe("Order item ID"),
1513
- quantity: z11.number().int().positive().describe("Quantity to return")
1639
+ import { z as z10 } from "zod";
1640
+ var schema11 = {
1641
+ orderNumber: z10.string().min(1).describe("Order number (required)"),
1642
+ reason: z10.enum(["change_of_mind", "defective", "wrong_delivery", "damaged", "other"]).optional().describe("Return reason (optional)"),
1643
+ reasonDetail: z10.string().optional().describe("Detailed reason text (optional)"),
1644
+ returnItems: z10.array(
1645
+ z10.object({
1646
+ orderItem: z10.string().min(1).describe("Order item ID"),
1647
+ quantity: z10.number().int().positive().describe("Quantity to return")
1514
1648
  })
1515
1649
  ).describe("Array of products to return (required)"),
1516
- refundAmount: z11.number().nonnegative().describe("Refund amount (required, min 0)")
1650
+ refundAmount: z10.number().nonnegative().describe("Refund amount (required, min 0)")
1517
1651
  };
1518
- var metadata10 = {
1652
+ var metadata11 = {
1519
1653
  name: "create-return",
1520
1654
  description: "Create a return request for an order. Only works for delivered/confirmed orders. Updates order status to return_requested.",
1521
1655
  annotations: {
@@ -1548,14 +1682,14 @@ async function createReturn({
1548
1682
  }
1549
1683
 
1550
1684
  // src/tools/update-return.ts
1551
- import { z as z12 } from "zod";
1552
- var schema11 = {
1553
- returnId: z12.string().min(1).describe("Return ID (required)"),
1554
- status: z12.enum(["processing", "approved", "rejected", "completed"]).describe(
1685
+ import { z as z11 } from "zod";
1686
+ var schema12 = {
1687
+ returnId: z11.string().min(1).describe("Return ID (required)"),
1688
+ status: z11.enum(["processing", "approved", "rejected", "completed"]).describe(
1555
1689
  "New return status (required). Valid transitions: requested\u2192processing/rejected, processing\u2192approved/rejected, approved\u2192completed"
1556
1690
  )
1557
1691
  };
1558
- var metadata11 = {
1692
+ var metadata12 = {
1559
1693
  name: "update-return",
1560
1694
  description: "Update return status with FSM validation. Restores inventory on completion, reverts order status on rejection.",
1561
1695
  annotations: {
@@ -1579,8 +1713,8 @@ async function updateReturn({
1579
1713
  }
1580
1714
 
1581
1715
  // src/tools/return-with-refund.ts
1582
- var schema12 = ReturnWithRefundSchema.shape;
1583
- var metadata12 = {
1716
+ var schema13 = ReturnWithRefundSchema.shape;
1717
+ var metadata13 = {
1584
1718
  name: "return-with-refund",
1585
1719
  description: "Combined return + refund operation. Creates return, restores stock, cancels transaction, updates order status.",
1586
1720
  annotations: {
@@ -1620,15 +1754,15 @@ async function returnWithRefund({
1620
1754
  }
1621
1755
 
1622
1756
  // src/tools/add-cart-item.ts
1623
- import { z as z13 } from "zod";
1624
- var schema13 = {
1625
- cartId: z13.string().min(1).describe("Cart ID (required)"),
1626
- product: z13.string().min(1).describe("Product ID (required)"),
1627
- variant: z13.string().min(1).describe("Product variant ID (required)"),
1628
- option: z13.string().min(1).describe("Product option ID (required)"),
1629
- quantity: z13.number().int().positive().describe("Quantity to add (required, positive integer)")
1757
+ import { z as z12 } from "zod";
1758
+ var schema14 = {
1759
+ cartId: z12.string().min(1).describe("Cart ID (required)"),
1760
+ product: z12.string().min(1).describe("Product ID (required)"),
1761
+ variant: z12.string().min(1).describe("Product variant ID (required)"),
1762
+ option: z12.string().min(1).describe("Product option ID (required)"),
1763
+ quantity: z12.number().int().positive().describe("Quantity to add (required, positive integer)")
1630
1764
  };
1631
- var metadata13 = {
1765
+ var metadata14 = {
1632
1766
  name: "add-cart-item",
1633
1767
  description: "Add a product to cart. Validates stock, merges quantity if item already exists, recalculates totals.",
1634
1768
  annotations: {
@@ -1661,12 +1795,12 @@ async function addCartItem({
1661
1795
  }
1662
1796
 
1663
1797
  // src/tools/update-cart-item.ts
1664
- import { z as z14 } from "zod";
1665
- var schema14 = {
1666
- cartItemId: z14.string().min(1).describe("Cart item ID (required)"),
1667
- quantity: z14.number().int().positive().describe("New quantity (required, positive integer)")
1798
+ import { z as z13 } from "zod";
1799
+ var schema15 = {
1800
+ cartItemId: z13.string().min(1).describe("Cart item ID (required)"),
1801
+ quantity: z13.number().int().positive().describe("New quantity (required, positive integer)")
1668
1802
  };
1669
- var metadata14 = {
1803
+ var metadata15 = {
1670
1804
  name: "update-cart-item",
1671
1805
  description: "Update cart item quantity. Validates stock availability, recalculates cart totals.",
1672
1806
  annotations: {
@@ -1690,11 +1824,11 @@ async function updateCartItem({
1690
1824
  }
1691
1825
 
1692
1826
  // src/tools/remove-cart-item.ts
1693
- import { z as z15 } from "zod";
1694
- var schema15 = {
1695
- cartItemId: z15.string().min(1).describe("Cart item ID to remove (required)")
1827
+ import { z as z14 } from "zod";
1828
+ var schema16 = {
1829
+ cartItemId: z14.string().min(1).describe("Cart item ID to remove (required)")
1696
1830
  };
1697
- var metadata15 = {
1831
+ var metadata16 = {
1698
1832
  name: "remove-cart-item",
1699
1833
  description: "Remove an item from cart. Recalculates cart totals after removal.",
1700
1834
  annotations: {
@@ -1717,12 +1851,12 @@ async function removeCartItem({
1717
1851
  }
1718
1852
 
1719
1853
  // src/tools/apply-discount.ts
1720
- import { z as z16 } from "zod";
1721
- var schema16 = {
1722
- cartId: z16.string().min(1).describe("Cart ID (required)"),
1723
- discountCode: z16.string().describe("Discount code to apply (required)")
1854
+ import { z as z15 } from "zod";
1855
+ var schema17 = {
1856
+ cartId: z15.string().min(1).describe("Cart ID (required)"),
1857
+ discountCode: z15.string().describe("Discount code to apply (required)")
1724
1858
  };
1725
- var metadata16 = {
1859
+ var metadata17 = {
1726
1860
  name: "apply-discount",
1727
1861
  description: "Apply a discount code to a cart. Validates the code, updates cart totals, and sets free shipping if applicable.",
1728
1862
  annotations: {
@@ -1746,11 +1880,11 @@ async function applyDiscount({
1746
1880
  }
1747
1881
 
1748
1882
  // src/tools/remove-discount.ts
1749
- import { z as z17 } from "zod";
1750
- var schema17 = {
1751
- cartId: z17.string().min(1).describe("Cart ID (required)")
1883
+ import { z as z16 } from "zod";
1884
+ var schema18 = {
1885
+ cartId: z16.string().min(1).describe("Cart ID (required)")
1752
1886
  };
1753
- var metadata17 = {
1887
+ var metadata18 = {
1754
1888
  name: "remove-discount",
1755
1889
  description: "Remove the applied discount code from a cart and recalculate totals.",
1756
1890
  annotations: {
@@ -1773,11 +1907,11 @@ async function removeDiscount({
1773
1907
  }
1774
1908
 
1775
1909
  // src/tools/clear-cart.ts
1776
- import { z as z18 } from "zod";
1777
- var schema18 = {
1778
- cartId: z18.string().min(1).describe("Cart ID (required)")
1910
+ import { z as z17 } from "zod";
1911
+ var schema19 = {
1912
+ cartId: z17.string().min(1).describe("Cart ID (required)")
1779
1913
  };
1780
- var metadata18 = {
1914
+ var metadata19 = {
1781
1915
  name: "clear-cart",
1782
1916
  description: "Remove all items from a cart, reset discount and amounts. Shipping fee is preserved.",
1783
1917
  annotations: {
@@ -1800,12 +1934,12 @@ async function clearCart({
1800
1934
  }
1801
1935
 
1802
1936
  // src/tools/validate-discount.ts
1803
- import { z as z19 } from "zod";
1804
- var schema19 = {
1805
- code: z19.string().describe("Discount code to validate (required)"),
1806
- orderAmount: z19.number().describe("Order amount for validation (required)")
1937
+ import { z as z18 } from "zod";
1938
+ var schema20 = {
1939
+ code: z18.string().describe("Discount code to validate (required)"),
1940
+ orderAmount: z18.number().describe("Order amount for validation (required)")
1807
1941
  };
1808
- var metadata19 = {
1942
+ var metadata20 = {
1809
1943
  name: "validate-discount",
1810
1944
  description: "Validate a discount code. Checks active status, date range, usage limits, minimum order amount, and calculates discount.",
1811
1945
  annotations: {
@@ -1832,13 +1966,13 @@ async function validateDiscount({
1832
1966
  }
1833
1967
 
1834
1968
  // src/tools/calculate-shipping.ts
1835
- import { z as z20 } from "zod";
1836
- var schema20 = {
1837
- shippingPolicyId: z20.string().optional().describe("Shipping policy ID (uses default policy if omitted)"),
1838
- orderAmount: z20.number().describe("Order amount for fee calculation (required)"),
1839
- postalCode: z20.string().optional().describe("Postal code for Jeju surcharge detection (63000-63644)")
1969
+ import { z as z19 } from "zod";
1970
+ var schema21 = {
1971
+ shippingPolicyId: z19.string().optional().describe("Shipping policy ID (uses default policy if omitted)"),
1972
+ orderAmount: z19.number().describe("Order amount for fee calculation (required)"),
1973
+ postalCode: z19.string().optional().describe("Postal code for Jeju surcharge detection (63000-63644)")
1840
1974
  };
1841
- var metadata20 = {
1975
+ var metadata21 = {
1842
1976
  name: "calculate-shipping",
1843
1977
  description: "Calculate shipping fee based on order amount and postal code. Supports free shipping threshold and Jeju surcharge.",
1844
1978
  annotations: {
@@ -1867,18 +2001,18 @@ async function calculateShipping({
1867
2001
  }
1868
2002
 
1869
2003
  // src/tools/stock-check.ts
1870
- import { z as z21 } from "zod";
1871
- var schema21 = {
1872
- items: z21.array(
1873
- z21.object({
1874
- variantId: z21.string().describe("Product variant ID"),
1875
- quantity: z21.number().int().positive().describe("Requested quantity")
2004
+ import { z as z20 } from "zod";
2005
+ var schema22 = {
2006
+ items: z20.array(
2007
+ z20.object({
2008
+ variantId: z20.string().describe("Product variant ID"),
2009
+ quantity: z20.number().int().positive().describe("Requested quantity")
1876
2010
  })
1877
2011
  ).describe(
1878
2012
  "Array of items to check stock for (required, max 100). Each: { variantId, quantity }"
1879
2013
  )
1880
2014
  };
1881
- var metadata21 = {
2015
+ var metadata22 = {
1882
2016
  name: "stock-check",
1883
2017
  description: "Batch check product option stock availability. Returns per-item availability and an allAvailable flag.",
1884
2018
  annotations: {
@@ -1901,12 +2035,12 @@ async function stockCheck({
1901
2035
  }
1902
2036
 
1903
2037
  // src/tools/product-detail.ts
1904
- import { z as z22 } from "zod";
1905
- var schema22 = {
1906
- slug: z22.string().optional().describe("Product slug (one of slug or id required)"),
1907
- id: z22.string().optional().describe("Product id (one of slug or id required)")
2038
+ import { z as z21 } from "zod";
2039
+ var schema23 = {
2040
+ slug: z21.string().optional().describe("Product slug (one of slug or id required)"),
2041
+ id: z21.string().optional().describe("Product id (one of slug or id required)")
1908
2042
  };
1909
- var metadata22 = {
2043
+ var metadata23 = {
1910
2044
  name: "product-detail",
1911
2045
  description: "Fetch full product detail by slug or id. Returns one resolver-ready product with variants, option slugs, option value slugs/media, brand, categories, tags, images, videos, and listing rollup, or null if missing/unpublished/wrong tenant/feature disabled.",
1912
2046
  annotations: {
@@ -1934,66 +2068,66 @@ async function productDetail({
1934
2068
  }
1935
2069
 
1936
2070
  // src/tools/product-upsert.ts
1937
- import { z as z23 } from "zod";
1938
- var optionValueSchema = z23.object({
1939
- id: z23.string().optional().describe("Stable existing option-value ID for rename-safe updates"),
1940
- value: z23.string().describe("Display label (e.g. Black, S)"),
1941
- slug: z23.string().optional().describe(
2071
+ import { z as z22 } from "zod";
2072
+ var optionValueSchema = z22.object({
2073
+ id: z22.string().optional().describe("Stable existing option-value ID for rename-safe updates"),
2074
+ value: z22.string().describe("Display label (e.g. Black, S)"),
2075
+ slug: z22.string().optional().describe(
1942
2076
  "Optional compatibility value token. The server generates one from value on create when omitted; not canonical identity."
1943
2077
  ),
1944
- swatchColor: z23.string().nullable().optional(),
1945
- thumbnail: z23.string().nullable().optional(),
1946
- images: z23.array(z23.string()).optional(),
1947
- metadata: z23.unknown().optional()
2078
+ swatchColor: z22.string().nullable().optional(),
2079
+ thumbnail: z22.string().nullable().optional(),
2080
+ images: z22.array(z22.string()).optional(),
2081
+ metadata: z22.unknown().optional()
1948
2082
  });
1949
- var optionSchema = z23.object({
1950
- id: z23.string().optional().describe("Stable existing option ID for rename-safe updates"),
1951
- title: z23.string().describe("Option name (e.g. Color, Size)"),
1952
- slug: z23.string().optional().describe(
2083
+ var optionSchema = z22.object({
2084
+ id: z22.string().optional().describe("Stable existing option ID for rename-safe updates"),
2085
+ title: z22.string().describe("Option name (e.g. Color, Size)"),
2086
+ slug: z22.string().optional().describe(
1953
2087
  "Optional compatibility option token. The server generates one from title on create when omitted; not canonical identity."
1954
2088
  ),
1955
- values: z23.array(optionValueSchema).describe("Allowed option values")
2089
+ values: z22.array(optionValueSchema).describe("Allowed option values")
1956
2090
  });
1957
- var variantOptionValueSchema = z23.object({
1958
- valueSlug: z23.string().optional(),
1959
- valueId: z23.string().optional(),
1960
- value: z23.string().optional()
2091
+ var variantOptionValueSchema = z22.object({
2092
+ valueSlug: z22.string().optional(),
2093
+ valueId: z22.string().optional(),
2094
+ value: z22.string().optional()
1961
2095
  });
1962
- var variantSchema = z23.object({
1963
- id: z23.string().optional().describe("Existing variant ID for updates"),
1964
- optionValues: z23.union([
1965
- z23.record(z23.string(), z23.union([z23.string(), variantOptionValueSchema])),
1966
- z23.array(z23.string())
2096
+ var variantSchema = z22.object({
2097
+ id: z22.string().optional().describe("Existing variant ID for updates"),
2098
+ optionValues: z22.union([
2099
+ z22.record(z22.string(), z22.union([z22.string(), variantOptionValueSchema])),
2100
+ z22.array(z22.string())
1967
2101
  ]).optional().describe(
1968
2102
  "Option-value selection. Prefer stable option-value IDs, either as an array or object values using { valueId }. Slug maps and exact { OptionTitle: ValueLabel } maps remain compatibility-only and fail when labels are ambiguous."
1969
2103
  ),
1970
- sku: z23.string().nullable().optional(),
1971
- title: z23.string().nullable().optional(),
1972
- price: z23.number().nonnegative().describe("Selling price (KRW, min 0)"),
1973
- compareAtPrice: z23.number().nonnegative().nullable().optional(),
1974
- stock: z23.number().int().nonnegative().optional(),
1975
- isUnlimited: z23.boolean().optional(),
1976
- weight: z23.number().nonnegative().nullable().optional(),
1977
- requiresShipping: z23.boolean().optional(),
1978
- barcode: z23.string().nullable().optional(),
1979
- externalId: z23.string().nullable().optional(),
1980
- isActive: z23.boolean().optional(),
1981
- thumbnail: z23.string().nullable().optional(),
1982
- images: z23.array(z23.string()).optional(),
1983
- metadata: z23.unknown().optional()
2104
+ sku: z22.string().nullable().optional(),
2105
+ title: z22.string().nullable().optional(),
2106
+ price: z22.number().nonnegative().describe("Selling price (KRW, min 0)"),
2107
+ compareAtPrice: z22.number().nonnegative().nullable().optional(),
2108
+ stock: z22.number().int().nonnegative().optional(),
2109
+ isUnlimited: z22.boolean().optional(),
2110
+ weight: z22.number().nonnegative().nullable().optional(),
2111
+ requiresShipping: z22.boolean().optional(),
2112
+ barcode: z22.string().nullable().optional(),
2113
+ externalId: z22.string().nullable().optional(),
2114
+ isActive: z22.boolean().optional(),
2115
+ thumbnail: z22.string().nullable().optional(),
2116
+ images: z22.array(z22.string()).optional(),
2117
+ metadata: z22.unknown().optional()
1984
2118
  });
1985
- var schema23 = {
1986
- product: z23.record(z23.string(), z23.unknown()).describe(
2119
+ var schema24 = {
2120
+ product: z22.record(z22.string(), z22.unknown()).describe(
1987
2121
  "Product fields. Include `id` to update an existing product; omit for create (then `title` is required)."
1988
2122
  ),
1989
- options: z23.array(optionSchema).optional().describe(
2123
+ options: z22.array(optionSchema).optional().describe(
1990
2124
  "Option definitions. Include stable option/value IDs when updating or renaming existing rows. Slugs are optional compatibility metadata generated from title/value on create when omitted; omitted options on an existing product are deleted (with their values)."
1991
2125
  ),
1992
- variants: z23.array(variantSchema).optional().describe(
2126
+ variants: z22.array(variantSchema).optional().describe(
1993
2127
  "Variant rows. Prefer stable option-value IDs in optionValues. Slug/title maps are compatibility inputs. Omitted variants on an existing product are deleted, unless referenced by an active cart or non-terminal order \u2014 those are soft-deactivated (isActive: false)."
1994
2128
  )
1995
2129
  };
1996
- var metadata23 = {
2130
+ var metadata24 = {
1997
2131
  name: "product-upsert",
1998
2132
  description: "Atomically create or update a product together with its options, option-values, and variants in a single transaction. Mirrors Shopify productSet semantics. Any failure rolls back the entire write.",
1999
2133
  annotations: {
@@ -2030,8 +2164,8 @@ async function getCollectionSchema(collection) {
2030
2164
  }
2031
2165
 
2032
2166
  // src/tools/get-collection-schema.ts
2033
- var schema24 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2034
- var metadata24 = {
2167
+ var schema25 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2168
+ var metadata25 = {
2035
2169
  name: "get-collection-schema",
2036
2170
  description: "Get the authoritative tenant-aware collection schema from console. Use this before create/update to understand writable fields, hidden fields, required metadata, and collection-level visibility.",
2037
2171
  annotations: {
@@ -2082,8 +2216,8 @@ async function getTenantFeatureProgress(feature, includeEvidence = false) {
2082
2216
  }
2083
2217
 
2084
2218
  // src/tools/get-tenant-context.ts
2085
- var schema25 = tenantContextToolInputSchema.shape;
2086
- var metadata25 = {
2219
+ var schema26 = tenantContextToolInputSchema.shape;
2220
+ var metadata26 = {
2087
2221
  name: "get-tenant-context",
2088
2222
  description: "Get current tenant features, active collections, and field visibility. Call this at the start of every session. Use includeCounts=true to also get per-collection document counts for setup diagnostics.",
2089
2223
  annotations: {
@@ -2160,8 +2294,8 @@ async function handler({
2160
2294
  }
2161
2295
 
2162
2296
  // src/tools/check-feature-progress.ts
2163
- var schema26 = tenantFeatureProgressInputSchema.shape;
2164
- var metadata26 = {
2297
+ var schema27 = tenantFeatureProgressInputSchema.shape;
2298
+ var metadata27 = {
2165
2299
  name: "check-feature-progress",
2166
2300
  description: "Check tenant implementation progress for a supported feature. Start with feature=ecommerce to inspect catalog, cart, checkout, payment result, webhook, and operations readiness without mutating tenant data.",
2167
2301
  annotations: {
@@ -2184,7 +2318,7 @@ async function handler2({
2184
2318
  }
2185
2319
 
2186
2320
  // src/tools/list-configurable-fields.ts
2187
- import { z as z24 } from "zod";
2321
+ import { z as z23 } from "zod";
2188
2322
 
2189
2323
  // src/lib/field-config.ts
2190
2324
  async function fetchFieldConfigs() {
@@ -2207,12 +2341,12 @@ function invalidateFieldConfigCache() {
2207
2341
  }
2208
2342
 
2209
2343
  // src/tools/list-configurable-fields.ts
2210
- var schema27 = {
2211
- collection: z24.string().optional().describe(
2344
+ var schema28 = {
2345
+ collection: z23.string().optional().describe(
2212
2346
  "Filter by collection slug (optional \u2014 returns all if omitted). Use this filter to reduce response size when you know which collection to check."
2213
2347
  )
2214
2348
  };
2215
- var metadata27 = {
2349
+ var metadata28 = {
2216
2350
  name: "list-configurable-fields",
2217
2351
  description: "List all configurable fields for tenant collections with current visibility state. Shows which fields can be shown/hidden and their current status. Returns all collections including inactive features \u2014 cross-reference with get-tenant-context for active features. Response includes ~300 fields across 47 collections \u2014 use collection filter when possible.",
2218
2352
  annotations: {
@@ -2243,17 +2377,17 @@ async function listConfigurableFields(params) {
2243
2377
  }
2244
2378
 
2245
2379
  // src/tools/update-field-config.ts
2246
- import { z as z25 } from "zod";
2247
- var schema28 = {
2248
- collection: z25.string().min(1).describe("Collection slug (required)"),
2249
- hiddenFields: z25.array(z25.string().min(1).max(200)).max(300).describe(
2380
+ import { z as z24 } from "zod";
2381
+ var schema29 = {
2382
+ collection: z24.string().min(1).describe("Collection slug (required)"),
2383
+ hiddenFields: z24.array(z24.string().min(1).max(200)).max(300).describe(
2250
2384
  "Fields to hide (required). This is a FULL REPLACE \u2014 fields NOT in this list will be shown. Pass [] to show all fields. Use list-configurable-fields first to see available field paths."
2251
2385
  ),
2252
- isHidden: z25.boolean().optional().describe(
2386
+ isHidden: z24.boolean().optional().describe(
2253
2387
  "Hide the entire collection from Admin Panel (optional). When true, individual hiddenFields are irrelevant."
2254
2388
  )
2255
2389
  };
2256
- var metadata28 = {
2390
+ var metadata29 = {
2257
2391
  name: "update-field-config",
2258
2392
  description: "Update field visibility configuration for a tenant collection. Hidden fields are removed from the Admin Panel UI. IMPORTANT: hiddenFields is a full replace, not a merge. Always call list-configurable-fields first to see current state.",
2259
2393
  annotations: {
@@ -2281,7 +2415,7 @@ async function updateFieldConfig(params) {
2281
2415
  }
2282
2416
 
2283
2417
  // src/tools/sdk-get-recipe.ts
2284
- import { z as z26 } from "zod";
2418
+ import { z as z25 } from "zod";
2285
2419
 
2286
2420
  // src/lib/sdk-recipes.ts
2287
2421
  var recipes = {
@@ -2722,8 +2856,8 @@ function getRecipe(goal, runtime = "both") {
2722
2856
  }
2723
2857
 
2724
2858
  // src/tools/sdk-get-recipe.ts
2725
- var schema29 = {
2726
- goal: z26.enum([
2859
+ var schema30 = {
2860
+ goal: z25.enum([
2727
2861
  "fetch-list",
2728
2862
  "fetch-by-id",
2729
2863
  "create-item",
@@ -2735,11 +2869,11 @@ var schema29 = {
2735
2869
  "file-upload",
2736
2870
  "bulk-operations"
2737
2871
  ]).describe("What the user wants to accomplish"),
2738
- runtime: z26.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2739
- collection: z26.string().optional().describe("Specific collection name if applicable"),
2740
- includeExample: z26.boolean().default(true).describe("Whether to include a full code example")
2872
+ runtime: z25.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2873
+ collection: z25.string().optional().describe("Specific collection name if applicable"),
2874
+ includeExample: z25.boolean().default(true).describe("Whether to include a full code example")
2741
2875
  };
2742
- var metadata29 = {
2876
+ var metadata30 = {
2743
2877
  name: "sdk-get-recipe",
2744
2878
  description: "Get a complete SDK code recipe for a specific task. Returns recommended approach, code example, and related documentation links. Use this FIRST when the user asks how to do something with the SDK.",
2745
2879
  annotations: {
@@ -2782,7 +2916,7 @@ function handler3({
2782
2916
  }
2783
2917
 
2784
2918
  // src/tools/sdk-search-docs.ts
2785
- import { z as z27 } from "zod";
2919
+ import { z as z26 } from "zod";
2786
2920
 
2787
2921
  // src/lib/sdk-doc-index.ts
2788
2922
  var docIndex = [
@@ -2910,8 +3044,19 @@ var docIndex = [
2910
3044
  // Webhooks
2911
3045
  {
2912
3046
  title: "Webhooks",
2913
- keywords: ["webhook", "hmac", "signature", "WEBHOOK_SECRET", "server-to-server", "event"],
2914
- summary: "Tenant webhooks deliver server-to-server events such as password reset tokens. Signed with HMAC-SHA256 using PAYLOAD_SECRET.",
3047
+ keywords: [
3048
+ "webhook",
3049
+ "hmac",
3050
+ "signature",
3051
+ "WEBHOOK_SECRET",
3052
+ "server-to-server",
3053
+ "event",
3054
+ "order",
3055
+ "orderChanged",
3056
+ "collection.orderChanged",
3057
+ "isOrderChangedWebhookEvent"
3058
+ ],
3059
+ summary: "Tenant webhooks deliver signed server-to-server events via WEBHOOK_SECRET, including customer password reset and semantic order changes with collection.orderChanged / isOrderChangedWebhookEvent.",
2915
3060
  resourceUri: "docs://sdk/webhook"
2916
3061
  },
2917
3062
  // Order API
@@ -2957,11 +3102,11 @@ function searchDocs(query, limit = 5) {
2957
3102
  }
2958
3103
 
2959
3104
  // src/tools/sdk-search-docs.ts
2960
- var schema30 = {
2961
- query: z27.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
2962
- limit: z27.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
3105
+ var schema31 = {
3106
+ query: z26.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
3107
+ limit: z26.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
2963
3108
  };
2964
- var metadata30 = {
3109
+ var metadata31 = {
2965
3110
  name: "sdk-search-docs",
2966
3111
  description: "Search SDK documentation by keyword. Returns matching topics with summaries and resource links. Use when looking for specific SDK features or patterns.",
2967
3112
  annotations: {
@@ -2996,9 +3141,9 @@ function handler4({
2996
3141
  }
2997
3142
 
2998
3143
  // src/tools/sdk-get-auth-setup.ts
2999
- import { z as z28 } from "zod";
3000
- var schema31 = {
3001
- scenario: z28.enum([
3144
+ import { z as z27 } from "zod";
3145
+ var schema32 = {
3146
+ scenario: z27.enum([
3002
3147
  "browser-client",
3003
3148
  "server-client",
3004
3149
  "customer-auth",
@@ -3007,7 +3152,7 @@ var schema31 = {
3007
3152
  "webhook-verification"
3008
3153
  ]).describe("Authentication scenario")
3009
3154
  };
3010
- var metadata31 = {
3155
+ var metadata32 = {
3011
3156
  name: "sdk-get-auth-setup",
3012
3157
  description: "Get the current authentication setup for a specific scenario. Returns env var names, code snippets, and security notes.",
3013
3158
  annotations: {
@@ -3131,13 +3276,19 @@ export SOFTWARE_SECRET_KEY=sk01_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
3131
3276
  envVars: ["WEBHOOK_SECRET"],
3132
3277
  code: `import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
3133
3278
 
3279
+ function getWebhookSecret(): string {
3280
+ const secret = process.env.WEBHOOK_SECRET
3281
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
3282
+ return secret
3283
+ }
3284
+
3134
3285
  const customerAuthHandler = createCustomerAuthWebhookHandler({
3135
3286
  passwordReset: sendPasswordResetEmail,
3136
3287
  })
3137
3288
 
3138
3289
  export async function POST(request: Request) {
3139
3290
  return handleWebhook(request, customerAuthHandler, {
3140
- secret: process.env.WEBHOOK_SECRET!,
3291
+ secret: getWebhookSecret(),
3141
3292
  })
3142
3293
  }`,
3143
3294
  notes: [
@@ -3163,14 +3314,14 @@ function handler5({
3163
3314
  }
3164
3315
 
3165
3316
  // src/tools/sdk-get-collection-pattern.ts
3166
- import { z as z29 } from "zod";
3317
+ import { z as z28 } from "zod";
3167
3318
  import { COLLECTIONS, SERVER_COLLECTIONS as SERVER_COLLECTIONS4 } from "@01.software/sdk";
3168
- var schema32 = {
3169
- collection: z29.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3170
- operation: z29.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3171
- surface: z29.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3319
+ var schema33 = {
3320
+ collection: z28.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3321
+ operation: z28.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3322
+ surface: z28.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3172
3323
  };
3173
- var metadata32 = {
3324
+ var metadata33 = {
3174
3325
  name: "sdk-get-collection-pattern",
3175
3326
  description: "Get the recommended CRUD pattern for a specific collection. Returns code examples for the chosen API surface and operation type.",
3176
3327
  annotations: {
@@ -3366,14 +3517,14 @@ function handler6({
3366
3517
  }
3367
3518
 
3368
3519
  // src/prompts/sdk-usage-guide.ts
3369
- import { z as z30 } from "zod";
3370
- var schema33 = {
3371
- goal: z30.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3372
- runtime: z30.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3373
- surface: z30.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3374
- collection: z30.string().optional().describe("Specific collection if relevant")
3520
+ import { z as z29 } from "zod";
3521
+ var schema34 = {
3522
+ goal: z29.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3523
+ runtime: z29.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3524
+ surface: z29.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3525
+ collection: z29.string().optional().describe("Specific collection if relevant")
3375
3526
  };
3376
- var metadata33 = {
3527
+ var metadata34 = {
3377
3528
  name: "sdk-usage-guide",
3378
3529
  title: "SDK Usage Guide",
3379
3530
  description: "Provides guidance on how to perform a specific task using the 01.software SDK",
@@ -3544,14 +3695,14 @@ const { allAvailable } = await client.commerce.product.stockCheck({
3544
3695
  }
3545
3696
 
3546
3697
  // src/prompts/collection-query-help.ts
3547
- import { z as z31 } from "zod";
3698
+ import { z as z30 } from "zod";
3548
3699
  import { COLLECTIONS as COLLECTIONS2, SERVER_COLLECTIONS as SERVER_COLLECTIONS5 } from "@01.software/sdk";
3549
- var schema34 = {
3550
- collection: z31.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3551
- operation: z31.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3552
- filters: z31.string().optional().describe("Filter conditions (JSON string, optional)")
3700
+ var schema35 = {
3701
+ collection: z30.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3702
+ operation: z30.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3703
+ filters: z30.string().optional().describe("Filter conditions (JSON string, optional)")
3553
3704
  };
3554
- var metadata34 = {
3705
+ var metadata35 = {
3555
3706
  name: "collection-query-help",
3556
3707
  title: "Collection Query Help",
3557
3708
  description: "Provides guidance on how to write queries for a specific collection",
@@ -3648,16 +3799,16 @@ ${operation === "find" ? `- Use \`where\` option for filtering (Payload query sy
3648
3799
  }
3649
3800
 
3650
3801
  // src/prompts/order-flow-guide.ts
3651
- import { z as z32 } from "zod";
3652
- var schema35 = {
3653
- scenario: z32.enum([
3802
+ import { z as z31 } from "zod";
3803
+ var schema36 = {
3804
+ scenario: z31.enum([
3654
3805
  "simple-order",
3655
3806
  "cart-checkout",
3656
3807
  "return-refund",
3657
3808
  "fulfillment-tracking"
3658
3809
  ]).describe("Order flow scenario")
3659
3810
  };
3660
- var metadata35 = {
3811
+ var metadata36 = {
3661
3812
  name: "order-flow-guide",
3662
3813
  title: "Order Flow Guide",
3663
3814
  description: "Provides step-by-step guidance for ecommerce order flows including creation, checkout, returns, and fulfillment.",
@@ -3672,9 +3823,10 @@ var SCENARIOS = {
3672
3823
  - Provide: orderNumber, customerSnapshot (email required), shippingAddress, orderItems, totalAmount
3673
3824
  - Optional: pgPaymentId (omit for free orders), shippingAmount, discountCode
3674
3825
 
3675
- 2. **Payment Confirmation** \u2192 \`update-transaction\` tool
3676
- - Confirm provider payment with pgPaymentId, paymentKey, and amount
3677
- - Stock is automatically adjusted (stock -= qty, reservedStock += qty)
3826
+ 2. **Payment Confirmation** \u2192 ServerClient \`commerce.orders.confirmPayment()\`
3827
+ - Confirm provider payment with pgPaymentId, provider name, and amount
3828
+ - Successful confirmation transitions the order to \`paid\`
3829
+ - Paid orders reserve sellable quantity (reservedStock += qty); physical stock is decremented on delivery
3678
3830
 
3679
3831
  3. **Fulfillment** \u2192 \`create-fulfillment\` tool
3680
3832
  - Provide carrier + trackingNumber for shipped status
@@ -3694,18 +3846,20 @@ const client = createServerClient({
3694
3846
  const order = await client.commerce.orders.create({
3695
3847
  orderNumber: 'ORD-240101-001',
3696
3848
  customerSnapshot: { email: 'user@example.com', name: 'John' },
3697
- shippingAddress: { postalCode: '06000', address1: '123 Main St' },
3849
+ shippingAddress: { postalCode: '06000', address: '123 Main St' },
3698
3850
  orderItems: [{ product: 'prod-id', variant: 'var-id', option: 'opt-id', quantity: 2 }],
3699
3851
  totalAmount: 59800,
3700
3852
  pgPaymentId: 'pay_xxx' // omit for free orders
3701
3853
  })
3702
3854
 
3703
3855
  // 2. After payment confirmed by provider
3704
- await client.commerce.orders.updateTransaction({
3856
+ await client.commerce.orders.confirmPayment({
3857
+ orderNumber: 'ORD-240101-001',
3705
3858
  pgPaymentId: 'pay_xxx',
3706
- status: 'paid',
3707
- paymentKey: 'payment_key_xxx',
3708
- amount: 59800
3859
+ pgProvider: 'provider',
3860
+ amount: 59800,
3861
+ paymentMethod: 'card',
3862
+ confirmationSource: 'provider_api_confirm'
3709
3863
  })
3710
3864
 
3711
3865
  // 3. Ship items
@@ -3724,7 +3878,7 @@ await client.commerce.orders.createFulfillment({
3724
3878
  2. **Apply Discount** (optional) \u2192 \`apply-discount\` tool
3725
3879
  3. **Calculate Shipping** \u2192 \`calculate-shipping\` tool
3726
3880
  4. **Checkout** \u2192 \`checkout\` tool (converts cart to order)
3727
- 5. **Payment** \u2192 \`update-transaction\` for provider-verified paid transitions
3881
+ 5. **Payment** \u2192 ServerClient \`commerce.orders.confirmPayment()\` for provider-verified paid transitions
3728
3882
 
3729
3883
  ### Key Points
3730
3884
  - Cart has a customer linked \u2014 auto-copied to order on checkout
@@ -3837,14 +3991,14 @@ ${SCENARIOS[scenario] || "Unknown scenario."}
3837
3991
  - \`checkout\`
3838
3992
  - \`create-fulfillment\`, \`update-fulfillment\`
3839
3993
  - \`create-return\`, \`update-return\`, \`return-with-refund\`
3840
- - \`update-transaction\`
3994
+ - \`confirm-payment\`, \`update-transaction\`
3841
3995
  - \`validate-discount\`, \`calculate-shipping\``;
3842
3996
  }
3843
3997
 
3844
3998
  // src/prompts/feature-setup-guide.ts
3845
- import { z as z33 } from "zod";
3846
- var schema36 = {
3847
- feature: z33.enum([
3999
+ import { z as z32 } from "zod";
4000
+ var schema37 = {
4001
+ feature: z32.enum([
3848
4002
  "ecommerce",
3849
4003
  "customers",
3850
4004
  "articles",
@@ -3859,7 +4013,7 @@ var schema36 = {
3859
4013
  "community"
3860
4014
  ]).describe("Feature to get setup guide for")
3861
4015
  };
3862
- var metadata36 = {
4016
+ var metadata37 = {
3863
4017
  name: "feature-setup-guide",
3864
4018
  title: "Feature Setup Guide",
3865
4019
  description: "Setup checklist and remediation guide for a tenant feature. Load with check-feature-progress and get-tenant-context to diagnose setup gaps.",
@@ -4067,7 +4221,7 @@ ${FEATURES[feature] || "Unknown feature."}
4067
4221
  }
4068
4222
 
4069
4223
  // src/resources/(config)/app.ts
4070
- var metadata37 = {
4224
+ var metadata38 = {
4071
4225
  name: "app-config",
4072
4226
  title: "Application Config",
4073
4227
  description: "01.software SDK and MCP server configuration information"
@@ -4111,7 +4265,7 @@ The hosted HTTP MCP endpoint at https://mcp.01.software/mcp exposes only these O
4111
4265
  - \`sdk-get-auth-setup\` - Get framework-specific auth setup guidance
4112
4266
  - \`sdk-get-collection-pattern\` - Get collection-specific usage patterns
4113
4267
 
4114
- ## Local CLI Stdio Surface (30)
4268
+ ## Local CLI Stdio Surface (33)
4115
4269
 
4116
4270
  For trusted local server-key workflows, start the stdio server:
4117
4271
 
@@ -4119,7 +4273,7 @@ For trusted local server-key workflows, start the stdio server:
4119
4273
  npx @01.software/cli mcp
4120
4274
  \`\`\`
4121
4275
 
4122
- Local stdio can expose generic read, order, return, cart, validation, stock, schema, tenant context, feature progress, field config, and guidance tools. Generic collection write tools (create/update/delete/update-many/delete-many) are intentionally absent on every transport; use the SDK server client for generic writes.
4276
+ Local stdio can expose generic read, order, payment confirmation, return, cart, validation, stock, schema, tenant context, feature progress, field config, and guidance tools. Generic collection write tools (create/update/delete/update-many/delete-many) are intentionally absent on every transport; use the SDK server client for generic writes.
4123
4277
 
4124
4278
  ## Rate Limits
4125
4279
 
@@ -4133,7 +4287,7 @@ Rate limits depend on your tenant plan:
4133
4287
 
4134
4288
  // src/resources/(collections)/schema.ts
4135
4289
  import { COLLECTIONS as COLLECTIONS3 } from "@01.software/sdk";
4136
- var metadata38 = {
4290
+ var metadata39 = {
4137
4291
  name: "collections-schema",
4138
4292
  title: "Collection Schema Info",
4139
4293
  description: "Available collections and their schema information"
@@ -4270,7 +4424,7 @@ Total available collections: ${COLLECTIONS3.length}`;
4270
4424
  }
4271
4425
 
4272
4426
  // src/resources/(docs)/getting-started.ts
4273
- var metadata39 = {
4427
+ var metadata40 = {
4274
4428
  name: "docs-getting-started",
4275
4429
  title: "Getting Started",
4276
4430
  description: "01.software SDK getting started guide"
@@ -4331,7 +4485,7 @@ const result = await client.collections.from('products').find({
4331
4485
  }
4332
4486
 
4333
4487
  // src/resources/(docs)/guides.ts
4334
- var metadata40 = {
4488
+ var metadata41 = {
4335
4489
  name: "docs-guides",
4336
4490
  title: "Guides",
4337
4491
  description: "01.software SDK usage guides"
@@ -4544,7 +4698,7 @@ For more implementation guidance, see the [SDK Guide](/developers/sdk).`;
4544
4698
  }
4545
4699
 
4546
4700
  // src/resources/(docs)/api.ts
4547
- var metadata41 = {
4701
+ var metadata42 = {
4548
4702
  name: "docs-api",
4549
4703
  title: "API Reference",
4550
4704
  description: "01.software SDK API reference documentation"
@@ -4827,7 +4981,7 @@ For more details, see the [API documentation](/developers/api).`;
4827
4981
  }
4828
4982
 
4829
4983
  // src/resources/(docs)/query-builder.ts
4830
- var metadata42 = {
4984
+ var metadata43 = {
4831
4985
  name: "docs-query-builder",
4832
4986
  title: "Query Builder",
4833
4987
  description: "01.software SDK Query Builder API reference (client.collections.from)"
@@ -5021,7 +5175,7 @@ console.log(result.hasNextPage) // true
5021
5175
  }
5022
5176
 
5023
5177
  // src/resources/(docs)/react-query.ts
5024
- var metadata43 = {
5178
+ var metadata44 = {
5025
5179
  name: "docs-react-query",
5026
5180
  title: "React Query Hooks",
5027
5181
  description: "01.software SDK React Query hooks reference (@01.software/sdk/query)"
@@ -5253,7 +5407,7 @@ export function ProductList() {
5253
5407
  }
5254
5408
 
5255
5409
  // src/resources/(docs)/server-api.ts
5256
- var metadata44 = {
5410
+ var metadata45 = {
5257
5411
  name: "docs-server-api",
5258
5412
  title: "Server-side API",
5259
5413
  description: "01.software SDK server-side API reference (client.commerce) for orders, fulfillments, returns, carts, and validation"
@@ -5291,16 +5445,16 @@ const order = await client.commerce.orders.create({
5291
5445
  recipientName: 'John Doe',
5292
5446
  phone: '+821012345678',
5293
5447
  postalCode: '06234',
5294
- address1: '123 Main St',
5295
- address2: 'Apt 4B',
5448
+ address: '123 Main St',
5449
+ detailAddress: 'Apt 4B',
5296
5450
  deliveryMessage?: 'Leave at door',
5297
5451
  },
5298
5452
  orderItems: [
5299
- { product: 'product-id', variant: 'variant-id', option: 'option-id', quantity: 2, unitPrice: 29900 }
5453
+ { product: 'product-id', variant: 'variant-id', option: 'option-id', quantity: 2 }
5300
5454
  ],
5301
5455
  totalAmount: 59800,
5302
5456
  shippingAmount?: 3000,
5303
- pgPaymentId?: 'toss-payment-id', // omit for free orders
5457
+ pgPaymentId?: 'provider-payment-id', // omit for free orders
5304
5458
  })
5305
5459
  \`\`\`
5306
5460
 
@@ -5312,7 +5466,7 @@ const order = await client.commerce.orders.checkout({
5312
5466
  cartId: 'cart-id',
5313
5467
  orderNumber: 'ORD-20240101-0001',
5314
5468
  customerSnapshot: { name: 'John Doe', email: 'john@example.com' },
5315
- pgPaymentId?: 'toss-payment-id',
5469
+ pgPaymentId?: 'provider-payment-id',
5316
5470
  })
5317
5471
  \`\`\`
5318
5472
 
@@ -5405,24 +5559,45 @@ const result = await client.commerce.orders.returnWithRefund({
5405
5559
  { orderItem: 'order-item-id', quantity: 1 }
5406
5560
  ],
5407
5561
  refundAmount: 29900,
5408
- pgPaymentId: 'toss-payment-id', // required
5409
- paymentKey: 'toss-payment-key', // required for provider refund
5562
+ pgPaymentId: 'provider-payment-id', // required
5563
+ paymentKey: 'provider-payment-key', // required for provider refund
5410
5564
  refundReceiptUrl?: 'https://...',
5411
5565
  })
5412
5566
  \`\`\`
5413
5567
 
5414
5568
  ## Transaction API
5415
5569
 
5570
+ ### confirmPayment()
5571
+ Confirm a provider-verified payment and transition the order to paid. Verify the
5572
+ payment with the provider first, then call this endpoint with the provider name,
5573
+ amount, and an idempotency event ID when available.
5574
+
5575
+ \`\`\`typescript
5576
+ const result = await client.commerce.orders.confirmPayment({
5577
+ orderNumber: 'ORD-20240101-0001',
5578
+ pgPaymentId: 'provider-payment-id',
5579
+ pgProvider: 'provider-name',
5580
+ amount: 29900,
5581
+ currency: 'KRW',
5582
+ paymentMethod: 'card',
5583
+ providerStatus: 'PAID',
5584
+ providerEventId: 'provider-event-id',
5585
+ confirmationSource: 'provider_api_confirm',
5586
+ })
5587
+ \`\`\`
5588
+
5416
5589
  ### updateTransaction()
5417
- Confirm or annotate a transaction. Paid transitions require provider
5418
- verification; non-financial annotations can still update pending transactions.
5590
+ Lower-level transaction update path. Prefer \`confirmPayment()\` for normal paid
5591
+ transitions. Use this only for compatibility paths that still require direct
5592
+ transaction annotation after provider verification, or for non-paid pending
5593
+ transaction updates.
5419
5594
 
5420
5595
  \`\`\`typescript
5421
5596
  const tx = await client.commerce.orders.updateTransaction({
5422
- pgPaymentId: 'toss-payment-id',
5423
- status: 'paid', // pending | paid | failed | canceled
5424
- paymentKey: 'toss-payment-key', // required when status is paid
5425
- amount: 29900, // required when status is paid
5597
+ pgPaymentId: 'provider-payment-id',
5598
+ status: 'failed', // pending | paid | failed | canceled
5599
+ paymentMethod: 'card',
5600
+ receiptUrl: 'https://...',
5426
5601
  })
5427
5602
  \`\`\`
5428
5603
 
@@ -5515,7 +5690,7 @@ const result = await client.commerce.shipping.calculate({
5515
5690
  }
5516
5691
 
5517
5692
  // src/resources/(docs)/customer-auth.ts
5518
- var metadata45 = {
5693
+ var metadata46 = {
5519
5694
  name: "docs-customer-auth",
5520
5695
  title: "Customer Auth API",
5521
5696
  description: "01.software SDK Customer Auth API reference (client.customer)"
@@ -5693,7 +5868,7 @@ async function loadProfile() {
5693
5868
  }
5694
5869
 
5695
5870
  // src/resources/(docs)/browser-vs-server.ts
5696
- var metadata46 = {
5871
+ var metadata47 = {
5697
5872
  name: "docs-browser-vs-server",
5698
5873
  title: "Client vs ServerClient",
5699
5874
  description: "When to use Client (createClient) vs ServerClient (createServerClient) in the 01.software SDK"
@@ -5859,7 +6034,7 @@ export function ProductList() {
5859
6034
  }
5860
6035
 
5861
6036
  // src/resources/(docs)/file-upload.ts
5862
- var metadata47 = {
6037
+ var metadata48 = {
5863
6038
  name: "docs-file-upload",
5864
6039
  title: "File Upload",
5865
6040
  description: "01.software SDK file upload patterns using the images collection"
@@ -6010,7 +6185,7 @@ The platform stores files in Cloudflare R2 and serves via CDN (\`cdn.01.software
6010
6185
  }
6011
6186
 
6012
6187
  // src/resources/(docs)/webhook.ts
6013
- var metadata48 = {
6188
+ var metadata49 = {
6014
6189
  name: "docs-webhook",
6015
6190
  title: "Webhooks",
6016
6191
  description: "01.software SDK webhook verification and event handling"
@@ -6027,6 +6202,12 @@ Use the SDK \`handleWebhook\` helper to verify signatures. For customer auth eve
6027
6202
  \`\`\`typescript
6028
6203
  import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
6029
6204
 
6205
+ function getWebhookSecret(): string {
6206
+ const secret = process.env.WEBHOOK_SECRET
6207
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6208
+ return secret
6209
+ }
6210
+
6030
6211
  const handler = createCustomerAuthWebhookHandler({
6031
6212
  passwordReset: async (data) => {
6032
6213
  await sendPasswordResetEmail(data)
@@ -6035,7 +6216,7 @@ const handler = createCustomerAuthWebhookHandler({
6035
6216
 
6036
6217
  export async function POST(request: Request) {
6037
6218
  return handleWebhook(request, handler, {
6038
- secret: process.env.WEBHOOK_SECRET!,
6219
+ secret: getWebhookSecret(),
6039
6220
  })
6040
6221
  }
6041
6222
  \`\`\`
@@ -6048,6 +6229,12 @@ export async function POST(request: Request) {
6048
6229
  // app/api/webhooks/route.ts
6049
6230
  import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
6050
6231
 
6232
+ function getWebhookSecret(): string {
6233
+ const secret = process.env.WEBHOOK_SECRET
6234
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6235
+ return secret
6236
+ }
6237
+
6051
6238
  const customerAuthHandler = createCustomerAuthWebhookHandler({
6052
6239
  passwordReset: sendPasswordResetEmail,
6053
6240
  })
@@ -6058,7 +6245,7 @@ export async function POST(request: Request) {
6058
6245
 
6059
6246
  await customerAuthHandler(event)
6060
6247
  }, {
6061
- secret: process.env.WEBHOOK_SECRET!,
6248
+ secret: getWebhookSecret(),
6062
6249
  })
6063
6250
  }
6064
6251
  \`\`\`
@@ -6077,6 +6264,51 @@ All webhook events share this envelope:
6077
6264
 
6078
6265
  ## Event Types
6079
6266
 
6267
+ ### Collection Order Changed
6268
+
6269
+ Admin Panel manual ordering is delivered as a semantic collection update:
6270
+
6271
+ - \`operation\` remains \`"update"\` for compatibility.
6272
+ - \`eventType\` is \`"collection.orderChanged"\`.
6273
+ - \`change.scope\` identifies collection-level ordering versus join ordering.
6274
+ - SDK handlers should use \`isOrderChangedWebhookEvent()\` from \`@01.software/sdk/webhook\`.
6275
+ - Route on public semantics such as \`change.scope.collection\`, \`change.scope.field\`, and \`change.moved.id\`.
6276
+ - Do not branch on hidden Payload order fields or private backing collections; diagnostic fields may still be present.
6277
+ - Customer group member ordering is currently unsupported and does not emit a semantic order-change webhook.
6278
+
6279
+ \`\`\`typescript
6280
+ import { handleWebhook, isOrderChangedWebhookEvent } from '@01.software/sdk/webhook'
6281
+
6282
+ function getWebhookSecret(): string {
6283
+ const secret = process.env.WEBHOOK_SECRET
6284
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6285
+ return secret
6286
+ }
6287
+
6288
+ export async function POST(request: Request) {
6289
+ return handleWebhook(
6290
+ request,
6291
+ async (event) => {
6292
+ if (isOrderChangedWebhookEvent(event)) {
6293
+ if (event.change.scope.kind === 'join') {
6294
+ console.log('Join order changed', {
6295
+ collection: event.change.scope.collection,
6296
+ field: event.change.scope.field,
6297
+ parentId: event.change.scope.id,
6298
+ movedCollection: event.change.moved.collection,
6299
+ movedId: event.change.moved.id,
6300
+ })
6301
+ }
6302
+ return
6303
+ }
6304
+
6305
+ console.log('Content changed', event.collection, event.operation)
6306
+ },
6307
+ { secret: getWebhookSecret() },
6308
+ )
6309
+ }
6310
+ \`\`\`
6311
+
6080
6312
  ### Customer Password Reset
6081
6313
 
6082
6314
  Dispatched when a customer calls \`client.customer.forgotPassword(email)\`.
@@ -6124,7 +6356,7 @@ Configure webhook URLs in the 01.software console under Tenant Settings > Webhoo
6124
6356
  }
6125
6357
 
6126
6358
  // src/resources/(docs)/product-detail.ts
6127
- var metadata49 = {
6359
+ var metadata50 = {
6128
6360
  name: "docs-product-detail",
6129
6361
  title: "Product Detail Helper",
6130
6362
  description: "01.software SDK commerce.product.detail helper guide"
@@ -6216,7 +6448,23 @@ Log \`client.lastRequestId\` against backend logs \u2014 the endpoint records th
6216
6448
 
6217
6449
  // src/server.ts
6218
6450
  var REGISTERED_TOOLS_BY_SERVER = /* @__PURE__ */ new WeakMap();
6219
- function registerTool(server, schema37, meta, handler20) {
6451
+ function hasToolPolicy(toolName) {
6452
+ return Object.prototype.hasOwnProperty.call(TOOL_POLICY_MANIFEST, toolName);
6453
+ }
6454
+ function runtimeAnnotationsFor(meta) {
6455
+ if (!hasToolPolicy(meta.name)) {
6456
+ throw new Error(`No tool-policy entry for registered MCP tool ${meta.name}`);
6457
+ }
6458
+ const policy = TOOL_POLICY_MANIFEST[meta.name];
6459
+ return {
6460
+ title: meta.annotations?.title,
6461
+ readOnlyHint: policy.annotationPolicy.readOnly,
6462
+ destructiveHint: policy.annotationPolicy.destructive,
6463
+ idempotentHint: policy.annotationPolicy.idempotent,
6464
+ openWorldHint: policy.annotationPolicy.openWorld
6465
+ };
6466
+ }
6467
+ function registerTool(server, schema38, meta, handler20) {
6220
6468
  let registered = REGISTERED_TOOLS_BY_SERVER.get(server);
6221
6469
  if (!registered) {
6222
6470
  registered = /* @__PURE__ */ new Set();
@@ -6227,16 +6475,20 @@ function registerTool(server, schema37, meta, handler20) {
6227
6475
  meta.name,
6228
6476
  {
6229
6477
  description: meta.description,
6230
- inputSchema: schema37,
6231
- annotations: meta.annotations
6478
+ inputSchema: schema38,
6479
+ annotations: runtimeAnnotationsFor(meta)
6232
6480
  },
6233
6481
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6234
6482
  async (params) => {
6235
6483
  const ctx = tenantAuthContext();
6236
6484
  if (ctx) {
6237
- const decision = evaluateToolPolicy(meta.name, ctx.scopes);
6485
+ const decision = evaluateToolPolicy(
6486
+ meta.name,
6487
+ ctx.scopes,
6488
+ ctx.tenantRole
6489
+ );
6238
6490
  if (!decision.allowed) {
6239
- const status = decision.reason === "insufficient_scope" ? 403 : 500;
6491
+ const status = decision.reason === "insufficient_scope" || decision.reason === "insufficient_role" ? 403 : 500;
6240
6492
  return {
6241
6493
  content: [
6242
6494
  {
@@ -6273,13 +6525,13 @@ function registerTool(server, schema37, meta, handler20) {
6273
6525
  }
6274
6526
  );
6275
6527
  }
6276
- function registerPrompt(server, schema37, meta, handler20) {
6528
+ function registerPrompt(server, schema38, meta, handler20) {
6277
6529
  server.registerPrompt(
6278
6530
  meta.name,
6279
6531
  {
6280
6532
  title: meta.title,
6281
6533
  description: meta.description,
6282
- argsSchema: schema37
6534
+ argsSchema: schema38
6283
6535
  },
6284
6536
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6285
6537
  (params) => ({
@@ -6351,211 +6603,232 @@ function createServer(options = {}) {
6351
6603
  server,
6352
6604
  schema10,
6353
6605
  metadata10,
6354
- createReturn
6606
+ confirmPayment
6355
6607
  );
6356
6608
  registerTool(
6357
6609
  server,
6358
6610
  schema11,
6359
6611
  metadata11,
6360
- updateReturn
6612
+ createReturn
6361
6613
  );
6362
6614
  registerTool(
6363
6615
  server,
6364
6616
  schema12,
6365
6617
  metadata12,
6366
- returnWithRefund
6618
+ updateReturn
6367
6619
  );
6368
- registerTool(server, schema13, metadata13, addCartItem);
6369
6620
  registerTool(
6370
6621
  server,
6371
- schema14,
6372
- metadata14,
6373
- updateCartItem
6622
+ schema13,
6623
+ metadata13,
6624
+ returnWithRefund
6374
6625
  );
6626
+ registerTool(server, schema14, metadata14, addCartItem);
6375
6627
  registerTool(
6376
6628
  server,
6377
6629
  schema15,
6378
6630
  metadata15,
6379
- removeCartItem
6631
+ updateCartItem
6380
6632
  );
6381
6633
  registerTool(
6382
6634
  server,
6383
6635
  schema16,
6384
6636
  metadata16,
6385
- applyDiscount
6637
+ removeCartItem
6386
6638
  );
6387
6639
  registerTool(
6388
6640
  server,
6389
6641
  schema17,
6390
6642
  metadata17,
6391
- removeDiscount
6643
+ applyDiscount
6392
6644
  );
6393
- registerTool(server, schema18, metadata18, clearCart);
6394
6645
  registerTool(
6395
6646
  server,
6396
- schema19,
6397
- metadata19,
6398
- validateDiscount
6647
+ schema18,
6648
+ metadata18,
6649
+ removeDiscount
6399
6650
  );
6651
+ registerTool(server, schema19, metadata19, clearCart);
6400
6652
  registerTool(
6401
6653
  server,
6402
6654
  schema20,
6403
6655
  metadata20,
6656
+ validateDiscount
6657
+ );
6658
+ registerTool(
6659
+ server,
6660
+ schema21,
6661
+ metadata21,
6404
6662
  calculateShipping
6405
6663
  );
6406
- registerTool(server, schema21, metadata21, stockCheck);
6407
- registerTool(server, schema22, metadata22, productDetail);
6664
+ registerTool(server, schema22, metadata22, stockCheck);
6408
6665
  registerTool(
6409
6666
  server,
6410
6667
  schema23,
6411
6668
  metadata23,
6669
+ productDetail
6670
+ );
6671
+ registerTool(
6672
+ server,
6673
+ schema24,
6674
+ metadata24,
6412
6675
  productUpsert
6413
6676
  );
6414
6677
  }
6415
- registerTool(
6416
- server,
6417
- schema24,
6418
- metadata24,
6419
- getCollectionSchemaTool
6420
- );
6421
6678
  registerTool(
6422
6679
  server,
6423
6680
  schema25,
6424
6681
  metadata25,
6425
- handler
6682
+ getCollectionSchemaTool
6426
6683
  );
6427
6684
  registerTool(
6428
6685
  server,
6429
6686
  schema26,
6430
6687
  metadata26,
6431
- handler2
6688
+ handler
6432
6689
  );
6433
6690
  registerTool(
6434
6691
  server,
6435
6692
  schema27,
6436
6693
  metadata27,
6437
- listConfigurableFields
6694
+ handler2
6438
6695
  );
6439
6696
  registerTool(
6440
6697
  server,
6441
6698
  schema28,
6442
6699
  metadata28,
6443
- updateFieldConfig
6700
+ listConfigurableFields
6444
6701
  );
6445
6702
  registerTool(
6446
6703
  server,
6447
6704
  schema29,
6448
6705
  metadata29,
6449
- handler3
6706
+ updateFieldConfig
6450
6707
  );
6451
6708
  registerTool(
6452
6709
  server,
6453
6710
  schema30,
6454
6711
  metadata30,
6455
- handler4
6712
+ handler3
6456
6713
  );
6457
6714
  registerTool(
6458
6715
  server,
6459
6716
  schema31,
6460
6717
  metadata31,
6461
- handler5
6718
+ handler4
6462
6719
  );
6463
6720
  registerTool(
6464
6721
  server,
6465
6722
  schema32,
6466
6723
  metadata32,
6467
- handler6
6724
+ handler5
6468
6725
  );
6469
- registerPrompt(
6726
+ registerTool(
6470
6727
  server,
6471
6728
  schema33,
6472
6729
  metadata33,
6473
- sdkUsageGuide
6730
+ handler6
6474
6731
  );
6475
6732
  registerPrompt(
6476
6733
  server,
6477
6734
  schema34,
6478
6735
  metadata34,
6479
- collectionQueryHelp
6736
+ sdkUsageGuide
6480
6737
  );
6481
6738
  registerPrompt(
6482
6739
  server,
6483
6740
  schema35,
6484
6741
  metadata35,
6485
- orderFlowGuide
6742
+ collectionQueryHelp
6486
6743
  );
6487
6744
  registerPrompt(
6488
6745
  server,
6489
6746
  schema36,
6490
6747
  metadata36,
6748
+ orderFlowGuide
6749
+ );
6750
+ registerPrompt(
6751
+ server,
6752
+ schema37,
6753
+ metadata37,
6491
6754
  featureSetupGuide
6492
6755
  );
6493
6756
  registerStaticResource(
6494
6757
  server,
6495
- "config://app",
6496
- metadata37,
6758
+ mcpResourceUri("app-config"),
6759
+ metadata38,
6497
6760
  handler7
6498
6761
  );
6499
6762
  registerStaticResource(
6500
6763
  server,
6501
- "collections://schema",
6502
- metadata38,
6764
+ mcpResourceUri("collections-schema"),
6765
+ metadata39,
6503
6766
  handler8
6504
6767
  );
6505
6768
  registerStaticResource(
6506
6769
  server,
6507
- "docs://sdk/getting-started",
6508
- metadata39,
6770
+ mcpResourceUri("docs-getting-started"),
6771
+ metadata40,
6509
6772
  handler9
6510
6773
  );
6511
- registerStaticResource(server, "docs://sdk/guides", metadata40, handler10);
6512
- registerStaticResource(server, "docs://sdk/api", metadata41, handler11);
6513
6774
  registerStaticResource(
6514
6775
  server,
6515
- "docs://sdk/query-builder",
6776
+ mcpResourceUri("docs-guides"),
6777
+ metadata41,
6778
+ handler10
6779
+ );
6780
+ registerStaticResource(
6781
+ server,
6782
+ mcpResourceUri("docs-api"),
6516
6783
  metadata42,
6517
- handler12
6784
+ handler11
6518
6785
  );
6519
6786
  registerStaticResource(
6520
6787
  server,
6521
- "docs://sdk/react-query",
6788
+ mcpResourceUri("docs-query-builder"),
6522
6789
  metadata43,
6523
- handler13
6790
+ handler12
6524
6791
  );
6525
6792
  registerStaticResource(
6526
6793
  server,
6527
- "docs://sdk/server-api",
6794
+ mcpResourceUri("docs-react-query"),
6528
6795
  metadata44,
6529
- handler14
6796
+ handler13
6530
6797
  );
6531
6798
  registerStaticResource(
6532
6799
  server,
6533
- "docs://sdk/customer-auth",
6800
+ mcpResourceUri("docs-server-api"),
6534
6801
  metadata45,
6535
- handler15
6802
+ handler14
6536
6803
  );
6537
6804
  registerStaticResource(
6538
6805
  server,
6539
- "docs://sdk/browser-vs-server",
6806
+ mcpResourceUri("docs-customer-auth"),
6540
6807
  metadata46,
6541
- handler16
6808
+ handler15
6542
6809
  );
6543
6810
  registerStaticResource(
6544
6811
  server,
6545
- "docs://sdk/file-upload",
6812
+ mcpResourceUri("docs-browser-vs-server"),
6546
6813
  metadata47,
6547
- handler17
6814
+ handler16
6548
6815
  );
6549
6816
  registerStaticResource(
6550
6817
  server,
6551
- "docs://sdk/webhook",
6818
+ mcpResourceUri("docs-file-upload"),
6552
6819
  metadata48,
6553
- handler18
6820
+ handler17
6554
6821
  );
6555
6822
  registerStaticResource(
6556
6823
  server,
6557
- "docs://sdk/product-detail",
6824
+ mcpResourceUri("docs-webhook"),
6558
6825
  metadata49,
6826
+ handler18
6827
+ );
6828
+ registerStaticResource(
6829
+ server,
6830
+ mcpResourceUri("docs-product-detail"),
6831
+ metadata50,
6559
6832
  handler19
6560
6833
  );
6561
6834
  return server;
@@ -6568,6 +6841,7 @@ export {
6568
6841
  MCP_TENANT_CLAIM,
6569
6842
  MCP_TENANT_ROLE_CLAIM,
6570
6843
  MCP_SCOPES,
6844
+ MCP_RESOURCE_LABELS,
6571
6845
  requestContext,
6572
6846
  mcpServicePublicJwks,
6573
6847
  createMcpTelemetrySummary,
@@ -6575,4 +6849,4 @@ export {
6575
6849
  flushMcpTelemetrySummary,
6576
6850
  createServer
6577
6851
  };
6578
- //# sourceMappingURL=chunk-2EPYMNHW.js.map
6852
+ //# sourceMappingURL=chunk-2ULP5WQH.js.map