@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.
@@ -15,6 +15,75 @@ var MCP_CONSOLE_SERVICE_AUDIENCE = "https://api.01.software/internal/mcp";
15
15
  var MCP_CONSOLE_SERVICE_SCOPE = "console:mcp_proxy";
16
16
  var MCP_SERVICE_TOKEN_LIFETIME_SECONDS = 60;
17
17
 
18
+ // src/resource-inventory.ts
19
+ var MCP_RESOURCE_INVENTORY = [
20
+ { uri: "config://app", label: "config", registeredName: "app-config" },
21
+ {
22
+ uri: "collections://schema",
23
+ label: "collections-schema",
24
+ registeredName: "collections-schema"
25
+ },
26
+ {
27
+ uri: "docs://sdk/getting-started",
28
+ label: "getting-started",
29
+ registeredName: "docs-getting-started"
30
+ },
31
+ { uri: "docs://sdk/guides", label: "guides", registeredName: "docs-guides" },
32
+ { uri: "docs://sdk/api", label: "api", registeredName: "docs-api" },
33
+ {
34
+ uri: "docs://sdk/query-builder",
35
+ label: "query-builder",
36
+ registeredName: "docs-query-builder"
37
+ },
38
+ {
39
+ uri: "docs://sdk/react-query",
40
+ label: "react-query",
41
+ registeredName: "docs-react-query"
42
+ },
43
+ {
44
+ uri: "docs://sdk/server-api",
45
+ label: "server-api",
46
+ registeredName: "docs-server-api"
47
+ },
48
+ {
49
+ uri: "docs://sdk/customer-auth",
50
+ label: "customer-auth",
51
+ registeredName: "docs-customer-auth"
52
+ },
53
+ {
54
+ uri: "docs://sdk/browser-vs-server",
55
+ label: "browser-vs-server",
56
+ registeredName: "docs-browser-vs-server"
57
+ },
58
+ {
59
+ uri: "docs://sdk/file-upload",
60
+ label: "file-upload",
61
+ registeredName: "docs-file-upload"
62
+ },
63
+ {
64
+ uri: "docs://sdk/webhook",
65
+ label: "webhook",
66
+ registeredName: "docs-webhook"
67
+ },
68
+ {
69
+ uri: "docs://sdk/product-detail",
70
+ label: "product-detail",
71
+ registeredName: "docs-product-detail"
72
+ }
73
+ ];
74
+ var MCP_RESOURCE_LABELS = MCP_RESOURCE_INVENTORY.map(
75
+ (resource) => resource.label
76
+ );
77
+ function mcpResourceUri(registeredName) {
78
+ const resource = MCP_RESOURCE_INVENTORY.find(
79
+ (entry) => entry.registeredName === registeredName
80
+ );
81
+ if (!resource) {
82
+ throw new Error(`Unknown MCP resource inventory entry: ${registeredName}`);
83
+ }
84
+ return resource.uri;
85
+ }
86
+
18
87
  // src/server.ts
19
88
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
20
89
 
@@ -250,6 +319,38 @@ var transactionStatusSchema = z2.enum([
250
319
  "failed",
251
320
  "canceled"
252
321
  ]);
322
+ var entityIdSchema = z2.union([z2.string(), z2.number()]).transform(String);
323
+ var createOrderItemSchema = z2.object({
324
+ product: entityIdSchema,
325
+ variant: entityIdSchema,
326
+ option: entityIdSchema,
327
+ quantity: z2.number().int().positive("quantity must be a positive integer"),
328
+ unitPrice: z2.number().optional(),
329
+ totalPrice: z2.number().optional()
330
+ });
331
+ var createOrderSchema = z2.object({
332
+ pgPaymentId: z2.string().min(1).optional(),
333
+ orderNumber: z2.string().min(1, "orderNumber is required"),
334
+ customer: entityIdSchema.optional(),
335
+ customerSnapshot: z2.object({
336
+ name: z2.string().optional(),
337
+ email: z2.string().email("Invalid email format"),
338
+ phone: z2.string().optional()
339
+ }),
340
+ shippingAddress: z2.object({
341
+ postalCode: z2.string().optional(),
342
+ address: z2.string().optional(),
343
+ detailAddress: z2.string().optional(),
344
+ deliveryMessage: z2.string().optional(),
345
+ recipientName: z2.string().optional(),
346
+ phone: z2.string().optional()
347
+ }),
348
+ orderItems: z2.array(createOrderItemSchema).min(1, "At least one order item is required").max(100, "Maximum 100 items per order"),
349
+ totalAmount: z2.number().nonnegative("totalAmount must be non-negative"),
350
+ shippingAmount: z2.number().min(0).optional(),
351
+ discountCode: z2.string().optional()
352
+ });
353
+ var CreateOrderSchema = createOrderSchema;
253
354
  var updateTransactionSchema = z2.object({
254
355
  pgPaymentId: z2.string().min(1, "pgPaymentId is required").describe("PG payment ID (required)"),
255
356
  status: transactionStatusSchema.describe(
@@ -284,6 +385,7 @@ var confirmPaymentSchema = z2.object({
284
385
  ]).optional(),
285
386
  metadata: z2.record(z2.string(), z2.unknown()).optional()
286
387
  }).strict();
388
+ var ConfirmPaymentSchema = confirmPaymentSchema;
287
389
  var returnReasonSchema = z2.enum([
288
390
  "change_of_mind",
289
391
  "defective",
@@ -413,6 +515,11 @@ var MCP_TOOL_CONTRACT = {
413
515
  oauthScope: "mcp:write",
414
516
  readOnly: false
415
517
  },
518
+ "confirm-payment": {
519
+ consoleRole: "tenant-admin",
520
+ oauthScope: "mcp:write",
521
+ readOnly: false
522
+ },
416
523
  "update-order": {
417
524
  consoleRole: "tenant-admin",
418
525
  oauthScope: "mcp:write",
@@ -663,6 +770,14 @@ var TOOL_POLICY_MANIFEST = {
663
770
  consoleSurface: "POST /api/orders",
664
771
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
665
772
  },
773
+ "confirm-payment": {
774
+ category: "mutation-transaction",
775
+ oauthScope: MCP_SCOPES.write,
776
+ consoleRole: "tenant-admin",
777
+ consoleSurface: "POST /api/orders/confirm-payment",
778
+ annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
779
+ exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
780
+ },
666
781
  "update-order": {
667
782
  category: "mutation-order",
668
783
  oauthScope: MCP_SCOPES.write,
@@ -756,7 +871,15 @@ var TOOL_POLICY_MANIFEST = {
756
871
  annotationPolicy: READ_ONLY_ANNOTATION
757
872
  }
758
873
  };
759
- function evaluateToolPolicy(toolName, scopes) {
874
+ var CONSOLE_ROLE_RANK = {
875
+ "tenant-viewer": 0,
876
+ "tenant-editor": 1,
877
+ "tenant-admin": 2
878
+ };
879
+ function hasRequiredConsoleRole(tenantRole, requiredRole) {
880
+ return CONSOLE_ROLE_RANK[tenantRole] >= CONSOLE_ROLE_RANK[requiredRole];
881
+ }
882
+ function evaluateToolPolicy(toolName, scopes, tenantRole) {
760
883
  if (!isMcpToolName(toolName)) {
761
884
  return {
762
885
  allowed: false,
@@ -772,6 +895,13 @@ function evaluateToolPolicy(toolName, scopes) {
772
895
  message: `Tool ${toolName} requires ${entry.oauthScope}`
773
896
  };
774
897
  }
898
+ if (!hasRequiredConsoleRole(tenantRole, entry.consoleRole)) {
899
+ return {
900
+ allowed: false,
901
+ reason: "insufficient_role",
902
+ message: `Tool ${toolName} requires ${entry.consoleRole}`
903
+ };
904
+ }
775
905
  return { allowed: true, entry };
776
906
  }
777
907
 
@@ -1264,25 +1394,7 @@ async function getOrder({
1264
1394
  }
1265
1395
 
1266
1396
  // src/tools/create-order.ts
1267
- import { z as z6 } from "zod";
1268
- var schema4 = {
1269
- pgPaymentId: z6.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1270
- orderNumber: z6.string().min(1).describe("Unique order number (required)"),
1271
- customerSnapshot: z6.object({
1272
- name: z6.string().optional().describe("Customer name"),
1273
- email: z6.string().describe("Customer email (required)"),
1274
- phone: z6.string().optional().describe("Customer phone")
1275
- }).describe("Customer snapshot at time of order (required)"),
1276
- shippingAddress: z6.record(z6.string(), z6.unknown()).describe(
1277
- "Shipping address object (required). Fields: postalCode, address1, address2, deliveryMessage, recipientName, phone"
1278
- ),
1279
- orderItems: z6.array(z6.record(z6.string(), z6.unknown())).describe(
1280
- "Array of order item objects (required). Each: { product, variant, option, quantity, unitPrice?, totalPrice? }"
1281
- ),
1282
- totalAmount: z6.number().nonnegative().describe("Total order amount (required, min 0)"),
1283
- shippingAmount: z6.number().nonnegative().optional().describe("Shipping amount (optional, default 0)"),
1284
- discountCode: z6.string().optional().describe("Discount code to apply (optional)")
1285
- };
1397
+ var schema4 = CreateOrderSchema.shape;
1286
1398
  var metadata4 = {
1287
1399
  name: "create-order",
1288
1400
  description: "Create a new order with products and shipping information. Supports idempotency.",
@@ -1296,9 +1408,8 @@ var metadata4 = {
1296
1408
  async function createOrder(params) {
1297
1409
  try {
1298
1410
  const client = getClient();
1299
- const result = await client.commerce.orders.create(
1300
- params
1301
- );
1411
+ const parsed = CreateOrderSchema.parse(params);
1412
+ const result = await client.commerce.orders.create(parsed);
1302
1413
  return toolSuccess({ data: result });
1303
1414
  } catch (error) {
1304
1415
  return toolError(error);
@@ -1306,10 +1417,10 @@ async function createOrder(params) {
1306
1417
  }
1307
1418
 
1308
1419
  // src/tools/update-order.ts
1309
- import { z as z7 } from "zod";
1420
+ import { z as z6 } from "zod";
1310
1421
  var schema5 = {
1311
- orderNumber: z7.string().min(1).describe("Order number (required)"),
1312
- status: z7.enum([
1422
+ orderNumber: z6.string().min(1).describe("Order number (required)"),
1423
+ status: z6.enum([
1313
1424
  "pending",
1314
1425
  "paid",
1315
1426
  "failed",
@@ -1346,15 +1457,15 @@ async function updateOrder({
1346
1457
  }
1347
1458
 
1348
1459
  // src/tools/checkout.ts
1349
- import { z as z8 } from "zod";
1460
+ import { z as z7 } from "zod";
1350
1461
  var schema6 = {
1351
- cartId: z8.string().min(1).describe("Cart ID to convert to order (required)"),
1352
- pgPaymentId: z8.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1353
- orderNumber: z8.string().min(1).describe("Unique order number (required)"),
1354
- customerSnapshot: z8.record(z8.string(), z8.unknown()).describe(
1462
+ cartId: z7.string().min(1).describe("Cart ID to convert to order (required)"),
1463
+ pgPaymentId: z7.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1464
+ orderNumber: z7.string().min(1).describe("Unique order number (required)"),
1465
+ customerSnapshot: z7.record(z7.string(), z7.unknown()).describe(
1355
1466
  "Customer snapshot object (required). Fields: { name?, email, phone? }"
1356
1467
  ),
1357
- discountCode: z8.string().optional().describe("Discount code to apply (optional)")
1468
+ discountCode: z7.string().optional().describe("Discount code to apply (optional)")
1358
1469
  };
1359
1470
  var metadata6 = {
1360
1471
  name: "checkout",
@@ -1379,17 +1490,17 @@ async function checkout(params) {
1379
1490
  }
1380
1491
 
1381
1492
  // src/tools/create-fulfillment.ts
1382
- import { z as z9 } from "zod";
1493
+ import { z as z8 } from "zod";
1383
1494
  var schema7 = {
1384
- orderNumber: z9.string().min(1).describe("Order number (required)"),
1385
- carrier: z9.string().optional().describe("Shipping carrier name (optional)"),
1386
- trackingNumber: z9.string().optional().describe(
1495
+ orderNumber: z8.string().min(1).describe("Order number (required)"),
1496
+ carrier: z8.string().optional().describe("Shipping carrier name (optional)"),
1497
+ trackingNumber: z8.string().optional().describe(
1387
1498
  'Tracking number (optional). Setting carrier + tracking triggers "shipped" status'
1388
1499
  ),
1389
- items: z9.array(
1390
- z9.object({
1391
- orderItem: z9.string().min(1).describe("Order item ID"),
1392
- quantity: z9.number().int().positive().describe("Quantity to fulfill")
1500
+ items: z8.array(
1501
+ z8.object({
1502
+ orderItem: z8.string().min(1).describe("Order item ID"),
1503
+ quantity: z8.number().int().positive().describe("Quantity to fulfill")
1393
1504
  })
1394
1505
  ).describe("Array of items to fulfill (required)")
1395
1506
  };
@@ -1424,16 +1535,16 @@ async function createFulfillment({
1424
1535
  }
1425
1536
 
1426
1537
  // src/tools/update-fulfillment.ts
1427
- import { z as z10 } from "zod";
1538
+ import { z as z9 } from "zod";
1428
1539
  var schema8 = {
1429
- fulfillmentId: z10.string().min(1).describe("Fulfillment ID (required)"),
1430
- status: z10.enum(["packed", "shipped", "delivered", "failed"]).describe(
1540
+ fulfillmentId: z9.string().min(1).describe("Fulfillment ID (required)"),
1541
+ status: z9.enum(["packed", "shipped", "delivered", "failed"]).describe(
1431
1542
  "New fulfillment status (required). FSM: pending\u2192packed/shipped/failed, packed\u2192shipped/failed, shipped\u2192delivered/failed"
1432
1543
  ),
1433
- carrier: z10.string().optional().describe(
1544
+ carrier: z9.string().optional().describe(
1434
1545
  "Shipping carrier (optional, changeable only in pending/packed status)"
1435
1546
  ),
1436
- trackingNumber: z10.string().optional().describe(
1547
+ trackingNumber: z9.string().optional().describe(
1437
1548
  "Tracking number (optional, changeable only in pending/packed status)"
1438
1549
  )
1439
1550
  };
@@ -1504,21 +1615,44 @@ async function updateTransaction({
1504
1615
  }
1505
1616
  }
1506
1617
 
1618
+ // src/tools/confirm-payment.ts
1619
+ var schema10 = ConfirmPaymentSchema.shape;
1620
+ var metadata10 = {
1621
+ name: "confirm-payment",
1622
+ description: "Confirm a provider-verified ecommerce payment through the generic payment confirmation flow.",
1623
+ annotations: {
1624
+ title: "Confirm payment",
1625
+ readOnlyHint: false,
1626
+ destructiveHint: true,
1627
+ idempotentHint: true
1628
+ }
1629
+ };
1630
+ async function confirmPayment(params) {
1631
+ try {
1632
+ const client = getClient();
1633
+ const parsed = ConfirmPaymentSchema.parse(params);
1634
+ const result = await client.commerce.orders.confirmPayment(parsed);
1635
+ return toolSuccess({ data: result });
1636
+ } catch (error) {
1637
+ return toolError(error);
1638
+ }
1639
+ }
1640
+
1507
1641
  // src/tools/create-return.ts
1508
- import { z as z11 } from "zod";
1509
- var schema10 = {
1510
- orderNumber: z11.string().min(1).describe("Order number (required)"),
1511
- reason: z11.enum(["change_of_mind", "defective", "wrong_delivery", "damaged", "other"]).optional().describe("Return reason (optional)"),
1512
- reasonDetail: z11.string().optional().describe("Detailed reason text (optional)"),
1513
- returnItems: z11.array(
1514
- z11.object({
1515
- orderItem: z11.string().min(1).describe("Order item ID"),
1516
- quantity: z11.number().int().positive().describe("Quantity to return")
1642
+ import { z as z10 } from "zod";
1643
+ var schema11 = {
1644
+ orderNumber: z10.string().min(1).describe("Order number (required)"),
1645
+ reason: z10.enum(["change_of_mind", "defective", "wrong_delivery", "damaged", "other"]).optional().describe("Return reason (optional)"),
1646
+ reasonDetail: z10.string().optional().describe("Detailed reason text (optional)"),
1647
+ returnItems: z10.array(
1648
+ z10.object({
1649
+ orderItem: z10.string().min(1).describe("Order item ID"),
1650
+ quantity: z10.number().int().positive().describe("Quantity to return")
1517
1651
  })
1518
1652
  ).describe("Array of products to return (required)"),
1519
- refundAmount: z11.number().nonnegative().describe("Refund amount (required, min 0)")
1653
+ refundAmount: z10.number().nonnegative().describe("Refund amount (required, min 0)")
1520
1654
  };
1521
- var metadata10 = {
1655
+ var metadata11 = {
1522
1656
  name: "create-return",
1523
1657
  description: "Create a return request for an order. Only works for delivered/confirmed orders. Updates order status to return_requested.",
1524
1658
  annotations: {
@@ -1551,14 +1685,14 @@ async function createReturn({
1551
1685
  }
1552
1686
 
1553
1687
  // src/tools/update-return.ts
1554
- import { z as z12 } from "zod";
1555
- var schema11 = {
1556
- returnId: z12.string().min(1).describe("Return ID (required)"),
1557
- status: z12.enum(["processing", "approved", "rejected", "completed"]).describe(
1688
+ import { z as z11 } from "zod";
1689
+ var schema12 = {
1690
+ returnId: z11.string().min(1).describe("Return ID (required)"),
1691
+ status: z11.enum(["processing", "approved", "rejected", "completed"]).describe(
1558
1692
  "New return status (required). Valid transitions: requested\u2192processing/rejected, processing\u2192approved/rejected, approved\u2192completed"
1559
1693
  )
1560
1694
  };
1561
- var metadata11 = {
1695
+ var metadata12 = {
1562
1696
  name: "update-return",
1563
1697
  description: "Update return status with FSM validation. Restores inventory on completion, reverts order status on rejection.",
1564
1698
  annotations: {
@@ -1582,8 +1716,8 @@ async function updateReturn({
1582
1716
  }
1583
1717
 
1584
1718
  // src/tools/return-with-refund.ts
1585
- var schema12 = ReturnWithRefundSchema.shape;
1586
- var metadata12 = {
1719
+ var schema13 = ReturnWithRefundSchema.shape;
1720
+ var metadata13 = {
1587
1721
  name: "return-with-refund",
1588
1722
  description: "Combined return + refund operation. Creates return, restores stock, cancels transaction, updates order status.",
1589
1723
  annotations: {
@@ -1623,15 +1757,15 @@ async function returnWithRefund({
1623
1757
  }
1624
1758
 
1625
1759
  // src/tools/add-cart-item.ts
1626
- import { z as z13 } from "zod";
1627
- var schema13 = {
1628
- cartId: z13.string().min(1).describe("Cart ID (required)"),
1629
- product: z13.string().min(1).describe("Product ID (required)"),
1630
- variant: z13.string().min(1).describe("Product variant ID (required)"),
1631
- option: z13.string().min(1).describe("Product option ID (required)"),
1632
- quantity: z13.number().int().positive().describe("Quantity to add (required, positive integer)")
1760
+ import { z as z12 } from "zod";
1761
+ var schema14 = {
1762
+ cartId: z12.string().min(1).describe("Cart ID (required)"),
1763
+ product: z12.string().min(1).describe("Product ID (required)"),
1764
+ variant: z12.string().min(1).describe("Product variant ID (required)"),
1765
+ option: z12.string().min(1).describe("Product option ID (required)"),
1766
+ quantity: z12.number().int().positive().describe("Quantity to add (required, positive integer)")
1633
1767
  };
1634
- var metadata13 = {
1768
+ var metadata14 = {
1635
1769
  name: "add-cart-item",
1636
1770
  description: "Add a product to cart. Validates stock, merges quantity if item already exists, recalculates totals.",
1637
1771
  annotations: {
@@ -1664,12 +1798,12 @@ async function addCartItem({
1664
1798
  }
1665
1799
 
1666
1800
  // src/tools/update-cart-item.ts
1667
- import { z as z14 } from "zod";
1668
- var schema14 = {
1669
- cartItemId: z14.string().min(1).describe("Cart item ID (required)"),
1670
- quantity: z14.number().int().positive().describe("New quantity (required, positive integer)")
1801
+ import { z as z13 } from "zod";
1802
+ var schema15 = {
1803
+ cartItemId: z13.string().min(1).describe("Cart item ID (required)"),
1804
+ quantity: z13.number().int().positive().describe("New quantity (required, positive integer)")
1671
1805
  };
1672
- var metadata14 = {
1806
+ var metadata15 = {
1673
1807
  name: "update-cart-item",
1674
1808
  description: "Update cart item quantity. Validates stock availability, recalculates cart totals.",
1675
1809
  annotations: {
@@ -1693,11 +1827,11 @@ async function updateCartItem({
1693
1827
  }
1694
1828
 
1695
1829
  // src/tools/remove-cart-item.ts
1696
- import { z as z15 } from "zod";
1697
- var schema15 = {
1698
- cartItemId: z15.string().min(1).describe("Cart item ID to remove (required)")
1830
+ import { z as z14 } from "zod";
1831
+ var schema16 = {
1832
+ cartItemId: z14.string().min(1).describe("Cart item ID to remove (required)")
1699
1833
  };
1700
- var metadata15 = {
1834
+ var metadata16 = {
1701
1835
  name: "remove-cart-item",
1702
1836
  description: "Remove an item from cart. Recalculates cart totals after removal.",
1703
1837
  annotations: {
@@ -1720,12 +1854,12 @@ async function removeCartItem({
1720
1854
  }
1721
1855
 
1722
1856
  // src/tools/apply-discount.ts
1723
- import { z as z16 } from "zod";
1724
- var schema16 = {
1725
- cartId: z16.string().min(1).describe("Cart ID (required)"),
1726
- discountCode: z16.string().describe("Discount code to apply (required)")
1857
+ import { z as z15 } from "zod";
1858
+ var schema17 = {
1859
+ cartId: z15.string().min(1).describe("Cart ID (required)"),
1860
+ discountCode: z15.string().describe("Discount code to apply (required)")
1727
1861
  };
1728
- var metadata16 = {
1862
+ var metadata17 = {
1729
1863
  name: "apply-discount",
1730
1864
  description: "Apply a discount code to a cart. Validates the code, updates cart totals, and sets free shipping if applicable.",
1731
1865
  annotations: {
@@ -1749,11 +1883,11 @@ async function applyDiscount({
1749
1883
  }
1750
1884
 
1751
1885
  // src/tools/remove-discount.ts
1752
- import { z as z17 } from "zod";
1753
- var schema17 = {
1754
- cartId: z17.string().min(1).describe("Cart ID (required)")
1886
+ import { z as z16 } from "zod";
1887
+ var schema18 = {
1888
+ cartId: z16.string().min(1).describe("Cart ID (required)")
1755
1889
  };
1756
- var metadata17 = {
1890
+ var metadata18 = {
1757
1891
  name: "remove-discount",
1758
1892
  description: "Remove the applied discount code from a cart and recalculate totals.",
1759
1893
  annotations: {
@@ -1776,11 +1910,11 @@ async function removeDiscount({
1776
1910
  }
1777
1911
 
1778
1912
  // src/tools/clear-cart.ts
1779
- import { z as z18 } from "zod";
1780
- var schema18 = {
1781
- cartId: z18.string().min(1).describe("Cart ID (required)")
1913
+ import { z as z17 } from "zod";
1914
+ var schema19 = {
1915
+ cartId: z17.string().min(1).describe("Cart ID (required)")
1782
1916
  };
1783
- var metadata18 = {
1917
+ var metadata19 = {
1784
1918
  name: "clear-cart",
1785
1919
  description: "Remove all items from a cart, reset discount and amounts. Shipping fee is preserved.",
1786
1920
  annotations: {
@@ -1803,12 +1937,12 @@ async function clearCart({
1803
1937
  }
1804
1938
 
1805
1939
  // src/tools/validate-discount.ts
1806
- import { z as z19 } from "zod";
1807
- var schema19 = {
1808
- code: z19.string().describe("Discount code to validate (required)"),
1809
- orderAmount: z19.number().describe("Order amount for validation (required)")
1940
+ import { z as z18 } from "zod";
1941
+ var schema20 = {
1942
+ code: z18.string().describe("Discount code to validate (required)"),
1943
+ orderAmount: z18.number().describe("Order amount for validation (required)")
1810
1944
  };
1811
- var metadata19 = {
1945
+ var metadata20 = {
1812
1946
  name: "validate-discount",
1813
1947
  description: "Validate a discount code. Checks active status, date range, usage limits, minimum order amount, and calculates discount.",
1814
1948
  annotations: {
@@ -1835,13 +1969,13 @@ async function validateDiscount({
1835
1969
  }
1836
1970
 
1837
1971
  // src/tools/calculate-shipping.ts
1838
- import { z as z20 } from "zod";
1839
- var schema20 = {
1840
- shippingPolicyId: z20.string().optional().describe("Shipping policy ID (uses default policy if omitted)"),
1841
- orderAmount: z20.number().describe("Order amount for fee calculation (required)"),
1842
- postalCode: z20.string().optional().describe("Postal code for Jeju surcharge detection (63000-63644)")
1972
+ import { z as z19 } from "zod";
1973
+ var schema21 = {
1974
+ shippingPolicyId: z19.string().optional().describe("Shipping policy ID (uses default policy if omitted)"),
1975
+ orderAmount: z19.number().describe("Order amount for fee calculation (required)"),
1976
+ postalCode: z19.string().optional().describe("Postal code for Jeju surcharge detection (63000-63644)")
1843
1977
  };
1844
- var metadata20 = {
1978
+ var metadata21 = {
1845
1979
  name: "calculate-shipping",
1846
1980
  description: "Calculate shipping fee based on order amount and postal code. Supports free shipping threshold and Jeju surcharge.",
1847
1981
  annotations: {
@@ -1870,18 +2004,18 @@ async function calculateShipping({
1870
2004
  }
1871
2005
 
1872
2006
  // src/tools/stock-check.ts
1873
- import { z as z21 } from "zod";
1874
- var schema21 = {
1875
- items: z21.array(
1876
- z21.object({
1877
- variantId: z21.string().describe("Product variant ID"),
1878
- quantity: z21.number().int().positive().describe("Requested quantity")
2007
+ import { z as z20 } from "zod";
2008
+ var schema22 = {
2009
+ items: z20.array(
2010
+ z20.object({
2011
+ variantId: z20.string().describe("Product variant ID"),
2012
+ quantity: z20.number().int().positive().describe("Requested quantity")
1879
2013
  })
1880
2014
  ).describe(
1881
2015
  "Array of items to check stock for (required, max 100). Each: { variantId, quantity }"
1882
2016
  )
1883
2017
  };
1884
- var metadata21 = {
2018
+ var metadata22 = {
1885
2019
  name: "stock-check",
1886
2020
  description: "Batch check product option stock availability. Returns per-item availability and an allAvailable flag.",
1887
2021
  annotations: {
@@ -1904,12 +2038,12 @@ async function stockCheck({
1904
2038
  }
1905
2039
 
1906
2040
  // src/tools/product-detail.ts
1907
- import { z as z22 } from "zod";
1908
- var schema22 = {
1909
- slug: z22.string().optional().describe("Product slug (one of slug or id required)"),
1910
- id: z22.string().optional().describe("Product id (one of slug or id required)")
2041
+ import { z as z21 } from "zod";
2042
+ var schema23 = {
2043
+ slug: z21.string().optional().describe("Product slug (one of slug or id required)"),
2044
+ id: z21.string().optional().describe("Product id (one of slug or id required)")
1911
2045
  };
1912
- var metadata22 = {
2046
+ var metadata23 = {
1913
2047
  name: "product-detail",
1914
2048
  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.",
1915
2049
  annotations: {
@@ -1937,66 +2071,66 @@ async function productDetail({
1937
2071
  }
1938
2072
 
1939
2073
  // src/tools/product-upsert.ts
1940
- import { z as z23 } from "zod";
1941
- var optionValueSchema = z23.object({
1942
- id: z23.string().optional().describe("Stable existing option-value ID for rename-safe updates"),
1943
- value: z23.string().describe("Display label (e.g. Black, S)"),
1944
- slug: z23.string().optional().describe(
2074
+ import { z as z22 } from "zod";
2075
+ var optionValueSchema = z22.object({
2076
+ id: z22.string().optional().describe("Stable existing option-value ID for rename-safe updates"),
2077
+ value: z22.string().describe("Display label (e.g. Black, S)"),
2078
+ slug: z22.string().optional().describe(
1945
2079
  "Optional compatibility value token. The server generates one from value on create when omitted; not canonical identity."
1946
2080
  ),
1947
- swatchColor: z23.string().nullable().optional(),
1948
- thumbnail: z23.string().nullable().optional(),
1949
- images: z23.array(z23.string()).optional(),
1950
- metadata: z23.unknown().optional()
2081
+ swatchColor: z22.string().nullable().optional(),
2082
+ thumbnail: z22.string().nullable().optional(),
2083
+ images: z22.array(z22.string()).optional(),
2084
+ metadata: z22.unknown().optional()
1951
2085
  });
1952
- var optionSchema = z23.object({
1953
- id: z23.string().optional().describe("Stable existing option ID for rename-safe updates"),
1954
- title: z23.string().describe("Option name (e.g. Color, Size)"),
1955
- slug: z23.string().optional().describe(
2086
+ var optionSchema = z22.object({
2087
+ id: z22.string().optional().describe("Stable existing option ID for rename-safe updates"),
2088
+ title: z22.string().describe("Option name (e.g. Color, Size)"),
2089
+ slug: z22.string().optional().describe(
1956
2090
  "Optional compatibility option token. The server generates one from title on create when omitted; not canonical identity."
1957
2091
  ),
1958
- values: z23.array(optionValueSchema).describe("Allowed option values")
2092
+ values: z22.array(optionValueSchema).describe("Allowed option values")
1959
2093
  });
1960
- var variantOptionValueSchema = z23.object({
1961
- valueSlug: z23.string().optional(),
1962
- valueId: z23.string().optional(),
1963
- value: z23.string().optional()
2094
+ var variantOptionValueSchema = z22.object({
2095
+ valueSlug: z22.string().optional(),
2096
+ valueId: z22.string().optional(),
2097
+ value: z22.string().optional()
1964
2098
  });
1965
- var variantSchema = z23.object({
1966
- id: z23.string().optional().describe("Existing variant ID for updates"),
1967
- optionValues: z23.union([
1968
- z23.record(z23.string(), z23.union([z23.string(), variantOptionValueSchema])),
1969
- z23.array(z23.string())
2099
+ var variantSchema = z22.object({
2100
+ id: z22.string().optional().describe("Existing variant ID for updates"),
2101
+ optionValues: z22.union([
2102
+ z22.record(z22.string(), z22.union([z22.string(), variantOptionValueSchema])),
2103
+ z22.array(z22.string())
1970
2104
  ]).optional().describe(
1971
2105
  "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."
1972
2106
  ),
1973
- sku: z23.string().nullable().optional(),
1974
- title: z23.string().nullable().optional(),
1975
- price: z23.number().nonnegative().describe("Selling price (KRW, min 0)"),
1976
- compareAtPrice: z23.number().nonnegative().nullable().optional(),
1977
- stock: z23.number().int().nonnegative().optional(),
1978
- isUnlimited: z23.boolean().optional(),
1979
- weight: z23.number().nonnegative().nullable().optional(),
1980
- requiresShipping: z23.boolean().optional(),
1981
- barcode: z23.string().nullable().optional(),
1982
- externalId: z23.string().nullable().optional(),
1983
- isActive: z23.boolean().optional(),
1984
- thumbnail: z23.string().nullable().optional(),
1985
- images: z23.array(z23.string()).optional(),
1986
- metadata: z23.unknown().optional()
2107
+ sku: z22.string().nullable().optional(),
2108
+ title: z22.string().nullable().optional(),
2109
+ price: z22.number().nonnegative().describe("Selling price (KRW, min 0)"),
2110
+ compareAtPrice: z22.number().nonnegative().nullable().optional(),
2111
+ stock: z22.number().int().nonnegative().optional(),
2112
+ isUnlimited: z22.boolean().optional(),
2113
+ weight: z22.number().nonnegative().nullable().optional(),
2114
+ requiresShipping: z22.boolean().optional(),
2115
+ barcode: z22.string().nullable().optional(),
2116
+ externalId: z22.string().nullable().optional(),
2117
+ isActive: z22.boolean().optional(),
2118
+ thumbnail: z22.string().nullable().optional(),
2119
+ images: z22.array(z22.string()).optional(),
2120
+ metadata: z22.unknown().optional()
1987
2121
  });
1988
- var schema23 = {
1989
- product: z23.record(z23.string(), z23.unknown()).describe(
2122
+ var schema24 = {
2123
+ product: z22.record(z22.string(), z22.unknown()).describe(
1990
2124
  "Product fields. Include `id` to update an existing product; omit for create (then `title` is required)."
1991
2125
  ),
1992
- options: z23.array(optionSchema).optional().describe(
2126
+ options: z22.array(optionSchema).optional().describe(
1993
2127
  "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)."
1994
2128
  ),
1995
- variants: z23.array(variantSchema).optional().describe(
2129
+ variants: z22.array(variantSchema).optional().describe(
1996
2130
  "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)."
1997
2131
  )
1998
2132
  };
1999
- var metadata23 = {
2133
+ var metadata24 = {
2000
2134
  name: "product-upsert",
2001
2135
  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.",
2002
2136
  annotations: {
@@ -2033,8 +2167,8 @@ async function getCollectionSchema(collection) {
2033
2167
  }
2034
2168
 
2035
2169
  // src/tools/get-collection-schema.ts
2036
- var schema24 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2037
- var metadata24 = {
2170
+ var schema25 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2171
+ var metadata25 = {
2038
2172
  name: "get-collection-schema",
2039
2173
  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.",
2040
2174
  annotations: {
@@ -2085,8 +2219,8 @@ async function getTenantFeatureProgress(feature, includeEvidence = false) {
2085
2219
  }
2086
2220
 
2087
2221
  // src/tools/get-tenant-context.ts
2088
- var schema25 = tenantContextToolInputSchema.shape;
2089
- var metadata25 = {
2222
+ var schema26 = tenantContextToolInputSchema.shape;
2223
+ var metadata26 = {
2090
2224
  name: "get-tenant-context",
2091
2225
  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.",
2092
2226
  annotations: {
@@ -2163,8 +2297,8 @@ async function handler({
2163
2297
  }
2164
2298
 
2165
2299
  // src/tools/check-feature-progress.ts
2166
- var schema26 = tenantFeatureProgressInputSchema.shape;
2167
- var metadata26 = {
2300
+ var schema27 = tenantFeatureProgressInputSchema.shape;
2301
+ var metadata27 = {
2168
2302
  name: "check-feature-progress",
2169
2303
  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.",
2170
2304
  annotations: {
@@ -2187,7 +2321,7 @@ async function handler2({
2187
2321
  }
2188
2322
 
2189
2323
  // src/tools/list-configurable-fields.ts
2190
- import { z as z24 } from "zod";
2324
+ import { z as z23 } from "zod";
2191
2325
 
2192
2326
  // src/lib/field-config.ts
2193
2327
  async function fetchFieldConfigs() {
@@ -2210,12 +2344,12 @@ function invalidateFieldConfigCache() {
2210
2344
  }
2211
2345
 
2212
2346
  // src/tools/list-configurable-fields.ts
2213
- var schema27 = {
2214
- collection: z24.string().optional().describe(
2347
+ var schema28 = {
2348
+ collection: z23.string().optional().describe(
2215
2349
  "Filter by collection slug (optional \u2014 returns all if omitted). Use this filter to reduce response size when you know which collection to check."
2216
2350
  )
2217
2351
  };
2218
- var metadata27 = {
2352
+ var metadata28 = {
2219
2353
  name: "list-configurable-fields",
2220
2354
  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.",
2221
2355
  annotations: {
@@ -2246,17 +2380,17 @@ async function listConfigurableFields(params) {
2246
2380
  }
2247
2381
 
2248
2382
  // src/tools/update-field-config.ts
2249
- import { z as z25 } from "zod";
2250
- var schema28 = {
2251
- collection: z25.string().min(1).describe("Collection slug (required)"),
2252
- hiddenFields: z25.array(z25.string().min(1).max(200)).max(300).describe(
2383
+ import { z as z24 } from "zod";
2384
+ var schema29 = {
2385
+ collection: z24.string().min(1).describe("Collection slug (required)"),
2386
+ hiddenFields: z24.array(z24.string().min(1).max(200)).max(300).describe(
2253
2387
  "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."
2254
2388
  ),
2255
- isHidden: z25.boolean().optional().describe(
2389
+ isHidden: z24.boolean().optional().describe(
2256
2390
  "Hide the entire collection from Admin Panel (optional). When true, individual hiddenFields are irrelevant."
2257
2391
  )
2258
2392
  };
2259
- var metadata28 = {
2393
+ var metadata29 = {
2260
2394
  name: "update-field-config",
2261
2395
  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.",
2262
2396
  annotations: {
@@ -2284,7 +2418,7 @@ async function updateFieldConfig(params) {
2284
2418
  }
2285
2419
 
2286
2420
  // src/tools/sdk-get-recipe.ts
2287
- import { z as z26 } from "zod";
2421
+ import { z as z25 } from "zod";
2288
2422
 
2289
2423
  // src/lib/sdk-recipes.ts
2290
2424
  var recipes = {
@@ -2725,8 +2859,8 @@ function getRecipe(goal, runtime = "both") {
2725
2859
  }
2726
2860
 
2727
2861
  // src/tools/sdk-get-recipe.ts
2728
- var schema29 = {
2729
- goal: z26.enum([
2862
+ var schema30 = {
2863
+ goal: z25.enum([
2730
2864
  "fetch-list",
2731
2865
  "fetch-by-id",
2732
2866
  "create-item",
@@ -2738,11 +2872,11 @@ var schema29 = {
2738
2872
  "file-upload",
2739
2873
  "bulk-operations"
2740
2874
  ]).describe("What the user wants to accomplish"),
2741
- runtime: z26.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2742
- collection: z26.string().optional().describe("Specific collection name if applicable"),
2743
- includeExample: z26.boolean().default(true).describe("Whether to include a full code example")
2875
+ runtime: z25.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2876
+ collection: z25.string().optional().describe("Specific collection name if applicable"),
2877
+ includeExample: z25.boolean().default(true).describe("Whether to include a full code example")
2744
2878
  };
2745
- var metadata29 = {
2879
+ var metadata30 = {
2746
2880
  name: "sdk-get-recipe",
2747
2881
  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.",
2748
2882
  annotations: {
@@ -2785,7 +2919,7 @@ function handler3({
2785
2919
  }
2786
2920
 
2787
2921
  // src/tools/sdk-search-docs.ts
2788
- import { z as z27 } from "zod";
2922
+ import { z as z26 } from "zod";
2789
2923
 
2790
2924
  // src/lib/sdk-doc-index.ts
2791
2925
  var docIndex = [
@@ -2913,8 +3047,19 @@ var docIndex = [
2913
3047
  // Webhooks
2914
3048
  {
2915
3049
  title: "Webhooks",
2916
- keywords: ["webhook", "hmac", "signature", "WEBHOOK_SECRET", "server-to-server", "event"],
2917
- summary: "Tenant webhooks deliver server-to-server events such as password reset tokens. Signed with HMAC-SHA256 using PAYLOAD_SECRET.",
3050
+ keywords: [
3051
+ "webhook",
3052
+ "hmac",
3053
+ "signature",
3054
+ "WEBHOOK_SECRET",
3055
+ "server-to-server",
3056
+ "event",
3057
+ "order",
3058
+ "orderChanged",
3059
+ "collection.orderChanged",
3060
+ "isOrderChangedWebhookEvent"
3061
+ ],
3062
+ summary: "Tenant webhooks deliver signed server-to-server events via WEBHOOK_SECRET, including customer password reset and semantic order changes with collection.orderChanged / isOrderChangedWebhookEvent.",
2918
3063
  resourceUri: "docs://sdk/webhook"
2919
3064
  },
2920
3065
  // Order API
@@ -2960,11 +3105,11 @@ function searchDocs(query, limit = 5) {
2960
3105
  }
2961
3106
 
2962
3107
  // src/tools/sdk-search-docs.ts
2963
- var schema30 = {
2964
- query: z27.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
2965
- limit: z27.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
3108
+ var schema31 = {
3109
+ query: z26.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
3110
+ limit: z26.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
2966
3111
  };
2967
- var metadata30 = {
3112
+ var metadata31 = {
2968
3113
  name: "sdk-search-docs",
2969
3114
  description: "Search SDK documentation by keyword. Returns matching topics with summaries and resource links. Use when looking for specific SDK features or patterns.",
2970
3115
  annotations: {
@@ -2999,9 +3144,9 @@ function handler4({
2999
3144
  }
3000
3145
 
3001
3146
  // src/tools/sdk-get-auth-setup.ts
3002
- import { z as z28 } from "zod";
3003
- var schema31 = {
3004
- scenario: z28.enum([
3147
+ import { z as z27 } from "zod";
3148
+ var schema32 = {
3149
+ scenario: z27.enum([
3005
3150
  "browser-client",
3006
3151
  "server-client",
3007
3152
  "customer-auth",
@@ -3010,7 +3155,7 @@ var schema31 = {
3010
3155
  "webhook-verification"
3011
3156
  ]).describe("Authentication scenario")
3012
3157
  };
3013
- var metadata31 = {
3158
+ var metadata32 = {
3014
3159
  name: "sdk-get-auth-setup",
3015
3160
  description: "Get the current authentication setup for a specific scenario. Returns env var names, code snippets, and security notes.",
3016
3161
  annotations: {
@@ -3134,13 +3279,19 @@ export SOFTWARE_SECRET_KEY=sk01_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
3134
3279
  envVars: ["WEBHOOK_SECRET"],
3135
3280
  code: `import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
3136
3281
 
3282
+ function getWebhookSecret(): string {
3283
+ const secret = process.env.WEBHOOK_SECRET
3284
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
3285
+ return secret
3286
+ }
3287
+
3137
3288
  const customerAuthHandler = createCustomerAuthWebhookHandler({
3138
3289
  passwordReset: sendPasswordResetEmail,
3139
3290
  })
3140
3291
 
3141
3292
  export async function POST(request: Request) {
3142
3293
  return handleWebhook(request, customerAuthHandler, {
3143
- secret: process.env.WEBHOOK_SECRET!,
3294
+ secret: getWebhookSecret(),
3144
3295
  })
3145
3296
  }`,
3146
3297
  notes: [
@@ -3166,14 +3317,14 @@ function handler5({
3166
3317
  }
3167
3318
 
3168
3319
  // src/tools/sdk-get-collection-pattern.ts
3169
- import { z as z29 } from "zod";
3320
+ import { z as z28 } from "zod";
3170
3321
  import { COLLECTIONS, SERVER_COLLECTIONS as SERVER_COLLECTIONS4 } from "@01.software/sdk";
3171
- var schema32 = {
3172
- collection: z29.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3173
- operation: z29.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3174
- surface: z29.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3322
+ var schema33 = {
3323
+ collection: z28.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3324
+ operation: z28.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3325
+ surface: z28.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3175
3326
  };
3176
- var metadata32 = {
3327
+ var metadata33 = {
3177
3328
  name: "sdk-get-collection-pattern",
3178
3329
  description: "Get the recommended CRUD pattern for a specific collection. Returns code examples for the chosen API surface and operation type.",
3179
3330
  annotations: {
@@ -3369,14 +3520,14 @@ function handler6({
3369
3520
  }
3370
3521
 
3371
3522
  // src/prompts/sdk-usage-guide.ts
3372
- import { z as z30 } from "zod";
3373
- var schema33 = {
3374
- goal: z30.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3375
- runtime: z30.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3376
- surface: z30.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3377
- collection: z30.string().optional().describe("Specific collection if relevant")
3523
+ import { z as z29 } from "zod";
3524
+ var schema34 = {
3525
+ goal: z29.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3526
+ runtime: z29.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3527
+ surface: z29.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3528
+ collection: z29.string().optional().describe("Specific collection if relevant")
3378
3529
  };
3379
- var metadata33 = {
3530
+ var metadata34 = {
3380
3531
  name: "sdk-usage-guide",
3381
3532
  title: "SDK Usage Guide",
3382
3533
  description: "Provides guidance on how to perform a specific task using the 01.software SDK",
@@ -3547,14 +3698,14 @@ const { allAvailable } = await client.commerce.product.stockCheck({
3547
3698
  }
3548
3699
 
3549
3700
  // src/prompts/collection-query-help.ts
3550
- import { z as z31 } from "zod";
3701
+ import { z as z30 } from "zod";
3551
3702
  import { COLLECTIONS as COLLECTIONS2, SERVER_COLLECTIONS as SERVER_COLLECTIONS5 } from "@01.software/sdk";
3552
- var schema34 = {
3553
- collection: z31.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3554
- operation: z31.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3555
- filters: z31.string().optional().describe("Filter conditions (JSON string, optional)")
3703
+ var schema35 = {
3704
+ collection: z30.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3705
+ operation: z30.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3706
+ filters: z30.string().optional().describe("Filter conditions (JSON string, optional)")
3556
3707
  };
3557
- var metadata34 = {
3708
+ var metadata35 = {
3558
3709
  name: "collection-query-help",
3559
3710
  title: "Collection Query Help",
3560
3711
  description: "Provides guidance on how to write queries for a specific collection",
@@ -3651,16 +3802,16 @@ ${operation === "find" ? `- Use \`where\` option for filtering (Payload query sy
3651
3802
  }
3652
3803
 
3653
3804
  // src/prompts/order-flow-guide.ts
3654
- import { z as z32 } from "zod";
3655
- var schema35 = {
3656
- scenario: z32.enum([
3805
+ import { z as z31 } from "zod";
3806
+ var schema36 = {
3807
+ scenario: z31.enum([
3657
3808
  "simple-order",
3658
3809
  "cart-checkout",
3659
3810
  "return-refund",
3660
3811
  "fulfillment-tracking"
3661
3812
  ]).describe("Order flow scenario")
3662
3813
  };
3663
- var metadata35 = {
3814
+ var metadata36 = {
3664
3815
  name: "order-flow-guide",
3665
3816
  title: "Order Flow Guide",
3666
3817
  description: "Provides step-by-step guidance for ecommerce order flows including creation, checkout, returns, and fulfillment.",
@@ -3675,9 +3826,10 @@ var SCENARIOS = {
3675
3826
  - Provide: orderNumber, customerSnapshot (email required), shippingAddress, orderItems, totalAmount
3676
3827
  - Optional: pgPaymentId (omit for free orders), shippingAmount, discountCode
3677
3828
 
3678
- 2. **Payment Confirmation** \u2192 \`update-transaction\` tool
3679
- - Confirm provider payment with pgPaymentId, paymentKey, and amount
3680
- - Stock is automatically adjusted (stock -= qty, reservedStock += qty)
3829
+ 2. **Payment Confirmation** \u2192 ServerClient \`commerce.orders.confirmPayment()\`
3830
+ - Confirm provider payment with pgPaymentId, provider name, and amount
3831
+ - Successful confirmation transitions the order to \`paid\`
3832
+ - Paid orders reserve sellable quantity (reservedStock += qty); physical stock is decremented on delivery
3681
3833
 
3682
3834
  3. **Fulfillment** \u2192 \`create-fulfillment\` tool
3683
3835
  - Provide carrier + trackingNumber for shipped status
@@ -3697,18 +3849,20 @@ const client = createServerClient({
3697
3849
  const order = await client.commerce.orders.create({
3698
3850
  orderNumber: 'ORD-240101-001',
3699
3851
  customerSnapshot: { email: 'user@example.com', name: 'John' },
3700
- shippingAddress: { postalCode: '06000', address1: '123 Main St' },
3852
+ shippingAddress: { postalCode: '06000', address: '123 Main St' },
3701
3853
  orderItems: [{ product: 'prod-id', variant: 'var-id', option: 'opt-id', quantity: 2 }],
3702
3854
  totalAmount: 59800,
3703
3855
  pgPaymentId: 'pay_xxx' // omit for free orders
3704
3856
  })
3705
3857
 
3706
3858
  // 2. After payment confirmed by provider
3707
- await client.commerce.orders.updateTransaction({
3859
+ await client.commerce.orders.confirmPayment({
3860
+ orderNumber: 'ORD-240101-001',
3708
3861
  pgPaymentId: 'pay_xxx',
3709
- status: 'paid',
3710
- paymentKey: 'payment_key_xxx',
3711
- amount: 59800
3862
+ pgProvider: 'provider',
3863
+ amount: 59800,
3864
+ paymentMethod: 'card',
3865
+ confirmationSource: 'provider_api_confirm'
3712
3866
  })
3713
3867
 
3714
3868
  // 3. Ship items
@@ -3727,7 +3881,7 @@ await client.commerce.orders.createFulfillment({
3727
3881
  2. **Apply Discount** (optional) \u2192 \`apply-discount\` tool
3728
3882
  3. **Calculate Shipping** \u2192 \`calculate-shipping\` tool
3729
3883
  4. **Checkout** \u2192 \`checkout\` tool (converts cart to order)
3730
- 5. **Payment** \u2192 \`update-transaction\` for provider-verified paid transitions
3884
+ 5. **Payment** \u2192 ServerClient \`commerce.orders.confirmPayment()\` for provider-verified paid transitions
3731
3885
 
3732
3886
  ### Key Points
3733
3887
  - Cart has a customer linked \u2014 auto-copied to order on checkout
@@ -3840,14 +3994,14 @@ ${SCENARIOS[scenario] || "Unknown scenario."}
3840
3994
  - \`checkout\`
3841
3995
  - \`create-fulfillment\`, \`update-fulfillment\`
3842
3996
  - \`create-return\`, \`update-return\`, \`return-with-refund\`
3843
- - \`update-transaction\`
3997
+ - \`confirm-payment\`, \`update-transaction\`
3844
3998
  - \`validate-discount\`, \`calculate-shipping\``;
3845
3999
  }
3846
4000
 
3847
4001
  // src/prompts/feature-setup-guide.ts
3848
- import { z as z33 } from "zod";
3849
- var schema36 = {
3850
- feature: z33.enum([
4002
+ import { z as z32 } from "zod";
4003
+ var schema37 = {
4004
+ feature: z32.enum([
3851
4005
  "ecommerce",
3852
4006
  "customers",
3853
4007
  "articles",
@@ -3862,7 +4016,7 @@ var schema36 = {
3862
4016
  "community"
3863
4017
  ]).describe("Feature to get setup guide for")
3864
4018
  };
3865
- var metadata36 = {
4019
+ var metadata37 = {
3866
4020
  name: "feature-setup-guide",
3867
4021
  title: "Feature Setup Guide",
3868
4022
  description: "Setup checklist and remediation guide for a tenant feature. Load with check-feature-progress and get-tenant-context to diagnose setup gaps.",
@@ -4070,7 +4224,7 @@ ${FEATURES[feature] || "Unknown feature."}
4070
4224
  }
4071
4225
 
4072
4226
  // src/resources/(config)/app.ts
4073
- var metadata37 = {
4227
+ var metadata38 = {
4074
4228
  name: "app-config",
4075
4229
  title: "Application Config",
4076
4230
  description: "01.software SDK and MCP server configuration information"
@@ -4114,7 +4268,7 @@ The hosted HTTP MCP endpoint at https://mcp.01.software/mcp exposes only these O
4114
4268
  - \`sdk-get-auth-setup\` - Get framework-specific auth setup guidance
4115
4269
  - \`sdk-get-collection-pattern\` - Get collection-specific usage patterns
4116
4270
 
4117
- ## Local CLI Stdio Surface (30)
4271
+ ## Local CLI Stdio Surface (33)
4118
4272
 
4119
4273
  For trusted local server-key workflows, start the stdio server:
4120
4274
 
@@ -4122,7 +4276,7 @@ For trusted local server-key workflows, start the stdio server:
4122
4276
  npx @01.software/cli mcp
4123
4277
  \`\`\`
4124
4278
 
4125
- 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.
4279
+ 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.
4126
4280
 
4127
4281
  ## Rate Limits
4128
4282
 
@@ -4136,7 +4290,7 @@ Rate limits depend on your tenant plan:
4136
4290
 
4137
4291
  // src/resources/(collections)/schema.ts
4138
4292
  import { COLLECTIONS as COLLECTIONS3 } from "@01.software/sdk";
4139
- var metadata38 = {
4293
+ var metadata39 = {
4140
4294
  name: "collections-schema",
4141
4295
  title: "Collection Schema Info",
4142
4296
  description: "Available collections and their schema information"
@@ -4273,7 +4427,7 @@ Total available collections: ${COLLECTIONS3.length}`;
4273
4427
  }
4274
4428
 
4275
4429
  // src/resources/(docs)/getting-started.ts
4276
- var metadata39 = {
4430
+ var metadata40 = {
4277
4431
  name: "docs-getting-started",
4278
4432
  title: "Getting Started",
4279
4433
  description: "01.software SDK getting started guide"
@@ -4334,7 +4488,7 @@ const result = await client.collections.from('products').find({
4334
4488
  }
4335
4489
 
4336
4490
  // src/resources/(docs)/guides.ts
4337
- var metadata40 = {
4491
+ var metadata41 = {
4338
4492
  name: "docs-guides",
4339
4493
  title: "Guides",
4340
4494
  description: "01.software SDK usage guides"
@@ -4547,7 +4701,7 @@ For more implementation guidance, see the [SDK Guide](/developers/sdk).`;
4547
4701
  }
4548
4702
 
4549
4703
  // src/resources/(docs)/api.ts
4550
- var metadata41 = {
4704
+ var metadata42 = {
4551
4705
  name: "docs-api",
4552
4706
  title: "API Reference",
4553
4707
  description: "01.software SDK API reference documentation"
@@ -4830,7 +4984,7 @@ For more details, see the [API documentation](/developers/api).`;
4830
4984
  }
4831
4985
 
4832
4986
  // src/resources/(docs)/query-builder.ts
4833
- var metadata42 = {
4987
+ var metadata43 = {
4834
4988
  name: "docs-query-builder",
4835
4989
  title: "Query Builder",
4836
4990
  description: "01.software SDK Query Builder API reference (client.collections.from)"
@@ -5024,7 +5178,7 @@ console.log(result.hasNextPage) // true
5024
5178
  }
5025
5179
 
5026
5180
  // src/resources/(docs)/react-query.ts
5027
- var metadata43 = {
5181
+ var metadata44 = {
5028
5182
  name: "docs-react-query",
5029
5183
  title: "React Query Hooks",
5030
5184
  description: "01.software SDK React Query hooks reference (@01.software/sdk/query)"
@@ -5256,7 +5410,7 @@ export function ProductList() {
5256
5410
  }
5257
5411
 
5258
5412
  // src/resources/(docs)/server-api.ts
5259
- var metadata44 = {
5413
+ var metadata45 = {
5260
5414
  name: "docs-server-api",
5261
5415
  title: "Server-side API",
5262
5416
  description: "01.software SDK server-side API reference (client.commerce) for orders, fulfillments, returns, carts, and validation"
@@ -5294,16 +5448,16 @@ const order = await client.commerce.orders.create({
5294
5448
  recipientName: 'John Doe',
5295
5449
  phone: '+821012345678',
5296
5450
  postalCode: '06234',
5297
- address1: '123 Main St',
5298
- address2: 'Apt 4B',
5451
+ address: '123 Main St',
5452
+ detailAddress: 'Apt 4B',
5299
5453
  deliveryMessage?: 'Leave at door',
5300
5454
  },
5301
5455
  orderItems: [
5302
- { product: 'product-id', variant: 'variant-id', option: 'option-id', quantity: 2, unitPrice: 29900 }
5456
+ { product: 'product-id', variant: 'variant-id', option: 'option-id', quantity: 2 }
5303
5457
  ],
5304
5458
  totalAmount: 59800,
5305
5459
  shippingAmount?: 3000,
5306
- pgPaymentId?: 'toss-payment-id', // omit for free orders
5460
+ pgPaymentId?: 'provider-payment-id', // omit for free orders
5307
5461
  })
5308
5462
  \`\`\`
5309
5463
 
@@ -5315,7 +5469,7 @@ const order = await client.commerce.orders.checkout({
5315
5469
  cartId: 'cart-id',
5316
5470
  orderNumber: 'ORD-20240101-0001',
5317
5471
  customerSnapshot: { name: 'John Doe', email: 'john@example.com' },
5318
- pgPaymentId?: 'toss-payment-id',
5472
+ pgPaymentId?: 'provider-payment-id',
5319
5473
  })
5320
5474
  \`\`\`
5321
5475
 
@@ -5408,24 +5562,45 @@ const result = await client.commerce.orders.returnWithRefund({
5408
5562
  { orderItem: 'order-item-id', quantity: 1 }
5409
5563
  ],
5410
5564
  refundAmount: 29900,
5411
- pgPaymentId: 'toss-payment-id', // required
5412
- paymentKey: 'toss-payment-key', // required for provider refund
5565
+ pgPaymentId: 'provider-payment-id', // required
5566
+ paymentKey: 'provider-payment-key', // required for provider refund
5413
5567
  refundReceiptUrl?: 'https://...',
5414
5568
  })
5415
5569
  \`\`\`
5416
5570
 
5417
5571
  ## Transaction API
5418
5572
 
5573
+ ### confirmPayment()
5574
+ Confirm a provider-verified payment and transition the order to paid. Verify the
5575
+ payment with the provider first, then call this endpoint with the provider name,
5576
+ amount, and an idempotency event ID when available.
5577
+
5578
+ \`\`\`typescript
5579
+ const result = await client.commerce.orders.confirmPayment({
5580
+ orderNumber: 'ORD-20240101-0001',
5581
+ pgPaymentId: 'provider-payment-id',
5582
+ pgProvider: 'provider-name',
5583
+ amount: 29900,
5584
+ currency: 'KRW',
5585
+ paymentMethod: 'card',
5586
+ providerStatus: 'PAID',
5587
+ providerEventId: 'provider-event-id',
5588
+ confirmationSource: 'provider_api_confirm',
5589
+ })
5590
+ \`\`\`
5591
+
5419
5592
  ### updateTransaction()
5420
- Confirm or annotate a transaction. Paid transitions require provider
5421
- verification; non-financial annotations can still update pending transactions.
5593
+ Lower-level transaction update path. Prefer \`confirmPayment()\` for normal paid
5594
+ transitions. Use this only for compatibility paths that still require direct
5595
+ transaction annotation after provider verification, or for non-paid pending
5596
+ transaction updates.
5422
5597
 
5423
5598
  \`\`\`typescript
5424
5599
  const tx = await client.commerce.orders.updateTransaction({
5425
- pgPaymentId: 'toss-payment-id',
5426
- status: 'paid', // pending | paid | failed | canceled
5427
- paymentKey: 'toss-payment-key', // required when status is paid
5428
- amount: 29900, // required when status is paid
5600
+ pgPaymentId: 'provider-payment-id',
5601
+ status: 'failed', // pending | paid | failed | canceled
5602
+ paymentMethod: 'card',
5603
+ receiptUrl: 'https://...',
5429
5604
  })
5430
5605
  \`\`\`
5431
5606
 
@@ -5518,7 +5693,7 @@ const result = await client.commerce.shipping.calculate({
5518
5693
  }
5519
5694
 
5520
5695
  // src/resources/(docs)/customer-auth.ts
5521
- var metadata45 = {
5696
+ var metadata46 = {
5522
5697
  name: "docs-customer-auth",
5523
5698
  title: "Customer Auth API",
5524
5699
  description: "01.software SDK Customer Auth API reference (client.customer)"
@@ -5696,7 +5871,7 @@ async function loadProfile() {
5696
5871
  }
5697
5872
 
5698
5873
  // src/resources/(docs)/browser-vs-server.ts
5699
- var metadata46 = {
5874
+ var metadata47 = {
5700
5875
  name: "docs-browser-vs-server",
5701
5876
  title: "Client vs ServerClient",
5702
5877
  description: "When to use Client (createClient) vs ServerClient (createServerClient) in the 01.software SDK"
@@ -5862,7 +6037,7 @@ export function ProductList() {
5862
6037
  }
5863
6038
 
5864
6039
  // src/resources/(docs)/file-upload.ts
5865
- var metadata47 = {
6040
+ var metadata48 = {
5866
6041
  name: "docs-file-upload",
5867
6042
  title: "File Upload",
5868
6043
  description: "01.software SDK file upload patterns using the images collection"
@@ -6013,7 +6188,7 @@ The platform stores files in Cloudflare R2 and serves via CDN (\`cdn.01.software
6013
6188
  }
6014
6189
 
6015
6190
  // src/resources/(docs)/webhook.ts
6016
- var metadata48 = {
6191
+ var metadata49 = {
6017
6192
  name: "docs-webhook",
6018
6193
  title: "Webhooks",
6019
6194
  description: "01.software SDK webhook verification and event handling"
@@ -6030,6 +6205,12 @@ Use the SDK \`handleWebhook\` helper to verify signatures. For customer auth eve
6030
6205
  \`\`\`typescript
6031
6206
  import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
6032
6207
 
6208
+ function getWebhookSecret(): string {
6209
+ const secret = process.env.WEBHOOK_SECRET
6210
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6211
+ return secret
6212
+ }
6213
+
6033
6214
  const handler = createCustomerAuthWebhookHandler({
6034
6215
  passwordReset: async (data) => {
6035
6216
  await sendPasswordResetEmail(data)
@@ -6038,7 +6219,7 @@ const handler = createCustomerAuthWebhookHandler({
6038
6219
 
6039
6220
  export async function POST(request: Request) {
6040
6221
  return handleWebhook(request, handler, {
6041
- secret: process.env.WEBHOOK_SECRET!,
6222
+ secret: getWebhookSecret(),
6042
6223
  })
6043
6224
  }
6044
6225
  \`\`\`
@@ -6051,6 +6232,12 @@ export async function POST(request: Request) {
6051
6232
  // app/api/webhooks/route.ts
6052
6233
  import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
6053
6234
 
6235
+ function getWebhookSecret(): string {
6236
+ const secret = process.env.WEBHOOK_SECRET
6237
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6238
+ return secret
6239
+ }
6240
+
6054
6241
  const customerAuthHandler = createCustomerAuthWebhookHandler({
6055
6242
  passwordReset: sendPasswordResetEmail,
6056
6243
  })
@@ -6061,7 +6248,7 @@ export async function POST(request: Request) {
6061
6248
 
6062
6249
  await customerAuthHandler(event)
6063
6250
  }, {
6064
- secret: process.env.WEBHOOK_SECRET!,
6251
+ secret: getWebhookSecret(),
6065
6252
  })
6066
6253
  }
6067
6254
  \`\`\`
@@ -6080,6 +6267,51 @@ All webhook events share this envelope:
6080
6267
 
6081
6268
  ## Event Types
6082
6269
 
6270
+ ### Collection Order Changed
6271
+
6272
+ Admin Panel manual ordering is delivered as a semantic collection update:
6273
+
6274
+ - \`operation\` remains \`"update"\` for compatibility.
6275
+ - \`eventType\` is \`"collection.orderChanged"\`.
6276
+ - \`change.scope\` identifies collection-level ordering versus join ordering.
6277
+ - SDK handlers should use \`isOrderChangedWebhookEvent()\` from \`@01.software/sdk/webhook\`.
6278
+ - Route on public semantics such as \`change.scope.collection\`, \`change.scope.field\`, and \`change.moved.id\`.
6279
+ - Do not branch on hidden Payload order fields or private backing collections; diagnostic fields may still be present.
6280
+ - Customer group member ordering is currently unsupported and does not emit a semantic order-change webhook.
6281
+
6282
+ \`\`\`typescript
6283
+ import { handleWebhook, isOrderChangedWebhookEvent } from '@01.software/sdk/webhook'
6284
+
6285
+ function getWebhookSecret(): string {
6286
+ const secret = process.env.WEBHOOK_SECRET
6287
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6288
+ return secret
6289
+ }
6290
+
6291
+ export async function POST(request: Request) {
6292
+ return handleWebhook(
6293
+ request,
6294
+ async (event) => {
6295
+ if (isOrderChangedWebhookEvent(event)) {
6296
+ if (event.change.scope.kind === 'join') {
6297
+ console.log('Join order changed', {
6298
+ collection: event.change.scope.collection,
6299
+ field: event.change.scope.field,
6300
+ parentId: event.change.scope.id,
6301
+ movedCollection: event.change.moved.collection,
6302
+ movedId: event.change.moved.id,
6303
+ })
6304
+ }
6305
+ return
6306
+ }
6307
+
6308
+ console.log('Content changed', event.collection, event.operation)
6309
+ },
6310
+ { secret: getWebhookSecret() },
6311
+ )
6312
+ }
6313
+ \`\`\`
6314
+
6083
6315
  ### Customer Password Reset
6084
6316
 
6085
6317
  Dispatched when a customer calls \`client.customer.forgotPassword(email)\`.
@@ -6127,7 +6359,7 @@ Configure webhook URLs in the 01.software console under Tenant Settings > Webhoo
6127
6359
  }
6128
6360
 
6129
6361
  // src/resources/(docs)/product-detail.ts
6130
- var metadata49 = {
6362
+ var metadata50 = {
6131
6363
  name: "docs-product-detail",
6132
6364
  title: "Product Detail Helper",
6133
6365
  description: "01.software SDK commerce.product.detail helper guide"
@@ -6219,7 +6451,23 @@ Log \`client.lastRequestId\` against backend logs \u2014 the endpoint records th
6219
6451
 
6220
6452
  // src/server.ts
6221
6453
  var REGISTERED_TOOLS_BY_SERVER = /* @__PURE__ */ new WeakMap();
6222
- function registerTool(server, schema37, meta, handler21) {
6454
+ function hasToolPolicy(toolName) {
6455
+ return Object.prototype.hasOwnProperty.call(TOOL_POLICY_MANIFEST, toolName);
6456
+ }
6457
+ function runtimeAnnotationsFor(meta) {
6458
+ if (!hasToolPolicy(meta.name)) {
6459
+ throw new Error(`No tool-policy entry for registered MCP tool ${meta.name}`);
6460
+ }
6461
+ const policy = TOOL_POLICY_MANIFEST[meta.name];
6462
+ return {
6463
+ title: meta.annotations?.title,
6464
+ readOnlyHint: policy.annotationPolicy.readOnly,
6465
+ destructiveHint: policy.annotationPolicy.destructive,
6466
+ idempotentHint: policy.annotationPolicy.idempotent,
6467
+ openWorldHint: policy.annotationPolicy.openWorld
6468
+ };
6469
+ }
6470
+ function registerTool(server, schema38, meta, handler21) {
6223
6471
  let registered = REGISTERED_TOOLS_BY_SERVER.get(server);
6224
6472
  if (!registered) {
6225
6473
  registered = /* @__PURE__ */ new Set();
@@ -6230,16 +6478,20 @@ function registerTool(server, schema37, meta, handler21) {
6230
6478
  meta.name,
6231
6479
  {
6232
6480
  description: meta.description,
6233
- inputSchema: schema37,
6234
- annotations: meta.annotations
6481
+ inputSchema: schema38,
6482
+ annotations: runtimeAnnotationsFor(meta)
6235
6483
  },
6236
6484
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6237
6485
  async (params) => {
6238
6486
  const ctx = tenantAuthContext();
6239
6487
  if (ctx) {
6240
- const decision = evaluateToolPolicy(meta.name, ctx.scopes);
6488
+ const decision = evaluateToolPolicy(
6489
+ meta.name,
6490
+ ctx.scopes,
6491
+ ctx.tenantRole
6492
+ );
6241
6493
  if (!decision.allowed) {
6242
- const status = decision.reason === "insufficient_scope" ? 403 : 500;
6494
+ const status = decision.reason === "insufficient_scope" || decision.reason === "insufficient_role" ? 403 : 500;
6243
6495
  return {
6244
6496
  content: [
6245
6497
  {
@@ -6276,13 +6528,13 @@ function registerTool(server, schema37, meta, handler21) {
6276
6528
  }
6277
6529
  );
6278
6530
  }
6279
- function registerPrompt(server, schema37, meta, handler21) {
6531
+ function registerPrompt(server, schema38, meta, handler21) {
6280
6532
  server.registerPrompt(
6281
6533
  meta.name,
6282
6534
  {
6283
6535
  title: meta.title,
6284
6536
  description: meta.description,
6285
- argsSchema: schema37
6537
+ argsSchema: schema38
6286
6538
  },
6287
6539
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6288
6540
  (params) => ({
@@ -6354,211 +6606,232 @@ function createServer(options = {}) {
6354
6606
  server,
6355
6607
  schema10,
6356
6608
  metadata10,
6357
- createReturn
6609
+ confirmPayment
6358
6610
  );
6359
6611
  registerTool(
6360
6612
  server,
6361
6613
  schema11,
6362
6614
  metadata11,
6363
- updateReturn
6615
+ createReturn
6364
6616
  );
6365
6617
  registerTool(
6366
6618
  server,
6367
6619
  schema12,
6368
6620
  metadata12,
6369
- returnWithRefund
6621
+ updateReturn
6370
6622
  );
6371
- registerTool(server, schema13, metadata13, addCartItem);
6372
6623
  registerTool(
6373
6624
  server,
6374
- schema14,
6375
- metadata14,
6376
- updateCartItem
6625
+ schema13,
6626
+ metadata13,
6627
+ returnWithRefund
6377
6628
  );
6629
+ registerTool(server, schema14, metadata14, addCartItem);
6378
6630
  registerTool(
6379
6631
  server,
6380
6632
  schema15,
6381
6633
  metadata15,
6382
- removeCartItem
6634
+ updateCartItem
6383
6635
  );
6384
6636
  registerTool(
6385
6637
  server,
6386
6638
  schema16,
6387
6639
  metadata16,
6388
- applyDiscount
6640
+ removeCartItem
6389
6641
  );
6390
6642
  registerTool(
6391
6643
  server,
6392
6644
  schema17,
6393
6645
  metadata17,
6394
- removeDiscount
6646
+ applyDiscount
6395
6647
  );
6396
- registerTool(server, schema18, metadata18, clearCart);
6397
6648
  registerTool(
6398
6649
  server,
6399
- schema19,
6400
- metadata19,
6401
- validateDiscount
6650
+ schema18,
6651
+ metadata18,
6652
+ removeDiscount
6402
6653
  );
6654
+ registerTool(server, schema19, metadata19, clearCart);
6403
6655
  registerTool(
6404
6656
  server,
6405
6657
  schema20,
6406
6658
  metadata20,
6659
+ validateDiscount
6660
+ );
6661
+ registerTool(
6662
+ server,
6663
+ schema21,
6664
+ metadata21,
6407
6665
  calculateShipping
6408
6666
  );
6409
- registerTool(server, schema21, metadata21, stockCheck);
6410
- registerTool(server, schema22, metadata22, productDetail);
6667
+ registerTool(server, schema22, metadata22, stockCheck);
6411
6668
  registerTool(
6412
6669
  server,
6413
6670
  schema23,
6414
6671
  metadata23,
6672
+ productDetail
6673
+ );
6674
+ registerTool(
6675
+ server,
6676
+ schema24,
6677
+ metadata24,
6415
6678
  productUpsert
6416
6679
  );
6417
6680
  }
6418
- registerTool(
6419
- server,
6420
- schema24,
6421
- metadata24,
6422
- getCollectionSchemaTool
6423
- );
6424
6681
  registerTool(
6425
6682
  server,
6426
6683
  schema25,
6427
6684
  metadata25,
6428
- handler
6685
+ getCollectionSchemaTool
6429
6686
  );
6430
6687
  registerTool(
6431
6688
  server,
6432
6689
  schema26,
6433
6690
  metadata26,
6434
- handler2
6691
+ handler
6435
6692
  );
6436
6693
  registerTool(
6437
6694
  server,
6438
6695
  schema27,
6439
6696
  metadata27,
6440
- listConfigurableFields
6697
+ handler2
6441
6698
  );
6442
6699
  registerTool(
6443
6700
  server,
6444
6701
  schema28,
6445
6702
  metadata28,
6446
- updateFieldConfig
6703
+ listConfigurableFields
6447
6704
  );
6448
6705
  registerTool(
6449
6706
  server,
6450
6707
  schema29,
6451
6708
  metadata29,
6452
- handler3
6709
+ updateFieldConfig
6453
6710
  );
6454
6711
  registerTool(
6455
6712
  server,
6456
6713
  schema30,
6457
6714
  metadata30,
6458
- handler4
6715
+ handler3
6459
6716
  );
6460
6717
  registerTool(
6461
6718
  server,
6462
6719
  schema31,
6463
6720
  metadata31,
6464
- handler5
6721
+ handler4
6465
6722
  );
6466
6723
  registerTool(
6467
6724
  server,
6468
6725
  schema32,
6469
6726
  metadata32,
6470
- handler6
6727
+ handler5
6471
6728
  );
6472
- registerPrompt(
6729
+ registerTool(
6473
6730
  server,
6474
6731
  schema33,
6475
6732
  metadata33,
6476
- sdkUsageGuide
6733
+ handler6
6477
6734
  );
6478
6735
  registerPrompt(
6479
6736
  server,
6480
6737
  schema34,
6481
6738
  metadata34,
6482
- collectionQueryHelp
6739
+ sdkUsageGuide
6483
6740
  );
6484
6741
  registerPrompt(
6485
6742
  server,
6486
6743
  schema35,
6487
6744
  metadata35,
6488
- orderFlowGuide
6745
+ collectionQueryHelp
6489
6746
  );
6490
6747
  registerPrompt(
6491
6748
  server,
6492
6749
  schema36,
6493
6750
  metadata36,
6751
+ orderFlowGuide
6752
+ );
6753
+ registerPrompt(
6754
+ server,
6755
+ schema37,
6756
+ metadata37,
6494
6757
  featureSetupGuide
6495
6758
  );
6496
6759
  registerStaticResource(
6497
6760
  server,
6498
- "config://app",
6499
- metadata37,
6761
+ mcpResourceUri("app-config"),
6762
+ metadata38,
6500
6763
  handler7
6501
6764
  );
6502
6765
  registerStaticResource(
6503
6766
  server,
6504
- "collections://schema",
6505
- metadata38,
6767
+ mcpResourceUri("collections-schema"),
6768
+ metadata39,
6506
6769
  handler8
6507
6770
  );
6508
6771
  registerStaticResource(
6509
6772
  server,
6510
- "docs://sdk/getting-started",
6511
- metadata39,
6773
+ mcpResourceUri("docs-getting-started"),
6774
+ metadata40,
6512
6775
  handler9
6513
6776
  );
6514
- registerStaticResource(server, "docs://sdk/guides", metadata40, handler10);
6515
- registerStaticResource(server, "docs://sdk/api", metadata41, handler11);
6516
6777
  registerStaticResource(
6517
6778
  server,
6518
- "docs://sdk/query-builder",
6779
+ mcpResourceUri("docs-guides"),
6780
+ metadata41,
6781
+ handler10
6782
+ );
6783
+ registerStaticResource(
6784
+ server,
6785
+ mcpResourceUri("docs-api"),
6519
6786
  metadata42,
6520
- handler12
6787
+ handler11
6521
6788
  );
6522
6789
  registerStaticResource(
6523
6790
  server,
6524
- "docs://sdk/react-query",
6791
+ mcpResourceUri("docs-query-builder"),
6525
6792
  metadata43,
6526
- handler13
6793
+ handler12
6527
6794
  );
6528
6795
  registerStaticResource(
6529
6796
  server,
6530
- "docs://sdk/server-api",
6797
+ mcpResourceUri("docs-react-query"),
6531
6798
  metadata44,
6532
- handler14
6799
+ handler13
6533
6800
  );
6534
6801
  registerStaticResource(
6535
6802
  server,
6536
- "docs://sdk/customer-auth",
6803
+ mcpResourceUri("docs-server-api"),
6537
6804
  metadata45,
6538
- handler15
6805
+ handler14
6539
6806
  );
6540
6807
  registerStaticResource(
6541
6808
  server,
6542
- "docs://sdk/browser-vs-server",
6809
+ mcpResourceUri("docs-customer-auth"),
6543
6810
  metadata46,
6544
- handler16
6811
+ handler15
6545
6812
  );
6546
6813
  registerStaticResource(
6547
6814
  server,
6548
- "docs://sdk/file-upload",
6815
+ mcpResourceUri("docs-browser-vs-server"),
6549
6816
  metadata47,
6550
- handler17
6817
+ handler16
6551
6818
  );
6552
6819
  registerStaticResource(
6553
6820
  server,
6554
- "docs://sdk/webhook",
6821
+ mcpResourceUri("docs-file-upload"),
6555
6822
  metadata48,
6556
- handler18
6823
+ handler17
6557
6824
  );
6558
6825
  registerStaticResource(
6559
6826
  server,
6560
- "docs://sdk/product-detail",
6827
+ mcpResourceUri("docs-webhook"),
6561
6828
  metadata49,
6829
+ handler18
6830
+ );
6831
+ registerStaticResource(
6832
+ server,
6833
+ mcpResourceUri("docs-product-detail"),
6834
+ metadata50,
6562
6835
  handler19
6563
6836
  );
6564
6837
  return server;
@@ -6861,7 +7134,7 @@ schema, context, field-config, and guidance tools:
6861
7134
  npx @01.software/cli mcp
6862
7135
 
6863
7136
  Prompts (4): sdk-usage-guide, collection-query-help, order-flow-guide, feature-setup-guide
6864
- Resources (12): config, collections-schema, getting-started, guides, api, query-builder, react-query, server-api, customer-auth, browser-vs-server, file-upload, webhook
7137
+ Resources (${MCP_RESOURCE_LABELS.length}): ${MCP_RESOURCE_LABELS.join(", ")}
6865
7138
 
6866
7139
 
6867
7140
  Links