@01.software/cli 0.10.5 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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",
@@ -653,21 +760,29 @@ var TOOL_POLICY_MANIFEST = {
653
760
  category: "mutation-order",
654
761
  oauthScope: MCP_SCOPES.write,
655
762
  consoleRole: "tenant-admin",
656
- consoleSurface: "POST /api/checkout",
763
+ consoleSurface: "POST /api/orders/checkout",
657
764
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
658
765
  },
659
766
  "create-order": {
660
767
  category: "mutation-order",
661
768
  oauthScope: MCP_SCOPES.write,
662
769
  consoleRole: "tenant-admin",
663
- consoleSurface: "POST /api/orders",
770
+ consoleSurface: "POST /api/orders/create",
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,
669
784
  consoleRole: "tenant-admin",
670
- consoleSurface: "PATCH /api/orders/{id}",
785
+ consoleSurface: "POST /api/orders/update",
671
786
  annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
672
787
  exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
673
788
  },
@@ -676,14 +791,14 @@ var TOOL_POLICY_MANIFEST = {
676
791
  category: "mutation-fulfillment",
677
792
  oauthScope: MCP_SCOPES.write,
678
793
  consoleRole: "tenant-admin",
679
- consoleSurface: "POST /api/orders/{id}/fulfillments",
794
+ consoleSurface: "POST /api/orders/create-fulfillment",
680
795
  annotationPolicy: NON_DESTRUCTIVE_MUTATION_ANNOTATION
681
796
  },
682
797
  "update-fulfillment": {
683
798
  category: "mutation-fulfillment",
684
799
  oauthScope: MCP_SCOPES.write,
685
800
  consoleRole: "tenant-admin",
686
- consoleSurface: "PATCH /api/fulfillments/{id}",
801
+ consoleSurface: "POST /api/orders/update-fulfillment",
687
802
  annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
688
803
  exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
689
804
  },
@@ -692,14 +807,14 @@ var TOOL_POLICY_MANIFEST = {
692
807
  category: "mutation-return",
693
808
  oauthScope: MCP_SCOPES.write,
694
809
  consoleRole: "tenant-admin",
695
- consoleSurface: "POST /api/returns",
810
+ consoleSurface: "POST /api/returns/create",
696
811
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
697
812
  },
698
813
  "update-return": {
699
814
  category: "mutation-return",
700
815
  oauthScope: MCP_SCOPES.write,
701
816
  consoleRole: "tenant-admin",
702
- consoleSurface: "PATCH /api/returns/{id}",
817
+ consoleSurface: "POST /api/returns/update",
703
818
  annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
704
819
  exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
705
820
  },
@@ -707,7 +822,7 @@ var TOOL_POLICY_MANIFEST = {
707
822
  category: "mutation-return",
708
823
  oauthScope: MCP_SCOPES.write,
709
824
  consoleRole: "tenant-admin",
710
- consoleSurface: "POST /api/returns/with-refund",
825
+ consoleSurface: "POST /api/returns/return-refund",
711
826
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
712
827
  },
713
828
  // ── Transaction mutations (mcp:write, tenant-admin) ──
@@ -715,7 +830,7 @@ var TOOL_POLICY_MANIFEST = {
715
830
  category: "mutation-transaction",
716
831
  oauthScope: MCP_SCOPES.write,
717
832
  consoleRole: "tenant-admin",
718
- consoleSurface: "PATCH /api/transactions/{id}",
833
+ consoleSurface: "POST /api/transactions/update",
719
834
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
720
835
  },
721
836
  // ── Field-config mutations (mcp:write, tenant-admin) ──
@@ -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",
@@ -1319,12 +1430,12 @@ var schema5 = {
1319
1430
  "delivered",
1320
1431
  "confirmed"
1321
1432
  ]).describe(
1322
- "New order status. Return-related statuses (return_requested, return_processing, returned) must be set via Return endpoints."
1433
+ "New operator-driven order status. The schema keeps SDK status values for compatibility, but the Console update endpoint rejects server-derived statuses (paid, canceled, returned, refunded); those must be set by payment/refund flows, and return-related statuses must be set via Return endpoints."
1323
1434
  )
1324
1435
  };
1325
1436
  var metadata5 = {
1326
1437
  name: "update-order",
1327
- description: "Update order status. Automatically adjusts stock on status changes (e.g., canceled restores stock).",
1438
+ description: "Update operator-driven order status. Console accepts transitions such as paid\u2192preparing/shipped/delivered/confirmed and rejects server-derived payment/refund statuses such as paid, canceled, returned, and refunded; the MCP schema keeps SDK status values for compatibility.",
1328
1439
  annotations: {
1329
1440
  title: "Update order status",
1330
1441
  readOnlyHint: false,
@@ -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,16 +1685,16 @@ 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(
1558
- "New return status (required). Valid transitions: requested\u2192processing/rejected, processing\u2192approved/rejected, approved\u2192completed"
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(
1692
+ "New operator-driven return status (required). The schema keeps SDK status values for compatibility, but Console accepts only requested\u2192processing/rejected and processing\u2192approved/rejected here; completed is server-derived and must be set by return-with-refund."
1559
1693
  )
1560
1694
  };
1561
- var metadata11 = {
1695
+ var metadata12 = {
1562
1696
  name: "update-return",
1563
- description: "Update return status with FSM validation. Restores inventory on completion, reverts order status on rejection.",
1697
+ description: "Update operator-driven return status with FSM validation. Rejection can restore the order flow; completion and inventory restoration are handled by return-with-refund after provider-verified refund, while the MCP schema keeps SDK status values for compatibility.",
1564
1698
  annotations: {
1565
1699
  title: "Update return status",
1566
1700
  readOnlyHint: false,
@@ -1574,7 +1708,10 @@ async function updateReturn({
1574
1708
  }) {
1575
1709
  try {
1576
1710
  const client = getClient();
1577
- const result = await client.commerce.orders.updateReturn({ returnId, status });
1711
+ const result = await client.commerce.orders.updateReturn({
1712
+ returnId,
1713
+ status
1714
+ });
1578
1715
  return toolSuccess({ data: result });
1579
1716
  } catch (error) {
1580
1717
  return toolError(error);
@@ -1582,10 +1719,10 @@ async function updateReturn({
1582
1719
  }
1583
1720
 
1584
1721
  // src/tools/return-with-refund.ts
1585
- var schema12 = ReturnWithRefundSchema.shape;
1586
- var metadata12 = {
1722
+ var schema13 = ReturnWithRefundSchema.shape;
1723
+ var metadata13 = {
1587
1724
  name: "return-with-refund",
1588
- description: "Combined return + refund operation. Creates return, restores stock, cancels transaction, updates order status.",
1725
+ description: "Combined provider-verified return + refund operation. Creates a completed return, restores eligible stock, records the refund transaction, and advances the order to the returned state.",
1589
1726
  annotations: {
1590
1727
  title: "Return with refund",
1591
1728
  readOnlyHint: false,
@@ -1599,6 +1736,7 @@ async function returnWithRefund({
1599
1736
  reasonDetail,
1600
1737
  returnItems,
1601
1738
  refundAmount,
1739
+ returnShippingFee,
1602
1740
  pgPaymentId,
1603
1741
  paymentKey,
1604
1742
  refundReceiptUrl
@@ -1611,6 +1749,7 @@ async function returnWithRefund({
1611
1749
  reasonDetail,
1612
1750
  returnItems,
1613
1751
  refundAmount,
1752
+ returnShippingFee,
1614
1753
  pgPaymentId,
1615
1754
  paymentKey,
1616
1755
  refundReceiptUrl
@@ -1623,15 +1762,15 @@ async function returnWithRefund({
1623
1762
  }
1624
1763
 
1625
1764
  // 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)")
1765
+ import { z as z12 } from "zod";
1766
+ var schema14 = {
1767
+ cartId: z12.string().min(1).describe("Cart ID (required)"),
1768
+ product: z12.string().min(1).describe("Product ID (required)"),
1769
+ variant: z12.string().min(1).describe("Product variant ID (required)"),
1770
+ option: z12.string().min(1).describe("Product option ID (required)"),
1771
+ quantity: z12.number().int().positive().describe("Quantity to add (required, positive integer)")
1633
1772
  };
1634
- var metadata13 = {
1773
+ var metadata14 = {
1635
1774
  name: "add-cart-item",
1636
1775
  description: "Add a product to cart. Validates stock, merges quantity if item already exists, recalculates totals.",
1637
1776
  annotations: {
@@ -1664,12 +1803,12 @@ async function addCartItem({
1664
1803
  }
1665
1804
 
1666
1805
  // 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)")
1806
+ import { z as z13 } from "zod";
1807
+ var schema15 = {
1808
+ cartItemId: z13.string().min(1).describe("Cart item ID (required)"),
1809
+ quantity: z13.number().int().positive().describe("New quantity (required, positive integer)")
1671
1810
  };
1672
- var metadata14 = {
1811
+ var metadata15 = {
1673
1812
  name: "update-cart-item",
1674
1813
  description: "Update cart item quantity. Validates stock availability, recalculates cart totals.",
1675
1814
  annotations: {
@@ -1693,11 +1832,11 @@ async function updateCartItem({
1693
1832
  }
1694
1833
 
1695
1834
  // 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)")
1835
+ import { z as z14 } from "zod";
1836
+ var schema16 = {
1837
+ cartItemId: z14.string().min(1).describe("Cart item ID to remove (required)")
1699
1838
  };
1700
- var metadata15 = {
1839
+ var metadata16 = {
1701
1840
  name: "remove-cart-item",
1702
1841
  description: "Remove an item from cart. Recalculates cart totals after removal.",
1703
1842
  annotations: {
@@ -1720,12 +1859,12 @@ async function removeCartItem({
1720
1859
  }
1721
1860
 
1722
1861
  // 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)")
1862
+ import { z as z15 } from "zod";
1863
+ var schema17 = {
1864
+ cartId: z15.string().min(1).describe("Cart ID (required)"),
1865
+ discountCode: z15.string().describe("Discount code to apply (required)")
1727
1866
  };
1728
- var metadata16 = {
1867
+ var metadata17 = {
1729
1868
  name: "apply-discount",
1730
1869
  description: "Apply a discount code to a cart. Validates the code, updates cart totals, and sets free shipping if applicable.",
1731
1870
  annotations: {
@@ -1749,11 +1888,11 @@ async function applyDiscount({
1749
1888
  }
1750
1889
 
1751
1890
  // 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)")
1891
+ import { z as z16 } from "zod";
1892
+ var schema18 = {
1893
+ cartId: z16.string().min(1).describe("Cart ID (required)")
1755
1894
  };
1756
- var metadata17 = {
1895
+ var metadata18 = {
1757
1896
  name: "remove-discount",
1758
1897
  description: "Remove the applied discount code from a cart and recalculate totals.",
1759
1898
  annotations: {
@@ -1776,11 +1915,11 @@ async function removeDiscount({
1776
1915
  }
1777
1916
 
1778
1917
  // 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)")
1918
+ import { z as z17 } from "zod";
1919
+ var schema19 = {
1920
+ cartId: z17.string().min(1).describe("Cart ID (required)")
1782
1921
  };
1783
- var metadata18 = {
1922
+ var metadata19 = {
1784
1923
  name: "clear-cart",
1785
1924
  description: "Remove all items from a cart, reset discount and amounts. Shipping fee is preserved.",
1786
1925
  annotations: {
@@ -1803,12 +1942,12 @@ async function clearCart({
1803
1942
  }
1804
1943
 
1805
1944
  // 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)")
1945
+ import { z as z18 } from "zod";
1946
+ var schema20 = {
1947
+ code: z18.string().describe("Discount code to validate (required)"),
1948
+ orderAmount: z18.number().describe("Order amount for validation (required)")
1810
1949
  };
1811
- var metadata19 = {
1950
+ var metadata20 = {
1812
1951
  name: "validate-discount",
1813
1952
  description: "Validate a discount code. Checks active status, date range, usage limits, minimum order amount, and calculates discount.",
1814
1953
  annotations: {
@@ -1835,13 +1974,13 @@ async function validateDiscount({
1835
1974
  }
1836
1975
 
1837
1976
  // 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)")
1977
+ import { z as z19 } from "zod";
1978
+ var schema21 = {
1979
+ shippingPolicyId: z19.string().optional().describe("Shipping policy ID (uses default policy if omitted)"),
1980
+ orderAmount: z19.number().describe("Order amount for fee calculation (required)"),
1981
+ postalCode: z19.string().optional().describe("Postal code for Jeju surcharge detection (63000-63644)")
1843
1982
  };
1844
- var metadata20 = {
1983
+ var metadata21 = {
1845
1984
  name: "calculate-shipping",
1846
1985
  description: "Calculate shipping fee based on order amount and postal code. Supports free shipping threshold and Jeju surcharge.",
1847
1986
  annotations: {
@@ -1870,18 +2009,18 @@ async function calculateShipping({
1870
2009
  }
1871
2010
 
1872
2011
  // 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")
2012
+ import { z as z20 } from "zod";
2013
+ var schema22 = {
2014
+ items: z20.array(
2015
+ z20.object({
2016
+ variantId: z20.string().describe("Product variant ID"),
2017
+ quantity: z20.number().int().positive().describe("Requested quantity")
1879
2018
  })
1880
2019
  ).describe(
1881
2020
  "Array of items to check stock for (required, max 100). Each: { variantId, quantity }"
1882
2021
  )
1883
2022
  };
1884
- var metadata21 = {
2023
+ var metadata22 = {
1885
2024
  name: "stock-check",
1886
2025
  description: "Batch check product option stock availability. Returns per-item availability and an allAvailable flag.",
1887
2026
  annotations: {
@@ -1904,14 +2043,14 @@ async function stockCheck({
1904
2043
  }
1905
2044
 
1906
2045
  // 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)")
2046
+ import { z as z21 } from "zod";
2047
+ var schema23 = {
2048
+ slug: z21.string().optional().describe("Product slug (one of slug or id required)"),
2049
+ id: z21.string().optional().describe("Product id (one of slug or id required)")
1911
2050
  };
1912
- var metadata22 = {
2051
+ var metadata23 = {
1913
2052
  name: "product-detail",
1914
- 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.",
2053
+ 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 found:false with a reason if missing/unpublished/feature disabled. Permission/auth errors still throw.",
1915
2054
  annotations: {
1916
2055
  title: "Get product detail",
1917
2056
  readOnlyHint: true,
@@ -1937,66 +2076,66 @@ async function productDetail({
1937
2076
  }
1938
2077
 
1939
2078
  // 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(
2079
+ import { z as z22 } from "zod";
2080
+ var optionValueSchema = z22.object({
2081
+ id: z22.string().optional().describe("Stable existing option-value ID for rename-safe updates"),
2082
+ value: z22.string().describe("Display label (e.g. Black, S)"),
2083
+ slug: z22.string().optional().describe(
1945
2084
  "Optional compatibility value token. The server generates one from value on create when omitted; not canonical identity."
1946
2085
  ),
1947
- swatchColor: z23.string().nullable().optional(),
1948
- thumbnail: z23.string().nullable().optional(),
1949
- images: z23.array(z23.string()).optional(),
1950
- metadata: z23.unknown().optional()
2086
+ swatchColor: z22.string().nullable().optional(),
2087
+ thumbnail: z22.string().nullable().optional(),
2088
+ images: z22.array(z22.string()).optional(),
2089
+ metadata: z22.unknown().optional()
1951
2090
  });
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(
2091
+ var optionSchema = z22.object({
2092
+ id: z22.string().optional().describe("Stable existing option ID for rename-safe updates"),
2093
+ title: z22.string().describe("Option name (e.g. Color, Size)"),
2094
+ slug: z22.string().optional().describe(
1956
2095
  "Optional compatibility option token. The server generates one from title on create when omitted; not canonical identity."
1957
2096
  ),
1958
- values: z23.array(optionValueSchema).describe("Allowed option values")
2097
+ values: z22.array(optionValueSchema).describe("Allowed option values")
1959
2098
  });
1960
- var variantOptionValueSchema = z23.object({
1961
- valueSlug: z23.string().optional(),
1962
- valueId: z23.string().optional(),
1963
- value: z23.string().optional()
2099
+ var variantOptionValueSchema = z22.object({
2100
+ valueSlug: z22.string().optional(),
2101
+ valueId: z22.string().optional(),
2102
+ value: z22.string().optional()
1964
2103
  });
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())
2104
+ var variantSchema = z22.object({
2105
+ id: z22.string().optional().describe("Existing variant ID for updates"),
2106
+ optionValues: z22.union([
2107
+ z22.record(z22.string(), z22.union([z22.string(), variantOptionValueSchema])),
2108
+ z22.array(z22.string())
1970
2109
  ]).optional().describe(
1971
2110
  "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
2111
  ),
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()
2112
+ sku: z22.string().nullable().optional(),
2113
+ title: z22.string().nullable().optional(),
2114
+ price: z22.number().nonnegative().describe("Selling price (KRW, min 0)"),
2115
+ compareAtPrice: z22.number().nonnegative().nullable().optional(),
2116
+ stock: z22.number().int().nonnegative().optional(),
2117
+ isUnlimited: z22.boolean().optional(),
2118
+ weight: z22.number().nonnegative().nullable().optional(),
2119
+ requiresShipping: z22.boolean().optional(),
2120
+ barcode: z22.string().nullable().optional(),
2121
+ externalId: z22.string().nullable().optional(),
2122
+ isActive: z22.boolean().optional(),
2123
+ thumbnail: z22.string().nullable().optional(),
2124
+ images: z22.array(z22.string()).optional(),
2125
+ metadata: z22.unknown().optional()
1987
2126
  });
1988
- var schema23 = {
1989
- product: z23.record(z23.string(), z23.unknown()).describe(
2127
+ var schema24 = {
2128
+ product: z22.record(z22.string(), z22.unknown()).describe(
1990
2129
  "Product fields. Include `id` to update an existing product; omit for create (then `title` is required)."
1991
2130
  ),
1992
- options: z23.array(optionSchema).optional().describe(
2131
+ options: z22.array(optionSchema).optional().describe(
1993
2132
  "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
2133
  ),
1995
- variants: z23.array(variantSchema).optional().describe(
2134
+ variants: z22.array(variantSchema).optional().describe(
1996
2135
  "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
2136
  )
1998
2137
  };
1999
- var metadata23 = {
2138
+ var metadata24 = {
2000
2139
  name: "product-upsert",
2001
2140
  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
2141
  annotations: {
@@ -2033,8 +2172,8 @@ async function getCollectionSchema(collection) {
2033
2172
  }
2034
2173
 
2035
2174
  // src/tools/get-collection-schema.ts
2036
- var schema24 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2037
- var metadata24 = {
2175
+ var schema25 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2176
+ var metadata25 = {
2038
2177
  name: "get-collection-schema",
2039
2178
  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
2179
  annotations: {
@@ -2085,8 +2224,8 @@ async function getTenantFeatureProgress(feature, includeEvidence = false) {
2085
2224
  }
2086
2225
 
2087
2226
  // src/tools/get-tenant-context.ts
2088
- var schema25 = tenantContextToolInputSchema.shape;
2089
- var metadata25 = {
2227
+ var schema26 = tenantContextToolInputSchema.shape;
2228
+ var metadata26 = {
2090
2229
  name: "get-tenant-context",
2091
2230
  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
2231
  annotations: {
@@ -2163,8 +2302,8 @@ async function handler({
2163
2302
  }
2164
2303
 
2165
2304
  // src/tools/check-feature-progress.ts
2166
- var schema26 = tenantFeatureProgressInputSchema.shape;
2167
- var metadata26 = {
2305
+ var schema27 = tenantFeatureProgressInputSchema.shape;
2306
+ var metadata27 = {
2168
2307
  name: "check-feature-progress",
2169
2308
  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
2309
  annotations: {
@@ -2187,7 +2326,7 @@ async function handler2({
2187
2326
  }
2188
2327
 
2189
2328
  // src/tools/list-configurable-fields.ts
2190
- import { z as z24 } from "zod";
2329
+ import { z as z23 } from "zod";
2191
2330
 
2192
2331
  // src/lib/field-config.ts
2193
2332
  async function fetchFieldConfigs() {
@@ -2210,12 +2349,12 @@ function invalidateFieldConfigCache() {
2210
2349
  }
2211
2350
 
2212
2351
  // src/tools/list-configurable-fields.ts
2213
- var schema27 = {
2214
- collection: z24.string().optional().describe(
2352
+ var schema28 = {
2353
+ collection: z23.string().optional().describe(
2215
2354
  "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
2355
  )
2217
2356
  };
2218
- var metadata27 = {
2357
+ var metadata28 = {
2219
2358
  name: "list-configurable-fields",
2220
2359
  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
2360
  annotations: {
@@ -2246,17 +2385,17 @@ async function listConfigurableFields(params) {
2246
2385
  }
2247
2386
 
2248
2387
  // 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(
2388
+ import { z as z24 } from "zod";
2389
+ var schema29 = {
2390
+ collection: z24.string().min(1).describe("Collection slug (required)"),
2391
+ hiddenFields: z24.array(z24.string().min(1).max(200)).max(300).describe(
2253
2392
  "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
2393
  ),
2255
- isHidden: z25.boolean().optional().describe(
2394
+ isHidden: z24.boolean().optional().describe(
2256
2395
  "Hide the entire collection from Admin Panel (optional). When true, individual hiddenFields are irrelevant."
2257
2396
  )
2258
2397
  };
2259
- var metadata28 = {
2398
+ var metadata29 = {
2260
2399
  name: "update-field-config",
2261
2400
  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
2401
  annotations: {
@@ -2284,7 +2423,7 @@ async function updateFieldConfig(params) {
2284
2423
  }
2285
2424
 
2286
2425
  // src/tools/sdk-get-recipe.ts
2287
- import { z as z26 } from "zod";
2426
+ import { z as z25 } from "zod";
2288
2427
 
2289
2428
  // src/lib/sdk-recipes.ts
2290
2429
  var recipes = {
@@ -2725,8 +2864,8 @@ function getRecipe(goal, runtime = "both") {
2725
2864
  }
2726
2865
 
2727
2866
  // src/tools/sdk-get-recipe.ts
2728
- var schema29 = {
2729
- goal: z26.enum([
2867
+ var schema30 = {
2868
+ goal: z25.enum([
2730
2869
  "fetch-list",
2731
2870
  "fetch-by-id",
2732
2871
  "create-item",
@@ -2738,11 +2877,11 @@ var schema29 = {
2738
2877
  "file-upload",
2739
2878
  "bulk-operations"
2740
2879
  ]).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")
2880
+ runtime: z25.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2881
+ collection: z25.string().optional().describe("Specific collection name if applicable"),
2882
+ includeExample: z25.boolean().default(true).describe("Whether to include a full code example")
2744
2883
  };
2745
- var metadata29 = {
2884
+ var metadata30 = {
2746
2885
  name: "sdk-get-recipe",
2747
2886
  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
2887
  annotations: {
@@ -2785,7 +2924,7 @@ function handler3({
2785
2924
  }
2786
2925
 
2787
2926
  // src/tools/sdk-search-docs.ts
2788
- import { z as z27 } from "zod";
2927
+ import { z as z26 } from "zod";
2789
2928
 
2790
2929
  // src/lib/sdk-doc-index.ts
2791
2930
  var docIndex = [
@@ -2913,8 +3052,19 @@ var docIndex = [
2913
3052
  // Webhooks
2914
3053
  {
2915
3054
  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.",
3055
+ keywords: [
3056
+ "webhook",
3057
+ "hmac",
3058
+ "signature",
3059
+ "WEBHOOK_SECRET",
3060
+ "server-to-server",
3061
+ "event",
3062
+ "order",
3063
+ "orderChanged",
3064
+ "collection.orderChanged",
3065
+ "isOrderChangedWebhookEvent"
3066
+ ],
3067
+ 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
3068
  resourceUri: "docs://sdk/webhook"
2919
3069
  },
2920
3070
  // Order API
@@ -2960,11 +3110,11 @@ function searchDocs(query, limit = 5) {
2960
3110
  }
2961
3111
 
2962
3112
  // 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)")
3113
+ var schema31 = {
3114
+ query: z26.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
3115
+ limit: z26.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
2966
3116
  };
2967
- var metadata30 = {
3117
+ var metadata31 = {
2968
3118
  name: "sdk-search-docs",
2969
3119
  description: "Search SDK documentation by keyword. Returns matching topics with summaries and resource links. Use when looking for specific SDK features or patterns.",
2970
3120
  annotations: {
@@ -2999,9 +3149,9 @@ function handler4({
2999
3149
  }
3000
3150
 
3001
3151
  // src/tools/sdk-get-auth-setup.ts
3002
- import { z as z28 } from "zod";
3003
- var schema31 = {
3004
- scenario: z28.enum([
3152
+ import { z as z27 } from "zod";
3153
+ var schema32 = {
3154
+ scenario: z27.enum([
3005
3155
  "browser-client",
3006
3156
  "server-client",
3007
3157
  "customer-auth",
@@ -3010,7 +3160,7 @@ var schema31 = {
3010
3160
  "webhook-verification"
3011
3161
  ]).describe("Authentication scenario")
3012
3162
  };
3013
- var metadata31 = {
3163
+ var metadata32 = {
3014
3164
  name: "sdk-get-auth-setup",
3015
3165
  description: "Get the current authentication setup for a specific scenario. Returns env var names, code snippets, and security notes.",
3016
3166
  annotations: {
@@ -3134,13 +3284,19 @@ export SOFTWARE_SECRET_KEY=sk01_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
3134
3284
  envVars: ["WEBHOOK_SECRET"],
3135
3285
  code: `import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
3136
3286
 
3287
+ function getWebhookSecret(): string {
3288
+ const secret = process.env.WEBHOOK_SECRET
3289
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
3290
+ return secret
3291
+ }
3292
+
3137
3293
  const customerAuthHandler = createCustomerAuthWebhookHandler({
3138
3294
  passwordReset: sendPasswordResetEmail,
3139
3295
  })
3140
3296
 
3141
3297
  export async function POST(request: Request) {
3142
3298
  return handleWebhook(request, customerAuthHandler, {
3143
- secret: process.env.WEBHOOK_SECRET!,
3299
+ secret: getWebhookSecret(),
3144
3300
  })
3145
3301
  }`,
3146
3302
  notes: [
@@ -3166,14 +3322,14 @@ function handler5({
3166
3322
  }
3167
3323
 
3168
3324
  // src/tools/sdk-get-collection-pattern.ts
3169
- import { z as z29 } from "zod";
3325
+ import { z as z28 } from "zod";
3170
3326
  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")
3327
+ var schema33 = {
3328
+ collection: z28.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3329
+ operation: z28.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3330
+ surface: z28.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3175
3331
  };
3176
- var metadata32 = {
3332
+ var metadata33 = {
3177
3333
  name: "sdk-get-collection-pattern",
3178
3334
  description: "Get the recommended CRUD pattern for a specific collection. Returns code examples for the chosen API surface and operation type.",
3179
3335
  annotations: {
@@ -3369,14 +3525,14 @@ function handler6({
3369
3525
  }
3370
3526
 
3371
3527
  // 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")
3528
+ import { z as z29 } from "zod";
3529
+ var schema34 = {
3530
+ goal: z29.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3531
+ runtime: z29.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3532
+ surface: z29.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3533
+ collection: z29.string().optional().describe("Specific collection if relevant")
3378
3534
  };
3379
- var metadata33 = {
3535
+ var metadata34 = {
3380
3536
  name: "sdk-usage-guide",
3381
3537
  title: "SDK Usage Guide",
3382
3538
  description: "Provides guidance on how to perform a specific task using the 01.software SDK",
@@ -3524,8 +3680,9 @@ You can perform the "${goal}" task by following the patterns above.
3524
3680
  ### Product detail page (slug-based)
3525
3681
 
3526
3682
  \`\`\`typescript
3527
- const product = await client.commerce.product.detail({ slug })
3528
- if (!product) return notFound()
3683
+ const result = await client.commerce.product.detail({ slug })
3684
+ if (!result.found) return notFound()
3685
+ const product = result.product
3529
3686
  // product: { product, variants, options, brand, categories, tags, images, videos, listing }
3530
3687
  \`\`\`
3531
3688
 
@@ -3547,14 +3704,14 @@ const { allAvailable } = await client.commerce.product.stockCheck({
3547
3704
  }
3548
3705
 
3549
3706
  // src/prompts/collection-query-help.ts
3550
- import { z as z31 } from "zod";
3707
+ import { z as z30 } from "zod";
3551
3708
  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)")
3709
+ var schema35 = {
3710
+ collection: z30.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3711
+ operation: z30.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3712
+ filters: z30.string().optional().describe("Filter conditions (JSON string, optional)")
3556
3713
  };
3557
- var metadata34 = {
3714
+ var metadata35 = {
3558
3715
  name: "collection-query-help",
3559
3716
  title: "Collection Query Help",
3560
3717
  description: "Provides guidance on how to write queries for a specific collection",
@@ -3651,16 +3808,16 @@ ${operation === "find" ? `- Use \`where\` option for filtering (Payload query sy
3651
3808
  }
3652
3809
 
3653
3810
  // src/prompts/order-flow-guide.ts
3654
- import { z as z32 } from "zod";
3655
- var schema35 = {
3656
- scenario: z32.enum([
3811
+ import { z as z31 } from "zod";
3812
+ var schema36 = {
3813
+ scenario: z31.enum([
3657
3814
  "simple-order",
3658
3815
  "cart-checkout",
3659
3816
  "return-refund",
3660
3817
  "fulfillment-tracking"
3661
3818
  ]).describe("Order flow scenario")
3662
3819
  };
3663
- var metadata35 = {
3820
+ var metadata36 = {
3664
3821
  name: "order-flow-guide",
3665
3822
  title: "Order Flow Guide",
3666
3823
  description: "Provides step-by-step guidance for ecommerce order flows including creation, checkout, returns, and fulfillment.",
@@ -3675,9 +3832,10 @@ var SCENARIOS = {
3675
3832
  - Provide: orderNumber, customerSnapshot (email required), shippingAddress, orderItems, totalAmount
3676
3833
  - Optional: pgPaymentId (omit for free orders), shippingAmount, discountCode
3677
3834
 
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)
3835
+ 2. **Payment Confirmation** \u2192 ServerClient \`commerce.orders.confirmPayment()\`
3836
+ - Confirm provider payment with pgPaymentId, provider name, and amount
3837
+ - Successful confirmation transitions the order to \`paid\`
3838
+ - Paid orders reserve sellable quantity (reservedStock += qty); physical stock is decremented on delivery
3681
3839
 
3682
3840
  3. **Fulfillment** \u2192 \`create-fulfillment\` tool
3683
3841
  - Provide carrier + trackingNumber for shipped status
@@ -3697,18 +3855,20 @@ const client = createServerClient({
3697
3855
  const order = await client.commerce.orders.create({
3698
3856
  orderNumber: 'ORD-240101-001',
3699
3857
  customerSnapshot: { email: 'user@example.com', name: 'John' },
3700
- shippingAddress: { postalCode: '06000', address1: '123 Main St' },
3858
+ shippingAddress: { postalCode: '06000', address: '123 Main St' },
3701
3859
  orderItems: [{ product: 'prod-id', variant: 'var-id', option: 'opt-id', quantity: 2 }],
3702
3860
  totalAmount: 59800,
3703
3861
  pgPaymentId: 'pay_xxx' // omit for free orders
3704
3862
  })
3705
3863
 
3706
3864
  // 2. After payment confirmed by provider
3707
- await client.commerce.orders.updateTransaction({
3865
+ await client.commerce.orders.confirmPayment({
3866
+ orderNumber: 'ORD-240101-001',
3708
3867
  pgPaymentId: 'pay_xxx',
3709
- status: 'paid',
3710
- paymentKey: 'payment_key_xxx',
3711
- amount: 59800
3868
+ pgProvider: 'provider',
3869
+ amount: 59800,
3870
+ paymentMethod: 'card',
3871
+ confirmationSource: 'provider_api_confirm'
3712
3872
  })
3713
3873
 
3714
3874
  // 3. Ship items
@@ -3727,7 +3887,7 @@ await client.commerce.orders.createFulfillment({
3727
3887
  2. **Apply Discount** (optional) \u2192 \`apply-discount\` tool
3728
3888
  3. **Calculate Shipping** \u2192 \`calculate-shipping\` tool
3729
3889
  4. **Checkout** \u2192 \`checkout\` tool (converts cart to order)
3730
- 5. **Payment** \u2192 \`update-transaction\` for provider-verified paid transitions
3890
+ 5. **Payment** \u2192 ServerClient \`commerce.orders.confirmPayment()\` for provider-verified paid transitions
3731
3891
 
3732
3892
  ### Key Points
3733
3893
  - Cart has a customer linked \u2014 auto-copied to order on checkout
@@ -3758,12 +3918,13 @@ const order = await client.commerce.orders.checkout({
3758
3918
  1. **Create Return** \u2192 \`create-return\` tool
3759
3919
  - Order must be \`delivered\` or \`confirmed\`
3760
3920
  - Specify returnItems and refundAmount
3761
- - Return status: requested \u2192 processing \u2192 approved \u2192 completed
3921
+ - Operator transitions: requested \u2192 processing/rejected, processing \u2192 approved/rejected
3922
+ - \`completed\` is server-derived and requires \`return-with-refund\`
3762
3923
 
3763
3924
  ### Option B: Return + Refund (atomic, recommended)
3764
3925
  1. **Return with Refund** \u2192 \`return-with-refund\` tool
3765
3926
  - Handles return + stock restoration + transaction update in one call
3766
- - Return immediately completed (bypasses FSM)
3927
+ - Sets the return to \`completed\` after provider-verified refund
3767
3928
  - Requires pgPaymentId and paymentKey for provider-verified refund
3768
3929
 
3769
3930
  ### Key Points
@@ -3779,8 +3940,9 @@ await client.commerce.orders.returnWithRefund({
3779
3940
  orderNumber: 'ORD-240101-001',
3780
3941
  reason: 'defective',
3781
3942
  reasonDetail: 'Product arrived damaged',
3782
- returnItems: [{ orderItem: 'oi-id', quantity: 1 }],
3943
+ returnItems: [{ orderItem: 'oi-id', quantity: 1, restockingFee: 500 }],
3783
3944
  refundAmount: 29900,
3945
+ returnShippingFee: 1500,
3784
3946
  pgPaymentId: 'pay_xxx',
3785
3947
  paymentKey: 'payment_key_xxx'
3786
3948
  })
@@ -3840,14 +4002,14 @@ ${SCENARIOS[scenario] || "Unknown scenario."}
3840
4002
  - \`checkout\`
3841
4003
  - \`create-fulfillment\`, \`update-fulfillment\`
3842
4004
  - \`create-return\`, \`update-return\`, \`return-with-refund\`
3843
- - \`update-transaction\`
4005
+ - \`confirm-payment\`, \`update-transaction\`
3844
4006
  - \`validate-discount\`, \`calculate-shipping\``;
3845
4007
  }
3846
4008
 
3847
4009
  // src/prompts/feature-setup-guide.ts
3848
- import { z as z33 } from "zod";
3849
- var schema36 = {
3850
- feature: z33.enum([
4010
+ import { z as z32 } from "zod";
4011
+ var schema37 = {
4012
+ feature: z32.enum([
3851
4013
  "ecommerce",
3852
4014
  "customers",
3853
4015
  "articles",
@@ -3862,7 +4024,7 @@ var schema36 = {
3862
4024
  "community"
3863
4025
  ]).describe("Feature to get setup guide for")
3864
4026
  };
3865
- var metadata36 = {
4027
+ var metadata37 = {
3866
4028
  name: "feature-setup-guide",
3867
4029
  title: "Feature Setup Guide",
3868
4030
  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 +4232,7 @@ ${FEATURES[feature] || "Unknown feature."}
4070
4232
  }
4071
4233
 
4072
4234
  // src/resources/(config)/app.ts
4073
- var metadata37 = {
4235
+ var metadata38 = {
4074
4236
  name: "app-config",
4075
4237
  title: "Application Config",
4076
4238
  description: "01.software SDK and MCP server configuration information"
@@ -4114,7 +4276,7 @@ The hosted HTTP MCP endpoint at https://mcp.01.software/mcp exposes only these O
4114
4276
  - \`sdk-get-auth-setup\` - Get framework-specific auth setup guidance
4115
4277
  - \`sdk-get-collection-pattern\` - Get collection-specific usage patterns
4116
4278
 
4117
- ## Local CLI Stdio Surface (30)
4279
+ ## Local CLI Stdio Surface (33)
4118
4280
 
4119
4281
  For trusted local server-key workflows, start the stdio server:
4120
4282
 
@@ -4122,7 +4284,7 @@ For trusted local server-key workflows, start the stdio server:
4122
4284
  npx @01.software/cli mcp
4123
4285
  \`\`\`
4124
4286
 
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.
4287
+ 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
4288
 
4127
4289
  ## Rate Limits
4128
4290
 
@@ -4136,7 +4298,7 @@ Rate limits depend on your tenant plan:
4136
4298
 
4137
4299
  // src/resources/(collections)/schema.ts
4138
4300
  import { COLLECTIONS as COLLECTIONS3 } from "@01.software/sdk";
4139
- var metadata38 = {
4301
+ var metadata39 = {
4140
4302
  name: "collections-schema",
4141
4303
  title: "Collection Schema Info",
4142
4304
  description: "Available collections and their schema information"
@@ -4273,7 +4435,7 @@ Total available collections: ${COLLECTIONS3.length}`;
4273
4435
  }
4274
4436
 
4275
4437
  // src/resources/(docs)/getting-started.ts
4276
- var metadata39 = {
4438
+ var metadata40 = {
4277
4439
  name: "docs-getting-started",
4278
4440
  title: "Getting Started",
4279
4441
  description: "01.software SDK getting started guide"
@@ -4334,7 +4496,7 @@ const result = await client.collections.from('products').find({
4334
4496
  }
4335
4497
 
4336
4498
  // src/resources/(docs)/guides.ts
4337
- var metadata40 = {
4499
+ var metadata41 = {
4338
4500
  name: "docs-guides",
4339
4501
  title: "Guides",
4340
4502
  description: "01.software SDK usage guides"
@@ -4547,7 +4709,7 @@ For more implementation guidance, see the [SDK Guide](/developers/sdk).`;
4547
4709
  }
4548
4710
 
4549
4711
  // src/resources/(docs)/api.ts
4550
- var metadata41 = {
4712
+ var metadata42 = {
4551
4713
  name: "docs-api",
4552
4714
  title: "API Reference",
4553
4715
  description: "01.software SDK API reference documentation"
@@ -4830,7 +4992,7 @@ For more details, see the [API documentation](/developers/api).`;
4830
4992
  }
4831
4993
 
4832
4994
  // src/resources/(docs)/query-builder.ts
4833
- var metadata42 = {
4995
+ var metadata43 = {
4834
4996
  name: "docs-query-builder",
4835
4997
  title: "Query Builder",
4836
4998
  description: "01.software SDK Query Builder API reference (client.collections.from)"
@@ -5024,7 +5186,7 @@ console.log(result.hasNextPage) // true
5024
5186
  }
5025
5187
 
5026
5188
  // src/resources/(docs)/react-query.ts
5027
- var metadata43 = {
5189
+ var metadata44 = {
5028
5190
  name: "docs-react-query",
5029
5191
  title: "React Query Hooks",
5030
5192
  description: "01.software SDK React Query hooks reference (@01.software/sdk/query)"
@@ -5256,7 +5418,7 @@ export function ProductList() {
5256
5418
  }
5257
5419
 
5258
5420
  // src/resources/(docs)/server-api.ts
5259
- var metadata44 = {
5421
+ var metadata45 = {
5260
5422
  name: "docs-server-api",
5261
5423
  title: "Server-side API",
5262
5424
  description: "01.software SDK server-side API reference (client.commerce) for orders, fulfillments, returns, carts, and validation"
@@ -5294,16 +5456,16 @@ const order = await client.commerce.orders.create({
5294
5456
  recipientName: 'John Doe',
5295
5457
  phone: '+821012345678',
5296
5458
  postalCode: '06234',
5297
- address1: '123 Main St',
5298
- address2: 'Apt 4B',
5459
+ address: '123 Main St',
5460
+ detailAddress: 'Apt 4B',
5299
5461
  deliveryMessage?: 'Leave at door',
5300
5462
  },
5301
5463
  orderItems: [
5302
- { product: 'product-id', variant: 'variant-id', option: 'option-id', quantity: 2, unitPrice: 29900 }
5464
+ { product: 'product-id', variant: 'variant-id', option: 'option-id', quantity: 2 }
5303
5465
  ],
5304
5466
  totalAmount: 59800,
5305
5467
  shippingAmount?: 3000,
5306
- pgPaymentId?: 'toss-payment-id', // omit for free orders
5468
+ pgPaymentId?: 'provider-payment-id', // omit for free orders
5307
5469
  })
5308
5470
  \`\`\`
5309
5471
 
@@ -5315,7 +5477,7 @@ const order = await client.commerce.orders.checkout({
5315
5477
  cartId: 'cart-id',
5316
5478
  orderNumber: 'ORD-20240101-0001',
5317
5479
  customerSnapshot: { name: 'John Doe', email: 'john@example.com' },
5318
- pgPaymentId?: 'toss-payment-id',
5480
+ pgPaymentId?: 'provider-payment-id',
5319
5481
  })
5320
5482
  \`\`\`
5321
5483
 
@@ -5387,12 +5549,12 @@ const ret = await client.commerce.orders.createReturn({
5387
5549
  \`\`\`
5388
5550
 
5389
5551
  ### updateReturn()
5390
- Update return status.
5552
+ Update operator-driven return status. \`completed\` is server-derived and must go through \`returnWithRefund()\`.
5391
5553
 
5392
5554
  \`\`\`typescript
5393
5555
  const ret = await client.commerce.orders.updateReturn({
5394
5556
  returnId: 'return-id',
5395
- status: 'processing', // processing | approved | completed | rejected
5557
+ status: 'processing', // processing | approved | rejected
5396
5558
  })
5397
5559
  \`\`\`
5398
5560
 
@@ -5405,27 +5567,49 @@ const result = await client.commerce.orders.returnWithRefund({
5405
5567
  reason?: 'defective',
5406
5568
  reasonDetail?: 'Screen cracked on arrival',
5407
5569
  returnItems: [
5408
- { orderItem: 'order-item-id', quantity: 1 }
5570
+ { orderItem: 'order-item-id', quantity: 1, restockingFee?: 500 }
5409
5571
  ],
5410
5572
  refundAmount: 29900,
5411
- pgPaymentId: 'toss-payment-id', // required
5412
- paymentKey: 'toss-payment-key', // required for provider refund
5573
+ returnShippingFee?: 1500,
5574
+ pgPaymentId: 'provider-payment-id', // required
5575
+ paymentKey: 'provider-payment-key', // required for provider refund
5413
5576
  refundReceiptUrl?: 'https://...',
5414
5577
  })
5415
5578
  \`\`\`
5416
5579
 
5417
5580
  ## Transaction API
5418
5581
 
5582
+ ### confirmPayment()
5583
+ Confirm a provider-verified payment and transition the order to paid. Verify the
5584
+ payment with the provider first, then call this endpoint with the provider name,
5585
+ amount, and an idempotency event ID when available.
5586
+
5587
+ \`\`\`typescript
5588
+ const result = await client.commerce.orders.confirmPayment({
5589
+ orderNumber: 'ORD-20240101-0001',
5590
+ pgPaymentId: 'provider-payment-id',
5591
+ pgProvider: 'provider-name',
5592
+ amount: 29900,
5593
+ currency: 'KRW',
5594
+ paymentMethod: 'card',
5595
+ providerStatus: 'PAID',
5596
+ providerEventId: 'provider-event-id',
5597
+ confirmationSource: 'provider_api_confirm',
5598
+ })
5599
+ \`\`\`
5600
+
5419
5601
  ### updateTransaction()
5420
- Confirm or annotate a transaction. Paid transitions require provider
5421
- verification; non-financial annotations can still update pending transactions.
5602
+ Lower-level transaction update path. Prefer \`confirmPayment()\` for normal paid
5603
+ transitions. Use this only for compatibility paths that still require direct
5604
+ transaction annotation after provider verification, or for non-paid pending
5605
+ transaction updates.
5422
5606
 
5423
5607
  \`\`\`typescript
5424
5608
  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
5609
+ pgPaymentId: 'provider-payment-id',
5610
+ status: 'failed', // pending | paid | failed | canceled
5611
+ paymentMethod: 'card',
5612
+ receiptUrl: 'https://...',
5429
5613
  })
5430
5614
  \`\`\`
5431
5615
 
@@ -5518,7 +5702,7 @@ const result = await client.commerce.shipping.calculate({
5518
5702
  }
5519
5703
 
5520
5704
  // src/resources/(docs)/customer-auth.ts
5521
- var metadata45 = {
5705
+ var metadata46 = {
5522
5706
  name: "docs-customer-auth",
5523
5707
  title: "Customer Auth API",
5524
5708
  description: "01.software SDK Customer Auth API reference (client.customer)"
@@ -5696,7 +5880,7 @@ async function loadProfile() {
5696
5880
  }
5697
5881
 
5698
5882
  // src/resources/(docs)/browser-vs-server.ts
5699
- var metadata46 = {
5883
+ var metadata47 = {
5700
5884
  name: "docs-browser-vs-server",
5701
5885
  title: "Client vs ServerClient",
5702
5886
  description: "When to use Client (createClient) vs ServerClient (createServerClient) in the 01.software SDK"
@@ -5862,7 +6046,7 @@ export function ProductList() {
5862
6046
  }
5863
6047
 
5864
6048
  // src/resources/(docs)/file-upload.ts
5865
- var metadata47 = {
6049
+ var metadata48 = {
5866
6050
  name: "docs-file-upload",
5867
6051
  title: "File Upload",
5868
6052
  description: "01.software SDK file upload patterns using the images collection"
@@ -6013,7 +6197,7 @@ The platform stores files in Cloudflare R2 and serves via CDN (\`cdn.01.software
6013
6197
  }
6014
6198
 
6015
6199
  // src/resources/(docs)/webhook.ts
6016
- var metadata48 = {
6200
+ var metadata49 = {
6017
6201
  name: "docs-webhook",
6018
6202
  title: "Webhooks",
6019
6203
  description: "01.software SDK webhook verification and event handling"
@@ -6021,15 +6205,21 @@ var metadata48 = {
6021
6205
  function handler18() {
6022
6206
  return `# Webhooks
6023
6207
 
6024
- The platform dispatches HMAC-SHA256 signed webhook events to your registered URLs. Tenant developers own routing inside their webhook handler.
6208
+ The platform dispatches HMAC-SHA256 signed webhook events to registered URLs. Tenant developers own routing inside their webhook handler.
6025
6209
 
6026
6210
  ## Webhook Handling
6027
6211
 
6028
- Use the SDK \`handleWebhook\` helper to verify signatures. For customer auth events, use \`createCustomerAuthWebhookHandler\` to wire delivery behavior in your app.
6212
+ Use the SDK \`handleWebhook\` helper to verify signatures. For customer auth events, use \`createCustomerAuthWebhookHandler\`; for semantic events, use SDK guards before reading event-specific fields.
6029
6213
 
6030
6214
  \`\`\`typescript
6031
6215
  import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
6032
6216
 
6217
+ function getWebhookSecret(): string {
6218
+ const secret = process.env.WEBHOOK_SECRET
6219
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6220
+ return secret
6221
+ }
6222
+
6033
6223
  const handler = createCustomerAuthWebhookHandler({
6034
6224
  passwordReset: async (data) => {
6035
6225
  await sendPasswordResetEmail(data)
@@ -6038,7 +6228,7 @@ const handler = createCustomerAuthWebhookHandler({
6038
6228
 
6039
6229
  export async function POST(request: Request) {
6040
6230
  return handleWebhook(request, handler, {
6041
- secret: process.env.WEBHOOK_SECRET!,
6231
+ secret: getWebhookSecret(),
6042
6232
  })
6043
6233
  }
6044
6234
  \`\`\`
@@ -6051,6 +6241,12 @@ export async function POST(request: Request) {
6051
6241
  // app/api/webhooks/route.ts
6052
6242
  import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
6053
6243
 
6244
+ function getWebhookSecret(): string {
6245
+ const secret = process.env.WEBHOOK_SECRET
6246
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6247
+ return secret
6248
+ }
6249
+
6054
6250
  const customerAuthHandler = createCustomerAuthWebhookHandler({
6055
6251
  passwordReset: sendPasswordResetEmail,
6056
6252
  })
@@ -6061,25 +6257,161 @@ export async function POST(request: Request) {
6061
6257
 
6062
6258
  await customerAuthHandler(event)
6063
6259
  }, {
6064
- secret: process.env.WEBHOOK_SECRET!,
6260
+ secret: getWebhookSecret(),
6065
6261
  })
6066
6262
  }
6067
6263
  \`\`\`
6068
6264
 
6265
+ ## Commerce Notification Handler Example
6266
+
6267
+ \`\`\`typescript
6268
+ import {
6269
+ handleWebhook,
6270
+ isCommerceNotificationWebhookEvent,
6271
+ } from '@01.software/sdk/webhook'
6272
+
6273
+ function getWebhookSecret(): string {
6274
+ const secret = process.env.WEBHOOK_SECRET
6275
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6276
+ return secret
6277
+ }
6278
+
6279
+ export async function POST(request: Request) {
6280
+ return handleWebhook(request, async (event) => {
6281
+ if (!isCommerceNotificationWebhookEvent(event)) return
6282
+
6283
+ const idempotencyKey = \`\${event.notification.intentId}:\${event.notification.dedupeKey}\`
6284
+ const processed = await processOnce(idempotencyKey, async () => {
6285
+ if (event.notification.event === 'orderPaid') {
6286
+ const orderId = event.notification.orderId ?? event.data.orderId
6287
+ if (orderId) await updateOrderWorkflow(orderId)
6288
+ }
6289
+
6290
+ if (event.notification.event === 'fulfillmentShipped') {
6291
+ const fulfillmentId =
6292
+ event.notification.fulfillmentId ?? event.data.fulfillmentId
6293
+ if (fulfillmentId) await updateFulfillmentWorkflow(fulfillmentId)
6294
+ }
6295
+ })
6296
+
6297
+ if (!processed) return
6298
+ }, {
6299
+ secret: getWebhookSecret(),
6300
+ })
6301
+ }
6302
+ \`\`\`
6303
+
6304
+ Back \`processOnce()\` with durable storage such as a database unique key or queue idempotency store; do not use process-local memory for webhook idempotency.
6305
+
6306
+ ## Headless Commerce Email Workers
6307
+
6308
+ For tenant-owned transactional email, use \`commerce.notification\` as the trigger and build a signed worker with \`createCommerceEmailWebhookHandler()\`. 01.software owns event timing, delivery retries, signing, and idempotency signals; the tenant worker owns template rendering, provider credentials, extra order/customer fetches via \`createServerClient\`, and final delivery through a tenant provider such as Resend.
6309
+
6310
+ Use \`getCommerceNotificationIdempotencyKey(event)\` or the \`idempotencyKey\` passed by \`createCommerceEmailWebhookHandler()\`, then guard provider sends with durable \`processOnce(idempotencyKey, ...)\` storage. The webhook payload is PII-light and is not enough for recipient data, so fetch recipient/template context with server SDK credentials. In the v1 headless path, do not store tenant ESP secrets in 01.software and do not ask 01.software to send directly through the tenant provider.
6311
+
6069
6312
  ## Webhook Payload Structure
6070
6313
 
6071
6314
  All webhook events share this envelope:
6072
6315
 
6073
6316
  \`\`\`typescript
6074
6317
  {
6075
- collection: string, // e.g. 'customers'
6076
- operation: string, // e.g. 'password-reset'
6077
- data: object, // event-specific payload
6318
+ collection: string,
6319
+ operation: string,
6320
+ data: object,
6321
+ eventType?: string,
6322
+ change?: object,
6323
+ notification?: object,
6324
+ timestamp?: string,
6325
+ deliveryId?: string,
6078
6326
  }
6079
6327
  \`\`\`
6080
6328
 
6081
6329
  ## Event Types
6082
6330
 
6331
+ ### Commerce Notification
6332
+
6333
+ V1 commerce notification webhooks use \`eventType: "commerce.notification"\` and \`operation: "notification"\`. The public SDK exports \`COMMERCE_NOTIFICATION_EVENT_TYPE\`, \`COMMERCE_NOTIFICATION_OPERATION\`, commerce notification types, and \`isCommerceNotificationWebhookEvent()\` from \`@01.software/sdk/webhook\`.
6334
+
6335
+ Canonical example (public operational identifiers only; no PII, payment/provider fields, metadata, tracking number, or tracking URL):
6336
+
6337
+ \`\`\`json
6338
+ {
6339
+ "eventType": "commerce.notification",
6340
+ "collection": "orders",
6341
+ "operation": "notification",
6342
+ "data": {
6343
+ "orderId": "order_123",
6344
+ "orderNumber": "ORD-1001",
6345
+ "status": "paid",
6346
+ "totalAmount": 5000,
6347
+ "currency": "KRW"
6348
+ },
6349
+ "notification": {
6350
+ "event": "orderPaid",
6351
+ "intentId": "intent_123",
6352
+ "dedupeKey": "orderPaid:order_123",
6353
+ "orderId": "order_123"
6354
+ },
6355
+ "timestamp": "2026-05-29T00:00:00.000Z",
6356
+ "deliveryId": "delivery_attempt_123"
6357
+ }
6358
+ \`\`\`
6359
+
6360
+ Use \`notification.intentId\` plus \`notification.dedupeKey\` for semantic idempotency. \`deliveryId\` is per delivery attempt / observability and may not be stable across semantic retries.
6361
+ Some normalized deliveries may include \`data.source\` or \`change\` metadata, but handlers should treat those fields as optional. Route from \`notification.orderId\`, \`notification.fulfillmentId\`, \`notification.returnId\`, or the matching typed \`data.*Id\` field.
6362
+
6363
+ V1 source subscription semantics:
6364
+
6365
+ - \`orderPaid\` and \`orderDelivered\` are delivered through \`orders\`-scoped endpoints.
6366
+ - \`fulfillmentShipped\` is delivered through \`fulfillments\`-scoped endpoints.
6367
+ - \`returnRequested\` and \`returnCompleted\` are delivered through \`returns\`-scoped endpoints.
6368
+ - Empty, unscoped, and all-collection endpoints do not receive v1 semantic commerce notifications.
6369
+
6370
+ ### Collection Order Changed
6371
+
6372
+ Admin Panel manual ordering is delivered as a semantic collection update:
6373
+
6374
+ - \`operation\` remains \`"update"\` for compatibility.
6375
+ - \`eventType\` is \`"collection.orderChanged"\`.
6376
+ - SDK handlers should use \`isOrderChangedWebhookEvent()\` from \`@01.software/sdk/webhook\`.
6377
+ - \`change.scope\` identifies collection-level ordering versus join ordering.
6378
+ - Route on public semantics such as \`change.scope.collection\`, \`change.scope.field\`, and \`change.moved.id\`.
6379
+ - Do not branch on hidden Payload order fields or private backing collections; diagnostic fields may still be present.
6380
+ - Customer group member ordering is currently unsupported and does not emit a semantic order-change webhook.
6381
+
6382
+ \`\`\`typescript
6383
+ import { handleWebhook, isOrderChangedWebhookEvent } from '@01.software/sdk/webhook'
6384
+
6385
+ function getWebhookSecret(): string {
6386
+ const secret = process.env.WEBHOOK_SECRET
6387
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6388
+ return secret
6389
+ }
6390
+
6391
+ export async function POST(request: Request) {
6392
+ return handleWebhook(
6393
+ request,
6394
+ async (event) => {
6395
+ if (isOrderChangedWebhookEvent(event)) {
6396
+ if (event.change.scope.kind === 'join') {
6397
+ console.log('Join order changed', {
6398
+ collection: event.change.scope.collection,
6399
+ field: event.change.scope.field,
6400
+ parentId: event.change.scope.id,
6401
+ movedCollection: event.change.moved.collection,
6402
+ movedId: event.change.moved.id,
6403
+ })
6404
+ }
6405
+ return
6406
+ }
6407
+
6408
+ console.log('Content changed', event.collection, event.operation)
6409
+ },
6410
+ { secret: getWebhookSecret() },
6411
+ )
6412
+ }
6413
+ \`\`\`
6414
+
6083
6415
  ### Customer Password Reset
6084
6416
 
6085
6417
  Dispatched when a customer calls \`client.customer.forgotPassword(email)\`.
@@ -6092,8 +6424,8 @@ Dispatched when a customer calls \`client.customer.forgotPassword(email)\`.
6092
6424
  customerId: string,
6093
6425
  email: string,
6094
6426
  name: string,
6095
- resetPasswordToken: string, // raw token to include in reset link
6096
- resetPasswordExpiresAt: string, // ISO 8601 expiry (1 hour from dispatch)
6427
+ resetPasswordToken: string,
6428
+ resetPasswordExpiresAt: string,
6097
6429
  }
6098
6430
  }
6099
6431
  \`\`\`
@@ -6108,11 +6440,13 @@ async function sendPasswordResetEmail(data: {
6108
6440
  resetPasswordToken: string
6109
6441
  resetPasswordExpiresAt: string
6110
6442
  }) {
6111
- const resetUrl = \`https://yourstore.com/reset-password?token=\${data.resetPasswordToken}\`
6443
+ const resetUrl = new URL('https://yourstore.com/reset-password')
6444
+ resetUrl.searchParams.set('token', data.resetPasswordToken)
6445
+
6112
6446
  await emailService.send({
6113
6447
  to: data.email,
6114
6448
  subject: 'Reset your password',
6115
- body: \`Reset link (expires \${data.resetPasswordExpiresAt}): \${resetUrl}\`,
6449
+ body: \`Reset link (expires \${data.resetPasswordExpiresAt}): \${resetUrl.toString()}\`,
6116
6450
  })
6117
6451
  }
6118
6452
  \`\`\`
@@ -6123,11 +6457,11 @@ Failed webhook deliveries are queued with automatic retries. Ensure your handler
6123
6457
 
6124
6458
  ## Webhook Configuration
6125
6459
 
6126
- Configure webhook URLs in the 01.software console under Tenant Settings > Webhooks. Multiple URLs can be registered; all receive every event.`;
6460
+ Configure webhook URLs in the 01.software console under Tenant Settings > Webhooks. Multiple URLs can be registered; scoped endpoints receive events for their configured source collection.`;
6127
6461
  }
6128
6462
 
6129
6463
  // src/resources/(docs)/product-detail.ts
6130
- var metadata49 = {
6464
+ var metadata50 = {
6131
6465
  name: "docs-product-detail",
6132
6466
  title: "Product Detail Helper",
6133
6467
  description: "01.software SDK commerce.product.detail helper guide"
@@ -6151,8 +6485,8 @@ const client = createClient({
6151
6485
  })
6152
6486
 
6153
6487
  const detail = await client.commerce.product.detail({ slug: 'my-product' })
6154
- if (!detail) return notFound()
6155
- const selection = resolveProductSelection(detail, {
6488
+ if (!detail.found) return notFound()
6489
+ const selection = resolveProductSelection(detail.product, {
6156
6490
  search: '?opt.option-color=color-black',
6157
6491
  })
6158
6492
  // selection.selectedVariant, selection.price, selection.stock, selection.media
@@ -6203,23 +6537,41 @@ export default async function ProductPage({ params }: { params: { slug: string }
6203
6537
  publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
6204
6538
  })
6205
6539
  const detail = await client.commerce.product.detail({ slug: params.slug })
6206
- if (!detail) return notFound()
6207
- return <ProductView detail={detail} />
6540
+ if (!detail.found) return notFound()
6541
+ return <ProductView detail={detail.product} />
6208
6542
  }
6209
6543
  \`\`\`
6210
6544
 
6211
- ## The \`null\` return contract
6545
+ ## The \`ProductDetailResult\` return contract
6546
+
6547
+ The endpoint returns 404 for \`not_found\`, \`not_published\`, or \`feature_disabled\`. The SDK maps those product-detail 404s to \`{ found: false, reason }\` so consumer UIs can render a standard 404, preview CTA, or feature-gating UI. Permission/auth errors, including 403 tenant mismatches, still throw typed SDK errors.
6212
6548
 
6213
- The endpoint returns 404 for \`not_found\`, \`not_published\`, \`tenant_mismatch\`, or \`feature_disabled\`. The SDK collapses all 404s to \`null\` so consumer UIs render one "not available" path.
6549
+ Successful product payloads expose inventory rollups without sentinel values: \`product.totalInventory\` is the tracked stock sum across non-unlimited variants, \`null\` when no variants are tracked, and \`product.hasUnlimitedVariant\` signals whether any variant is unlimited.
6214
6550
 
6215
6551
  ## Backend correlation
6216
6552
 
6217
- Log \`client.lastRequestId\` against backend logs \u2014 the endpoint records the exact 404 code alongside the request ID.`;
6553
+ Log \`client.lastRequestId\` against backend logs \u2014 the endpoint records the exact 404 reason alongside the request ID.`;
6218
6554
  }
6219
6555
 
6220
6556
  // src/server.ts
6221
6557
  var REGISTERED_TOOLS_BY_SERVER = /* @__PURE__ */ new WeakMap();
6222
- function registerTool(server, schema37, meta, handler21) {
6558
+ function hasToolPolicy(toolName) {
6559
+ return Object.prototype.hasOwnProperty.call(TOOL_POLICY_MANIFEST, toolName);
6560
+ }
6561
+ function runtimeAnnotationsFor(meta) {
6562
+ if (!hasToolPolicy(meta.name)) {
6563
+ throw new Error(`No tool-policy entry for registered MCP tool ${meta.name}`);
6564
+ }
6565
+ const policy = TOOL_POLICY_MANIFEST[meta.name];
6566
+ return {
6567
+ title: meta.annotations?.title,
6568
+ readOnlyHint: policy.annotationPolicy.readOnly,
6569
+ destructiveHint: policy.annotationPolicy.destructive,
6570
+ idempotentHint: policy.annotationPolicy.idempotent,
6571
+ openWorldHint: policy.annotationPolicy.openWorld
6572
+ };
6573
+ }
6574
+ function registerTool(server, schema38, meta, handler21) {
6223
6575
  let registered = REGISTERED_TOOLS_BY_SERVER.get(server);
6224
6576
  if (!registered) {
6225
6577
  registered = /* @__PURE__ */ new Set();
@@ -6230,16 +6582,20 @@ function registerTool(server, schema37, meta, handler21) {
6230
6582
  meta.name,
6231
6583
  {
6232
6584
  description: meta.description,
6233
- inputSchema: schema37,
6234
- annotations: meta.annotations
6585
+ inputSchema: schema38,
6586
+ annotations: runtimeAnnotationsFor(meta)
6235
6587
  },
6236
6588
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6237
6589
  async (params) => {
6238
6590
  const ctx = tenantAuthContext();
6239
6591
  if (ctx) {
6240
- const decision = evaluateToolPolicy(meta.name, ctx.scopes);
6592
+ const decision = evaluateToolPolicy(
6593
+ meta.name,
6594
+ ctx.scopes,
6595
+ ctx.tenantRole
6596
+ );
6241
6597
  if (!decision.allowed) {
6242
- const status = decision.reason === "insufficient_scope" ? 403 : 500;
6598
+ const status = decision.reason === "insufficient_scope" || decision.reason === "insufficient_role" ? 403 : 500;
6243
6599
  return {
6244
6600
  content: [
6245
6601
  {
@@ -6276,13 +6632,13 @@ function registerTool(server, schema37, meta, handler21) {
6276
6632
  }
6277
6633
  );
6278
6634
  }
6279
- function registerPrompt(server, schema37, meta, handler21) {
6635
+ function registerPrompt(server, schema38, meta, handler21) {
6280
6636
  server.registerPrompt(
6281
6637
  meta.name,
6282
6638
  {
6283
6639
  title: meta.title,
6284
6640
  description: meta.description,
6285
- argsSchema: schema37
6641
+ argsSchema: schema38
6286
6642
  },
6287
6643
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6288
6644
  (params) => ({
@@ -6354,211 +6710,232 @@ function createServer(options = {}) {
6354
6710
  server,
6355
6711
  schema10,
6356
6712
  metadata10,
6357
- createReturn
6713
+ confirmPayment
6358
6714
  );
6359
6715
  registerTool(
6360
6716
  server,
6361
6717
  schema11,
6362
6718
  metadata11,
6363
- updateReturn
6719
+ createReturn
6364
6720
  );
6365
6721
  registerTool(
6366
6722
  server,
6367
6723
  schema12,
6368
6724
  metadata12,
6369
- returnWithRefund
6725
+ updateReturn
6370
6726
  );
6371
- registerTool(server, schema13, metadata13, addCartItem);
6372
6727
  registerTool(
6373
6728
  server,
6374
- schema14,
6375
- metadata14,
6376
- updateCartItem
6729
+ schema13,
6730
+ metadata13,
6731
+ returnWithRefund
6377
6732
  );
6733
+ registerTool(server, schema14, metadata14, addCartItem);
6378
6734
  registerTool(
6379
6735
  server,
6380
6736
  schema15,
6381
6737
  metadata15,
6382
- removeCartItem
6738
+ updateCartItem
6383
6739
  );
6384
6740
  registerTool(
6385
6741
  server,
6386
6742
  schema16,
6387
6743
  metadata16,
6388
- applyDiscount
6744
+ removeCartItem
6389
6745
  );
6390
6746
  registerTool(
6391
6747
  server,
6392
6748
  schema17,
6393
6749
  metadata17,
6394
- removeDiscount
6750
+ applyDiscount
6395
6751
  );
6396
- registerTool(server, schema18, metadata18, clearCart);
6397
6752
  registerTool(
6398
6753
  server,
6399
- schema19,
6400
- metadata19,
6401
- validateDiscount
6754
+ schema18,
6755
+ metadata18,
6756
+ removeDiscount
6402
6757
  );
6758
+ registerTool(server, schema19, metadata19, clearCart);
6403
6759
  registerTool(
6404
6760
  server,
6405
6761
  schema20,
6406
6762
  metadata20,
6763
+ validateDiscount
6764
+ );
6765
+ registerTool(
6766
+ server,
6767
+ schema21,
6768
+ metadata21,
6407
6769
  calculateShipping
6408
6770
  );
6409
- registerTool(server, schema21, metadata21, stockCheck);
6410
- registerTool(server, schema22, metadata22, productDetail);
6771
+ registerTool(server, schema22, metadata22, stockCheck);
6411
6772
  registerTool(
6412
6773
  server,
6413
6774
  schema23,
6414
6775
  metadata23,
6776
+ productDetail
6777
+ );
6778
+ registerTool(
6779
+ server,
6780
+ schema24,
6781
+ metadata24,
6415
6782
  productUpsert
6416
6783
  );
6417
6784
  }
6418
- registerTool(
6419
- server,
6420
- schema24,
6421
- metadata24,
6422
- getCollectionSchemaTool
6423
- );
6424
6785
  registerTool(
6425
6786
  server,
6426
6787
  schema25,
6427
6788
  metadata25,
6428
- handler
6789
+ getCollectionSchemaTool
6429
6790
  );
6430
6791
  registerTool(
6431
6792
  server,
6432
6793
  schema26,
6433
6794
  metadata26,
6434
- handler2
6795
+ handler
6435
6796
  );
6436
6797
  registerTool(
6437
6798
  server,
6438
6799
  schema27,
6439
6800
  metadata27,
6440
- listConfigurableFields
6801
+ handler2
6441
6802
  );
6442
6803
  registerTool(
6443
6804
  server,
6444
6805
  schema28,
6445
6806
  metadata28,
6446
- updateFieldConfig
6807
+ listConfigurableFields
6447
6808
  );
6448
6809
  registerTool(
6449
6810
  server,
6450
6811
  schema29,
6451
6812
  metadata29,
6452
- handler3
6813
+ updateFieldConfig
6453
6814
  );
6454
6815
  registerTool(
6455
6816
  server,
6456
6817
  schema30,
6457
6818
  metadata30,
6458
- handler4
6819
+ handler3
6459
6820
  );
6460
6821
  registerTool(
6461
6822
  server,
6462
6823
  schema31,
6463
6824
  metadata31,
6464
- handler5
6825
+ handler4
6465
6826
  );
6466
6827
  registerTool(
6467
6828
  server,
6468
6829
  schema32,
6469
6830
  metadata32,
6470
- handler6
6831
+ handler5
6471
6832
  );
6472
- registerPrompt(
6833
+ registerTool(
6473
6834
  server,
6474
6835
  schema33,
6475
6836
  metadata33,
6476
- sdkUsageGuide
6837
+ handler6
6477
6838
  );
6478
6839
  registerPrompt(
6479
6840
  server,
6480
6841
  schema34,
6481
6842
  metadata34,
6482
- collectionQueryHelp
6843
+ sdkUsageGuide
6483
6844
  );
6484
6845
  registerPrompt(
6485
6846
  server,
6486
6847
  schema35,
6487
6848
  metadata35,
6488
- orderFlowGuide
6849
+ collectionQueryHelp
6489
6850
  );
6490
6851
  registerPrompt(
6491
6852
  server,
6492
6853
  schema36,
6493
6854
  metadata36,
6855
+ orderFlowGuide
6856
+ );
6857
+ registerPrompt(
6858
+ server,
6859
+ schema37,
6860
+ metadata37,
6494
6861
  featureSetupGuide
6495
6862
  );
6496
6863
  registerStaticResource(
6497
6864
  server,
6498
- "config://app",
6499
- metadata37,
6865
+ mcpResourceUri("app-config"),
6866
+ metadata38,
6500
6867
  handler7
6501
6868
  );
6502
6869
  registerStaticResource(
6503
6870
  server,
6504
- "collections://schema",
6505
- metadata38,
6871
+ mcpResourceUri("collections-schema"),
6872
+ metadata39,
6506
6873
  handler8
6507
6874
  );
6508
6875
  registerStaticResource(
6509
6876
  server,
6510
- "docs://sdk/getting-started",
6511
- metadata39,
6877
+ mcpResourceUri("docs-getting-started"),
6878
+ metadata40,
6512
6879
  handler9
6513
6880
  );
6514
- registerStaticResource(server, "docs://sdk/guides", metadata40, handler10);
6515
- registerStaticResource(server, "docs://sdk/api", metadata41, handler11);
6516
6881
  registerStaticResource(
6517
6882
  server,
6518
- "docs://sdk/query-builder",
6883
+ mcpResourceUri("docs-guides"),
6884
+ metadata41,
6885
+ handler10
6886
+ );
6887
+ registerStaticResource(
6888
+ server,
6889
+ mcpResourceUri("docs-api"),
6519
6890
  metadata42,
6520
- handler12
6891
+ handler11
6521
6892
  );
6522
6893
  registerStaticResource(
6523
6894
  server,
6524
- "docs://sdk/react-query",
6895
+ mcpResourceUri("docs-query-builder"),
6525
6896
  metadata43,
6526
- handler13
6897
+ handler12
6527
6898
  );
6528
6899
  registerStaticResource(
6529
6900
  server,
6530
- "docs://sdk/server-api",
6901
+ mcpResourceUri("docs-react-query"),
6531
6902
  metadata44,
6532
- handler14
6903
+ handler13
6533
6904
  );
6534
6905
  registerStaticResource(
6535
6906
  server,
6536
- "docs://sdk/customer-auth",
6907
+ mcpResourceUri("docs-server-api"),
6537
6908
  metadata45,
6538
- handler15
6909
+ handler14
6539
6910
  );
6540
6911
  registerStaticResource(
6541
6912
  server,
6542
- "docs://sdk/browser-vs-server",
6913
+ mcpResourceUri("docs-customer-auth"),
6543
6914
  metadata46,
6544
- handler16
6915
+ handler15
6545
6916
  );
6546
6917
  registerStaticResource(
6547
6918
  server,
6548
- "docs://sdk/file-upload",
6919
+ mcpResourceUri("docs-browser-vs-server"),
6549
6920
  metadata47,
6550
- handler17
6921
+ handler16
6551
6922
  );
6552
6923
  registerStaticResource(
6553
6924
  server,
6554
- "docs://sdk/webhook",
6925
+ mcpResourceUri("docs-file-upload"),
6555
6926
  metadata48,
6556
- handler18
6927
+ handler17
6557
6928
  );
6558
6929
  registerStaticResource(
6559
6930
  server,
6560
- "docs://sdk/product-detail",
6931
+ mcpResourceUri("docs-webhook"),
6561
6932
  metadata49,
6933
+ handler18
6934
+ );
6935
+ registerStaticResource(
6936
+ server,
6937
+ mcpResourceUri("docs-product-detail"),
6938
+ metadata50,
6562
6939
  handler19
6563
6940
  );
6564
6941
  return server;
@@ -6861,7 +7238,7 @@ schema, context, field-config, and guidance tools:
6861
7238
  npx @01.software/cli mcp
6862
7239
 
6863
7240
  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
7241
+ Resources (${MCP_RESOURCE_LABELS.length}): ${MCP_RESOURCE_LABELS.join(", ")}
6865
7242
 
6866
7243
 
6867
7244
  Links