@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.
@@ -1,6 +1,75 @@
1
1
  // src/server.ts
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
 
4
+ // src/resource-inventory.ts
5
+ var MCP_RESOURCE_INVENTORY = [
6
+ { uri: "config://app", label: "config", registeredName: "app-config" },
7
+ {
8
+ uri: "collections://schema",
9
+ label: "collections-schema",
10
+ registeredName: "collections-schema"
11
+ },
12
+ {
13
+ uri: "docs://sdk/getting-started",
14
+ label: "getting-started",
15
+ registeredName: "docs-getting-started"
16
+ },
17
+ { uri: "docs://sdk/guides", label: "guides", registeredName: "docs-guides" },
18
+ { uri: "docs://sdk/api", label: "api", registeredName: "docs-api" },
19
+ {
20
+ uri: "docs://sdk/query-builder",
21
+ label: "query-builder",
22
+ registeredName: "docs-query-builder"
23
+ },
24
+ {
25
+ uri: "docs://sdk/react-query",
26
+ label: "react-query",
27
+ registeredName: "docs-react-query"
28
+ },
29
+ {
30
+ uri: "docs://sdk/server-api",
31
+ label: "server-api",
32
+ registeredName: "docs-server-api"
33
+ },
34
+ {
35
+ uri: "docs://sdk/customer-auth",
36
+ label: "customer-auth",
37
+ registeredName: "docs-customer-auth"
38
+ },
39
+ {
40
+ uri: "docs://sdk/browser-vs-server",
41
+ label: "browser-vs-server",
42
+ registeredName: "docs-browser-vs-server"
43
+ },
44
+ {
45
+ uri: "docs://sdk/file-upload",
46
+ label: "file-upload",
47
+ registeredName: "docs-file-upload"
48
+ },
49
+ {
50
+ uri: "docs://sdk/webhook",
51
+ label: "webhook",
52
+ registeredName: "docs-webhook"
53
+ },
54
+ {
55
+ uri: "docs://sdk/product-detail",
56
+ label: "product-detail",
57
+ registeredName: "docs-product-detail"
58
+ }
59
+ ];
60
+ var MCP_RESOURCE_LABELS = MCP_RESOURCE_INVENTORY.map(
61
+ (resource) => resource.label
62
+ );
63
+ function mcpResourceUri(registeredName) {
64
+ const resource = MCP_RESOURCE_INVENTORY.find(
65
+ (entry) => entry.registeredName === registeredName
66
+ );
67
+ if (!resource) {
68
+ throw new Error(`Unknown MCP resource inventory entry: ${registeredName}`);
69
+ }
70
+ return resource.uri;
71
+ }
72
+
4
73
  // src/lib/request-context.ts
5
74
  import { AsyncLocalStorage } from "async_hooks";
6
75
  var requestContext = new AsyncLocalStorage();
@@ -247,6 +316,38 @@ var transactionStatusSchema = z2.enum([
247
316
  "failed",
248
317
  "canceled"
249
318
  ]);
319
+ var entityIdSchema = z2.union([z2.string(), z2.number()]).transform(String);
320
+ var createOrderItemSchema = z2.object({
321
+ product: entityIdSchema,
322
+ variant: entityIdSchema,
323
+ option: entityIdSchema,
324
+ quantity: z2.number().int().positive("quantity must be a positive integer"),
325
+ unitPrice: z2.number().optional(),
326
+ totalPrice: z2.number().optional()
327
+ });
328
+ var createOrderSchema = z2.object({
329
+ pgPaymentId: z2.string().min(1).optional(),
330
+ orderNumber: z2.string().min(1, "orderNumber is required"),
331
+ customer: entityIdSchema.optional(),
332
+ customerSnapshot: z2.object({
333
+ name: z2.string().optional(),
334
+ email: z2.string().email("Invalid email format"),
335
+ phone: z2.string().optional()
336
+ }),
337
+ shippingAddress: z2.object({
338
+ postalCode: z2.string().optional(),
339
+ address: z2.string().optional(),
340
+ detailAddress: z2.string().optional(),
341
+ deliveryMessage: z2.string().optional(),
342
+ recipientName: z2.string().optional(),
343
+ phone: z2.string().optional()
344
+ }),
345
+ orderItems: z2.array(createOrderItemSchema).min(1, "At least one order item is required").max(100, "Maximum 100 items per order"),
346
+ totalAmount: z2.number().nonnegative("totalAmount must be non-negative"),
347
+ shippingAmount: z2.number().min(0).optional(),
348
+ discountCode: z2.string().optional()
349
+ });
350
+ var CreateOrderSchema = createOrderSchema;
250
351
  var updateTransactionSchema = z2.object({
251
352
  pgPaymentId: z2.string().min(1, "pgPaymentId is required").describe("PG payment ID (required)"),
252
353
  status: transactionStatusSchema.describe(
@@ -281,6 +382,7 @@ var confirmPaymentSchema = z2.object({
281
382
  ]).optional(),
282
383
  metadata: z2.record(z2.string(), z2.unknown()).optional()
283
384
  }).strict();
385
+ var ConfirmPaymentSchema = confirmPaymentSchema;
284
386
  var returnReasonSchema = z2.enum([
285
387
  "change_of_mind",
286
388
  "defective",
@@ -410,6 +512,11 @@ var MCP_TOOL_CONTRACT = {
410
512
  oauthScope: "mcp:write",
411
513
  readOnly: false
412
514
  },
515
+ "confirm-payment": {
516
+ consoleRole: "tenant-admin",
517
+ oauthScope: "mcp:write",
518
+ readOnly: false
519
+ },
413
520
  "update-order": {
414
521
  consoleRole: "tenant-admin",
415
522
  oauthScope: "mcp:write",
@@ -650,21 +757,29 @@ var TOOL_POLICY_MANIFEST = {
650
757
  category: "mutation-order",
651
758
  oauthScope: MCP_SCOPES.write,
652
759
  consoleRole: "tenant-admin",
653
- consoleSurface: "POST /api/checkout",
760
+ consoleSurface: "POST /api/orders/checkout",
654
761
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
655
762
  },
656
763
  "create-order": {
657
764
  category: "mutation-order",
658
765
  oauthScope: MCP_SCOPES.write,
659
766
  consoleRole: "tenant-admin",
660
- consoleSurface: "POST /api/orders",
767
+ consoleSurface: "POST /api/orders/create",
661
768
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
662
769
  },
770
+ "confirm-payment": {
771
+ category: "mutation-transaction",
772
+ oauthScope: MCP_SCOPES.write,
773
+ consoleRole: "tenant-admin",
774
+ consoleSurface: "POST /api/orders/confirm-payment",
775
+ annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
776
+ exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
777
+ },
663
778
  "update-order": {
664
779
  category: "mutation-order",
665
780
  oauthScope: MCP_SCOPES.write,
666
781
  consoleRole: "tenant-admin",
667
- consoleSurface: "PATCH /api/orders/{id}",
782
+ consoleSurface: "POST /api/orders/update",
668
783
  annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
669
784
  exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
670
785
  },
@@ -673,14 +788,14 @@ var TOOL_POLICY_MANIFEST = {
673
788
  category: "mutation-fulfillment",
674
789
  oauthScope: MCP_SCOPES.write,
675
790
  consoleRole: "tenant-admin",
676
- consoleSurface: "POST /api/orders/{id}/fulfillments",
791
+ consoleSurface: "POST /api/orders/create-fulfillment",
677
792
  annotationPolicy: NON_DESTRUCTIVE_MUTATION_ANNOTATION
678
793
  },
679
794
  "update-fulfillment": {
680
795
  category: "mutation-fulfillment",
681
796
  oauthScope: MCP_SCOPES.write,
682
797
  consoleRole: "tenant-admin",
683
- consoleSurface: "PATCH /api/fulfillments/{id}",
798
+ consoleSurface: "POST /api/orders/update-fulfillment",
684
799
  annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
685
800
  exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
686
801
  },
@@ -689,14 +804,14 @@ var TOOL_POLICY_MANIFEST = {
689
804
  category: "mutation-return",
690
805
  oauthScope: MCP_SCOPES.write,
691
806
  consoleRole: "tenant-admin",
692
- consoleSurface: "POST /api/returns",
807
+ consoleSurface: "POST /api/returns/create",
693
808
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
694
809
  },
695
810
  "update-return": {
696
811
  category: "mutation-return",
697
812
  oauthScope: MCP_SCOPES.write,
698
813
  consoleRole: "tenant-admin",
699
- consoleSurface: "PATCH /api/returns/{id}",
814
+ consoleSurface: "POST /api/returns/update",
700
815
  annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
701
816
  exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
702
817
  },
@@ -704,7 +819,7 @@ var TOOL_POLICY_MANIFEST = {
704
819
  category: "mutation-return",
705
820
  oauthScope: MCP_SCOPES.write,
706
821
  consoleRole: "tenant-admin",
707
- consoleSurface: "POST /api/returns/with-refund",
822
+ consoleSurface: "POST /api/returns/return-refund",
708
823
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
709
824
  },
710
825
  // ── Transaction mutations (mcp:write, tenant-admin) ──
@@ -712,7 +827,7 @@ var TOOL_POLICY_MANIFEST = {
712
827
  category: "mutation-transaction",
713
828
  oauthScope: MCP_SCOPES.write,
714
829
  consoleRole: "tenant-admin",
715
- consoleSurface: "PATCH /api/transactions/{id}",
830
+ consoleSurface: "POST /api/transactions/update",
716
831
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
717
832
  },
718
833
  // ── Field-config mutations (mcp:write, tenant-admin) ──
@@ -753,7 +868,15 @@ var TOOL_POLICY_MANIFEST = {
753
868
  annotationPolicy: READ_ONLY_ANNOTATION
754
869
  }
755
870
  };
756
- function evaluateToolPolicy(toolName, scopes) {
871
+ var CONSOLE_ROLE_RANK = {
872
+ "tenant-viewer": 0,
873
+ "tenant-editor": 1,
874
+ "tenant-admin": 2
875
+ };
876
+ function hasRequiredConsoleRole(tenantRole, requiredRole) {
877
+ return CONSOLE_ROLE_RANK[tenantRole] >= CONSOLE_ROLE_RANK[requiredRole];
878
+ }
879
+ function evaluateToolPolicy(toolName, scopes, tenantRole) {
757
880
  if (!isMcpToolName(toolName)) {
758
881
  return {
759
882
  allowed: false,
@@ -769,6 +892,13 @@ function evaluateToolPolicy(toolName, scopes) {
769
892
  message: `Tool ${toolName} requires ${entry.oauthScope}`
770
893
  };
771
894
  }
895
+ if (!hasRequiredConsoleRole(tenantRole, entry.consoleRole)) {
896
+ return {
897
+ allowed: false,
898
+ reason: "insufficient_role",
899
+ message: `Tool ${toolName} requires ${entry.consoleRole}`
900
+ };
901
+ }
772
902
  return { allowed: true, entry };
773
903
  }
774
904
 
@@ -1261,25 +1391,7 @@ async function getOrder({
1261
1391
  }
1262
1392
 
1263
1393
  // src/tools/create-order.ts
1264
- import { z as z6 } from "zod";
1265
- var schema4 = {
1266
- pgPaymentId: z6.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1267
- orderNumber: z6.string().min(1).describe("Unique order number (required)"),
1268
- customerSnapshot: z6.object({
1269
- name: z6.string().optional().describe("Customer name"),
1270
- email: z6.string().describe("Customer email (required)"),
1271
- phone: z6.string().optional().describe("Customer phone")
1272
- }).describe("Customer snapshot at time of order (required)"),
1273
- shippingAddress: z6.record(z6.string(), z6.unknown()).describe(
1274
- "Shipping address object (required). Fields: postalCode, address1, address2, deliveryMessage, recipientName, phone"
1275
- ),
1276
- orderItems: z6.array(z6.record(z6.string(), z6.unknown())).describe(
1277
- "Array of order item objects (required). Each: { product, variant, option, quantity, unitPrice?, totalPrice? }"
1278
- ),
1279
- totalAmount: z6.number().nonnegative().describe("Total order amount (required, min 0)"),
1280
- shippingAmount: z6.number().nonnegative().optional().describe("Shipping amount (optional, default 0)"),
1281
- discountCode: z6.string().optional().describe("Discount code to apply (optional)")
1282
- };
1394
+ var schema4 = CreateOrderSchema.shape;
1283
1395
  var metadata4 = {
1284
1396
  name: "create-order",
1285
1397
  description: "Create a new order with products and shipping information. Supports idempotency.",
@@ -1293,9 +1405,8 @@ var metadata4 = {
1293
1405
  async function createOrder(params) {
1294
1406
  try {
1295
1407
  const client = getClient();
1296
- const result = await client.commerce.orders.create(
1297
- params
1298
- );
1408
+ const parsed = CreateOrderSchema.parse(params);
1409
+ const result = await client.commerce.orders.create(parsed);
1299
1410
  return toolSuccess({ data: result });
1300
1411
  } catch (error) {
1301
1412
  return toolError(error);
@@ -1303,10 +1414,10 @@ async function createOrder(params) {
1303
1414
  }
1304
1415
 
1305
1416
  // src/tools/update-order.ts
1306
- import { z as z7 } from "zod";
1417
+ import { z as z6 } from "zod";
1307
1418
  var schema5 = {
1308
- orderNumber: z7.string().min(1).describe("Order number (required)"),
1309
- status: z7.enum([
1419
+ orderNumber: z6.string().min(1).describe("Order number (required)"),
1420
+ status: z6.enum([
1310
1421
  "pending",
1311
1422
  "paid",
1312
1423
  "failed",
@@ -1316,12 +1427,12 @@ var schema5 = {
1316
1427
  "delivered",
1317
1428
  "confirmed"
1318
1429
  ]).describe(
1319
- "New order status. Return-related statuses (return_requested, return_processing, returned) must be set via Return endpoints."
1430
+ "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."
1320
1431
  )
1321
1432
  };
1322
1433
  var metadata5 = {
1323
1434
  name: "update-order",
1324
- description: "Update order status. Automatically adjusts stock on status changes (e.g., canceled restores stock).",
1435
+ 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.",
1325
1436
  annotations: {
1326
1437
  title: "Update order status",
1327
1438
  readOnlyHint: false,
@@ -1343,15 +1454,15 @@ async function updateOrder({
1343
1454
  }
1344
1455
 
1345
1456
  // src/tools/checkout.ts
1346
- import { z as z8 } from "zod";
1457
+ import { z as z7 } from "zod";
1347
1458
  var schema6 = {
1348
- cartId: z8.string().min(1).describe("Cart ID to convert to order (required)"),
1349
- pgPaymentId: z8.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1350
- orderNumber: z8.string().min(1).describe("Unique order number (required)"),
1351
- customerSnapshot: z8.record(z8.string(), z8.unknown()).describe(
1459
+ cartId: z7.string().min(1).describe("Cart ID to convert to order (required)"),
1460
+ pgPaymentId: z7.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1461
+ orderNumber: z7.string().min(1).describe("Unique order number (required)"),
1462
+ customerSnapshot: z7.record(z7.string(), z7.unknown()).describe(
1352
1463
  "Customer snapshot object (required). Fields: { name?, email, phone? }"
1353
1464
  ),
1354
- discountCode: z8.string().optional().describe("Discount code to apply (optional)")
1465
+ discountCode: z7.string().optional().describe("Discount code to apply (optional)")
1355
1466
  };
1356
1467
  var metadata6 = {
1357
1468
  name: "checkout",
@@ -1376,17 +1487,17 @@ async function checkout(params) {
1376
1487
  }
1377
1488
 
1378
1489
  // src/tools/create-fulfillment.ts
1379
- import { z as z9 } from "zod";
1490
+ import { z as z8 } from "zod";
1380
1491
  var schema7 = {
1381
- orderNumber: z9.string().min(1).describe("Order number (required)"),
1382
- carrier: z9.string().optional().describe("Shipping carrier name (optional)"),
1383
- trackingNumber: z9.string().optional().describe(
1492
+ orderNumber: z8.string().min(1).describe("Order number (required)"),
1493
+ carrier: z8.string().optional().describe("Shipping carrier name (optional)"),
1494
+ trackingNumber: z8.string().optional().describe(
1384
1495
  'Tracking number (optional). Setting carrier + tracking triggers "shipped" status'
1385
1496
  ),
1386
- items: z9.array(
1387
- z9.object({
1388
- orderItem: z9.string().min(1).describe("Order item ID"),
1389
- quantity: z9.number().int().positive().describe("Quantity to fulfill")
1497
+ items: z8.array(
1498
+ z8.object({
1499
+ orderItem: z8.string().min(1).describe("Order item ID"),
1500
+ quantity: z8.number().int().positive().describe("Quantity to fulfill")
1390
1501
  })
1391
1502
  ).describe("Array of items to fulfill (required)")
1392
1503
  };
@@ -1421,16 +1532,16 @@ async function createFulfillment({
1421
1532
  }
1422
1533
 
1423
1534
  // src/tools/update-fulfillment.ts
1424
- import { z as z10 } from "zod";
1535
+ import { z as z9 } from "zod";
1425
1536
  var schema8 = {
1426
- fulfillmentId: z10.string().min(1).describe("Fulfillment ID (required)"),
1427
- status: z10.enum(["packed", "shipped", "delivered", "failed"]).describe(
1537
+ fulfillmentId: z9.string().min(1).describe("Fulfillment ID (required)"),
1538
+ status: z9.enum(["packed", "shipped", "delivered", "failed"]).describe(
1428
1539
  "New fulfillment status (required). FSM: pending\u2192packed/shipped/failed, packed\u2192shipped/failed, shipped\u2192delivered/failed"
1429
1540
  ),
1430
- carrier: z10.string().optional().describe(
1541
+ carrier: z9.string().optional().describe(
1431
1542
  "Shipping carrier (optional, changeable only in pending/packed status)"
1432
1543
  ),
1433
- trackingNumber: z10.string().optional().describe(
1544
+ trackingNumber: z9.string().optional().describe(
1434
1545
  "Tracking number (optional, changeable only in pending/packed status)"
1435
1546
  )
1436
1547
  };
@@ -1501,21 +1612,44 @@ async function updateTransaction({
1501
1612
  }
1502
1613
  }
1503
1614
 
1615
+ // src/tools/confirm-payment.ts
1616
+ var schema10 = ConfirmPaymentSchema.shape;
1617
+ var metadata10 = {
1618
+ name: "confirm-payment",
1619
+ description: "Confirm a provider-verified ecommerce payment through the generic payment confirmation flow.",
1620
+ annotations: {
1621
+ title: "Confirm payment",
1622
+ readOnlyHint: false,
1623
+ destructiveHint: true,
1624
+ idempotentHint: true
1625
+ }
1626
+ };
1627
+ async function confirmPayment(params) {
1628
+ try {
1629
+ const client = getClient();
1630
+ const parsed = ConfirmPaymentSchema.parse(params);
1631
+ const result = await client.commerce.orders.confirmPayment(parsed);
1632
+ return toolSuccess({ data: result });
1633
+ } catch (error) {
1634
+ return toolError(error);
1635
+ }
1636
+ }
1637
+
1504
1638
  // src/tools/create-return.ts
1505
- import { z as z11 } from "zod";
1506
- var schema10 = {
1507
- orderNumber: z11.string().min(1).describe("Order number (required)"),
1508
- reason: z11.enum(["change_of_mind", "defective", "wrong_delivery", "damaged", "other"]).optional().describe("Return reason (optional)"),
1509
- reasonDetail: z11.string().optional().describe("Detailed reason text (optional)"),
1510
- returnItems: z11.array(
1511
- z11.object({
1512
- orderItem: z11.string().min(1).describe("Order item ID"),
1513
- quantity: z11.number().int().positive().describe("Quantity to return")
1639
+ import { z as z10 } from "zod";
1640
+ var schema11 = {
1641
+ orderNumber: z10.string().min(1).describe("Order number (required)"),
1642
+ reason: z10.enum(["change_of_mind", "defective", "wrong_delivery", "damaged", "other"]).optional().describe("Return reason (optional)"),
1643
+ reasonDetail: z10.string().optional().describe("Detailed reason text (optional)"),
1644
+ returnItems: z10.array(
1645
+ z10.object({
1646
+ orderItem: z10.string().min(1).describe("Order item ID"),
1647
+ quantity: z10.number().int().positive().describe("Quantity to return")
1514
1648
  })
1515
1649
  ).describe("Array of products to return (required)"),
1516
- refundAmount: z11.number().nonnegative().describe("Refund amount (required, min 0)")
1650
+ refundAmount: z10.number().nonnegative().describe("Refund amount (required, min 0)")
1517
1651
  };
1518
- var metadata10 = {
1652
+ var metadata11 = {
1519
1653
  name: "create-return",
1520
1654
  description: "Create a return request for an order. Only works for delivered/confirmed orders. Updates order status to return_requested.",
1521
1655
  annotations: {
@@ -1548,16 +1682,16 @@ async function createReturn({
1548
1682
  }
1549
1683
 
1550
1684
  // src/tools/update-return.ts
1551
- import { z as z12 } from "zod";
1552
- var schema11 = {
1553
- returnId: z12.string().min(1).describe("Return ID (required)"),
1554
- status: z12.enum(["processing", "approved", "rejected", "completed"]).describe(
1555
- "New return status (required). Valid transitions: requested\u2192processing/rejected, processing\u2192approved/rejected, approved\u2192completed"
1685
+ import { z as z11 } from "zod";
1686
+ var schema12 = {
1687
+ returnId: z11.string().min(1).describe("Return ID (required)"),
1688
+ status: z11.enum(["processing", "approved", "rejected", "completed"]).describe(
1689
+ "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."
1556
1690
  )
1557
1691
  };
1558
- var metadata11 = {
1692
+ var metadata12 = {
1559
1693
  name: "update-return",
1560
- description: "Update return status with FSM validation. Restores inventory on completion, reverts order status on rejection.",
1694
+ 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.",
1561
1695
  annotations: {
1562
1696
  title: "Update return status",
1563
1697
  readOnlyHint: false,
@@ -1571,7 +1705,10 @@ async function updateReturn({
1571
1705
  }) {
1572
1706
  try {
1573
1707
  const client = getClient();
1574
- const result = await client.commerce.orders.updateReturn({ returnId, status });
1708
+ const result = await client.commerce.orders.updateReturn({
1709
+ returnId,
1710
+ status
1711
+ });
1575
1712
  return toolSuccess({ data: result });
1576
1713
  } catch (error) {
1577
1714
  return toolError(error);
@@ -1579,10 +1716,10 @@ async function updateReturn({
1579
1716
  }
1580
1717
 
1581
1718
  // src/tools/return-with-refund.ts
1582
- var schema12 = ReturnWithRefundSchema.shape;
1583
- var metadata12 = {
1719
+ var schema13 = ReturnWithRefundSchema.shape;
1720
+ var metadata13 = {
1584
1721
  name: "return-with-refund",
1585
- description: "Combined return + refund operation. Creates return, restores stock, cancels transaction, updates order status.",
1722
+ 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.",
1586
1723
  annotations: {
1587
1724
  title: "Return with refund",
1588
1725
  readOnlyHint: false,
@@ -1596,6 +1733,7 @@ async function returnWithRefund({
1596
1733
  reasonDetail,
1597
1734
  returnItems,
1598
1735
  refundAmount,
1736
+ returnShippingFee,
1599
1737
  pgPaymentId,
1600
1738
  paymentKey,
1601
1739
  refundReceiptUrl
@@ -1608,6 +1746,7 @@ async function returnWithRefund({
1608
1746
  reasonDetail,
1609
1747
  returnItems,
1610
1748
  refundAmount,
1749
+ returnShippingFee,
1611
1750
  pgPaymentId,
1612
1751
  paymentKey,
1613
1752
  refundReceiptUrl
@@ -1620,15 +1759,15 @@ async function returnWithRefund({
1620
1759
  }
1621
1760
 
1622
1761
  // src/tools/add-cart-item.ts
1623
- import { z as z13 } from "zod";
1624
- var schema13 = {
1625
- cartId: z13.string().min(1).describe("Cart ID (required)"),
1626
- product: z13.string().min(1).describe("Product ID (required)"),
1627
- variant: z13.string().min(1).describe("Product variant ID (required)"),
1628
- option: z13.string().min(1).describe("Product option ID (required)"),
1629
- quantity: z13.number().int().positive().describe("Quantity to add (required, positive integer)")
1762
+ import { z as z12 } from "zod";
1763
+ var schema14 = {
1764
+ cartId: z12.string().min(1).describe("Cart ID (required)"),
1765
+ product: z12.string().min(1).describe("Product ID (required)"),
1766
+ variant: z12.string().min(1).describe("Product variant ID (required)"),
1767
+ option: z12.string().min(1).describe("Product option ID (required)"),
1768
+ quantity: z12.number().int().positive().describe("Quantity to add (required, positive integer)")
1630
1769
  };
1631
- var metadata13 = {
1770
+ var metadata14 = {
1632
1771
  name: "add-cart-item",
1633
1772
  description: "Add a product to cart. Validates stock, merges quantity if item already exists, recalculates totals.",
1634
1773
  annotations: {
@@ -1661,12 +1800,12 @@ async function addCartItem({
1661
1800
  }
1662
1801
 
1663
1802
  // src/tools/update-cart-item.ts
1664
- import { z as z14 } from "zod";
1665
- var schema14 = {
1666
- cartItemId: z14.string().min(1).describe("Cart item ID (required)"),
1667
- quantity: z14.number().int().positive().describe("New quantity (required, positive integer)")
1803
+ import { z as z13 } from "zod";
1804
+ var schema15 = {
1805
+ cartItemId: z13.string().min(1).describe("Cart item ID (required)"),
1806
+ quantity: z13.number().int().positive().describe("New quantity (required, positive integer)")
1668
1807
  };
1669
- var metadata14 = {
1808
+ var metadata15 = {
1670
1809
  name: "update-cart-item",
1671
1810
  description: "Update cart item quantity. Validates stock availability, recalculates cart totals.",
1672
1811
  annotations: {
@@ -1690,11 +1829,11 @@ async function updateCartItem({
1690
1829
  }
1691
1830
 
1692
1831
  // src/tools/remove-cart-item.ts
1693
- import { z as z15 } from "zod";
1694
- var schema15 = {
1695
- cartItemId: z15.string().min(1).describe("Cart item ID to remove (required)")
1832
+ import { z as z14 } from "zod";
1833
+ var schema16 = {
1834
+ cartItemId: z14.string().min(1).describe("Cart item ID to remove (required)")
1696
1835
  };
1697
- var metadata15 = {
1836
+ var metadata16 = {
1698
1837
  name: "remove-cart-item",
1699
1838
  description: "Remove an item from cart. Recalculates cart totals after removal.",
1700
1839
  annotations: {
@@ -1717,12 +1856,12 @@ async function removeCartItem({
1717
1856
  }
1718
1857
 
1719
1858
  // src/tools/apply-discount.ts
1720
- import { z as z16 } from "zod";
1721
- var schema16 = {
1722
- cartId: z16.string().min(1).describe("Cart ID (required)"),
1723
- discountCode: z16.string().describe("Discount code to apply (required)")
1859
+ import { z as z15 } from "zod";
1860
+ var schema17 = {
1861
+ cartId: z15.string().min(1).describe("Cart ID (required)"),
1862
+ discountCode: z15.string().describe("Discount code to apply (required)")
1724
1863
  };
1725
- var metadata16 = {
1864
+ var metadata17 = {
1726
1865
  name: "apply-discount",
1727
1866
  description: "Apply a discount code to a cart. Validates the code, updates cart totals, and sets free shipping if applicable.",
1728
1867
  annotations: {
@@ -1746,11 +1885,11 @@ async function applyDiscount({
1746
1885
  }
1747
1886
 
1748
1887
  // src/tools/remove-discount.ts
1749
- import { z as z17 } from "zod";
1750
- var schema17 = {
1751
- cartId: z17.string().min(1).describe("Cart ID (required)")
1888
+ import { z as z16 } from "zod";
1889
+ var schema18 = {
1890
+ cartId: z16.string().min(1).describe("Cart ID (required)")
1752
1891
  };
1753
- var metadata17 = {
1892
+ var metadata18 = {
1754
1893
  name: "remove-discount",
1755
1894
  description: "Remove the applied discount code from a cart and recalculate totals.",
1756
1895
  annotations: {
@@ -1773,11 +1912,11 @@ async function removeDiscount({
1773
1912
  }
1774
1913
 
1775
1914
  // src/tools/clear-cart.ts
1776
- import { z as z18 } from "zod";
1777
- var schema18 = {
1778
- cartId: z18.string().min(1).describe("Cart ID (required)")
1915
+ import { z as z17 } from "zod";
1916
+ var schema19 = {
1917
+ cartId: z17.string().min(1).describe("Cart ID (required)")
1779
1918
  };
1780
- var metadata18 = {
1919
+ var metadata19 = {
1781
1920
  name: "clear-cart",
1782
1921
  description: "Remove all items from a cart, reset discount and amounts. Shipping fee is preserved.",
1783
1922
  annotations: {
@@ -1800,12 +1939,12 @@ async function clearCart({
1800
1939
  }
1801
1940
 
1802
1941
  // src/tools/validate-discount.ts
1803
- import { z as z19 } from "zod";
1804
- var schema19 = {
1805
- code: z19.string().describe("Discount code to validate (required)"),
1806
- orderAmount: z19.number().describe("Order amount for validation (required)")
1942
+ import { z as z18 } from "zod";
1943
+ var schema20 = {
1944
+ code: z18.string().describe("Discount code to validate (required)"),
1945
+ orderAmount: z18.number().describe("Order amount for validation (required)")
1807
1946
  };
1808
- var metadata19 = {
1947
+ var metadata20 = {
1809
1948
  name: "validate-discount",
1810
1949
  description: "Validate a discount code. Checks active status, date range, usage limits, minimum order amount, and calculates discount.",
1811
1950
  annotations: {
@@ -1832,13 +1971,13 @@ async function validateDiscount({
1832
1971
  }
1833
1972
 
1834
1973
  // src/tools/calculate-shipping.ts
1835
- import { z as z20 } from "zod";
1836
- var schema20 = {
1837
- shippingPolicyId: z20.string().optional().describe("Shipping policy ID (uses default policy if omitted)"),
1838
- orderAmount: z20.number().describe("Order amount for fee calculation (required)"),
1839
- postalCode: z20.string().optional().describe("Postal code for Jeju surcharge detection (63000-63644)")
1974
+ import { z as z19 } from "zod";
1975
+ var schema21 = {
1976
+ shippingPolicyId: z19.string().optional().describe("Shipping policy ID (uses default policy if omitted)"),
1977
+ orderAmount: z19.number().describe("Order amount for fee calculation (required)"),
1978
+ postalCode: z19.string().optional().describe("Postal code for Jeju surcharge detection (63000-63644)")
1840
1979
  };
1841
- var metadata20 = {
1980
+ var metadata21 = {
1842
1981
  name: "calculate-shipping",
1843
1982
  description: "Calculate shipping fee based on order amount and postal code. Supports free shipping threshold and Jeju surcharge.",
1844
1983
  annotations: {
@@ -1867,18 +2006,18 @@ async function calculateShipping({
1867
2006
  }
1868
2007
 
1869
2008
  // src/tools/stock-check.ts
1870
- import { z as z21 } from "zod";
1871
- var schema21 = {
1872
- items: z21.array(
1873
- z21.object({
1874
- variantId: z21.string().describe("Product variant ID"),
1875
- quantity: z21.number().int().positive().describe("Requested quantity")
2009
+ import { z as z20 } from "zod";
2010
+ var schema22 = {
2011
+ items: z20.array(
2012
+ z20.object({
2013
+ variantId: z20.string().describe("Product variant ID"),
2014
+ quantity: z20.number().int().positive().describe("Requested quantity")
1876
2015
  })
1877
2016
  ).describe(
1878
2017
  "Array of items to check stock for (required, max 100). Each: { variantId, quantity }"
1879
2018
  )
1880
2019
  };
1881
- var metadata21 = {
2020
+ var metadata22 = {
1882
2021
  name: "stock-check",
1883
2022
  description: "Batch check product option stock availability. Returns per-item availability and an allAvailable flag.",
1884
2023
  annotations: {
@@ -1901,14 +2040,14 @@ async function stockCheck({
1901
2040
  }
1902
2041
 
1903
2042
  // src/tools/product-detail.ts
1904
- import { z as z22 } from "zod";
1905
- var schema22 = {
1906
- slug: z22.string().optional().describe("Product slug (one of slug or id required)"),
1907
- id: z22.string().optional().describe("Product id (one of slug or id required)")
2043
+ import { z as z21 } from "zod";
2044
+ var schema23 = {
2045
+ slug: z21.string().optional().describe("Product slug (one of slug or id required)"),
2046
+ id: z21.string().optional().describe("Product id (one of slug or id required)")
1908
2047
  };
1909
- var metadata22 = {
2048
+ var metadata23 = {
1910
2049
  name: "product-detail",
1911
- 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.",
2050
+ 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.",
1912
2051
  annotations: {
1913
2052
  title: "Get product detail",
1914
2053
  readOnlyHint: true,
@@ -1934,66 +2073,66 @@ async function productDetail({
1934
2073
  }
1935
2074
 
1936
2075
  // src/tools/product-upsert.ts
1937
- import { z as z23 } from "zod";
1938
- var optionValueSchema = z23.object({
1939
- id: z23.string().optional().describe("Stable existing option-value ID for rename-safe updates"),
1940
- value: z23.string().describe("Display label (e.g. Black, S)"),
1941
- slug: z23.string().optional().describe(
2076
+ import { z as z22 } from "zod";
2077
+ var optionValueSchema = z22.object({
2078
+ id: z22.string().optional().describe("Stable existing option-value ID for rename-safe updates"),
2079
+ value: z22.string().describe("Display label (e.g. Black, S)"),
2080
+ slug: z22.string().optional().describe(
1942
2081
  "Optional compatibility value token. The server generates one from value on create when omitted; not canonical identity."
1943
2082
  ),
1944
- swatchColor: z23.string().nullable().optional(),
1945
- thumbnail: z23.string().nullable().optional(),
1946
- images: z23.array(z23.string()).optional(),
1947
- metadata: z23.unknown().optional()
2083
+ swatchColor: z22.string().nullable().optional(),
2084
+ thumbnail: z22.string().nullable().optional(),
2085
+ images: z22.array(z22.string()).optional(),
2086
+ metadata: z22.unknown().optional()
1948
2087
  });
1949
- var optionSchema = z23.object({
1950
- id: z23.string().optional().describe("Stable existing option ID for rename-safe updates"),
1951
- title: z23.string().describe("Option name (e.g. Color, Size)"),
1952
- slug: z23.string().optional().describe(
2088
+ var optionSchema = z22.object({
2089
+ id: z22.string().optional().describe("Stable existing option ID for rename-safe updates"),
2090
+ title: z22.string().describe("Option name (e.g. Color, Size)"),
2091
+ slug: z22.string().optional().describe(
1953
2092
  "Optional compatibility option token. The server generates one from title on create when omitted; not canonical identity."
1954
2093
  ),
1955
- values: z23.array(optionValueSchema).describe("Allowed option values")
2094
+ values: z22.array(optionValueSchema).describe("Allowed option values")
1956
2095
  });
1957
- var variantOptionValueSchema = z23.object({
1958
- valueSlug: z23.string().optional(),
1959
- valueId: z23.string().optional(),
1960
- value: z23.string().optional()
2096
+ var variantOptionValueSchema = z22.object({
2097
+ valueSlug: z22.string().optional(),
2098
+ valueId: z22.string().optional(),
2099
+ value: z22.string().optional()
1961
2100
  });
1962
- var variantSchema = z23.object({
1963
- id: z23.string().optional().describe("Existing variant ID for updates"),
1964
- optionValues: z23.union([
1965
- z23.record(z23.string(), z23.union([z23.string(), variantOptionValueSchema])),
1966
- z23.array(z23.string())
2101
+ var variantSchema = z22.object({
2102
+ id: z22.string().optional().describe("Existing variant ID for updates"),
2103
+ optionValues: z22.union([
2104
+ z22.record(z22.string(), z22.union([z22.string(), variantOptionValueSchema])),
2105
+ z22.array(z22.string())
1967
2106
  ]).optional().describe(
1968
2107
  "Option-value selection. Prefer stable option-value IDs, either as an array or object values using { valueId }. Slug maps and exact { OptionTitle: ValueLabel } maps remain compatibility-only and fail when labels are ambiguous."
1969
2108
  ),
1970
- sku: z23.string().nullable().optional(),
1971
- title: z23.string().nullable().optional(),
1972
- price: z23.number().nonnegative().describe("Selling price (KRW, min 0)"),
1973
- compareAtPrice: z23.number().nonnegative().nullable().optional(),
1974
- stock: z23.number().int().nonnegative().optional(),
1975
- isUnlimited: z23.boolean().optional(),
1976
- weight: z23.number().nonnegative().nullable().optional(),
1977
- requiresShipping: z23.boolean().optional(),
1978
- barcode: z23.string().nullable().optional(),
1979
- externalId: z23.string().nullable().optional(),
1980
- isActive: z23.boolean().optional(),
1981
- thumbnail: z23.string().nullable().optional(),
1982
- images: z23.array(z23.string()).optional(),
1983
- metadata: z23.unknown().optional()
2109
+ sku: z22.string().nullable().optional(),
2110
+ title: z22.string().nullable().optional(),
2111
+ price: z22.number().nonnegative().describe("Selling price (KRW, min 0)"),
2112
+ compareAtPrice: z22.number().nonnegative().nullable().optional(),
2113
+ stock: z22.number().int().nonnegative().optional(),
2114
+ isUnlimited: z22.boolean().optional(),
2115
+ weight: z22.number().nonnegative().nullable().optional(),
2116
+ requiresShipping: z22.boolean().optional(),
2117
+ barcode: z22.string().nullable().optional(),
2118
+ externalId: z22.string().nullable().optional(),
2119
+ isActive: z22.boolean().optional(),
2120
+ thumbnail: z22.string().nullable().optional(),
2121
+ images: z22.array(z22.string()).optional(),
2122
+ metadata: z22.unknown().optional()
1984
2123
  });
1985
- var schema23 = {
1986
- product: z23.record(z23.string(), z23.unknown()).describe(
2124
+ var schema24 = {
2125
+ product: z22.record(z22.string(), z22.unknown()).describe(
1987
2126
  "Product fields. Include `id` to update an existing product; omit for create (then `title` is required)."
1988
2127
  ),
1989
- options: z23.array(optionSchema).optional().describe(
2128
+ options: z22.array(optionSchema).optional().describe(
1990
2129
  "Option definitions. Include stable option/value IDs when updating or renaming existing rows. Slugs are optional compatibility metadata generated from title/value on create when omitted; omitted options on an existing product are deleted (with their values)."
1991
2130
  ),
1992
- variants: z23.array(variantSchema).optional().describe(
2131
+ variants: z22.array(variantSchema).optional().describe(
1993
2132
  "Variant rows. Prefer stable option-value IDs in optionValues. Slug/title maps are compatibility inputs. Omitted variants on an existing product are deleted, unless referenced by an active cart or non-terminal order \u2014 those are soft-deactivated (isActive: false)."
1994
2133
  )
1995
2134
  };
1996
- var metadata23 = {
2135
+ var metadata24 = {
1997
2136
  name: "product-upsert",
1998
2137
  description: "Atomically create or update a product together with its options, option-values, and variants in a single transaction. Mirrors Shopify productSet semantics. Any failure rolls back the entire write.",
1999
2138
  annotations: {
@@ -2030,8 +2169,8 @@ async function getCollectionSchema(collection) {
2030
2169
  }
2031
2170
 
2032
2171
  // src/tools/get-collection-schema.ts
2033
- var schema24 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2034
- var metadata24 = {
2172
+ var schema25 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2173
+ var metadata25 = {
2035
2174
  name: "get-collection-schema",
2036
2175
  description: "Get the authoritative tenant-aware collection schema from console. Use this before create/update to understand writable fields, hidden fields, required metadata, and collection-level visibility.",
2037
2176
  annotations: {
@@ -2082,8 +2221,8 @@ async function getTenantFeatureProgress(feature, includeEvidence = false) {
2082
2221
  }
2083
2222
 
2084
2223
  // src/tools/get-tenant-context.ts
2085
- var schema25 = tenantContextToolInputSchema.shape;
2086
- var metadata25 = {
2224
+ var schema26 = tenantContextToolInputSchema.shape;
2225
+ var metadata26 = {
2087
2226
  name: "get-tenant-context",
2088
2227
  description: "Get current tenant features, active collections, and field visibility. Call this at the start of every session. Use includeCounts=true to also get per-collection document counts for setup diagnostics.",
2089
2228
  annotations: {
@@ -2160,8 +2299,8 @@ async function handler({
2160
2299
  }
2161
2300
 
2162
2301
  // src/tools/check-feature-progress.ts
2163
- var schema26 = tenantFeatureProgressInputSchema.shape;
2164
- var metadata26 = {
2302
+ var schema27 = tenantFeatureProgressInputSchema.shape;
2303
+ var metadata27 = {
2165
2304
  name: "check-feature-progress",
2166
2305
  description: "Check tenant implementation progress for a supported feature. Start with feature=ecommerce to inspect catalog, cart, checkout, payment result, webhook, and operations readiness without mutating tenant data.",
2167
2306
  annotations: {
@@ -2184,7 +2323,7 @@ async function handler2({
2184
2323
  }
2185
2324
 
2186
2325
  // src/tools/list-configurable-fields.ts
2187
- import { z as z24 } from "zod";
2326
+ import { z as z23 } from "zod";
2188
2327
 
2189
2328
  // src/lib/field-config.ts
2190
2329
  async function fetchFieldConfigs() {
@@ -2207,12 +2346,12 @@ function invalidateFieldConfigCache() {
2207
2346
  }
2208
2347
 
2209
2348
  // src/tools/list-configurable-fields.ts
2210
- var schema27 = {
2211
- collection: z24.string().optional().describe(
2349
+ var schema28 = {
2350
+ collection: z23.string().optional().describe(
2212
2351
  "Filter by collection slug (optional \u2014 returns all if omitted). Use this filter to reduce response size when you know which collection to check."
2213
2352
  )
2214
2353
  };
2215
- var metadata27 = {
2354
+ var metadata28 = {
2216
2355
  name: "list-configurable-fields",
2217
2356
  description: "List all configurable fields for tenant collections with current visibility state. Shows which fields can be shown/hidden and their current status. Returns all collections including inactive features \u2014 cross-reference with get-tenant-context for active features. Response includes ~300 fields across 47 collections \u2014 use collection filter when possible.",
2218
2357
  annotations: {
@@ -2243,17 +2382,17 @@ async function listConfigurableFields(params) {
2243
2382
  }
2244
2383
 
2245
2384
  // src/tools/update-field-config.ts
2246
- import { z as z25 } from "zod";
2247
- var schema28 = {
2248
- collection: z25.string().min(1).describe("Collection slug (required)"),
2249
- hiddenFields: z25.array(z25.string().min(1).max(200)).max(300).describe(
2385
+ import { z as z24 } from "zod";
2386
+ var schema29 = {
2387
+ collection: z24.string().min(1).describe("Collection slug (required)"),
2388
+ hiddenFields: z24.array(z24.string().min(1).max(200)).max(300).describe(
2250
2389
  "Fields to hide (required). This is a FULL REPLACE \u2014 fields NOT in this list will be shown. Pass [] to show all fields. Use list-configurable-fields first to see available field paths."
2251
2390
  ),
2252
- isHidden: z25.boolean().optional().describe(
2391
+ isHidden: z24.boolean().optional().describe(
2253
2392
  "Hide the entire collection from Admin Panel (optional). When true, individual hiddenFields are irrelevant."
2254
2393
  )
2255
2394
  };
2256
- var metadata28 = {
2395
+ var metadata29 = {
2257
2396
  name: "update-field-config",
2258
2397
  description: "Update field visibility configuration for a tenant collection. Hidden fields are removed from the Admin Panel UI. IMPORTANT: hiddenFields is a full replace, not a merge. Always call list-configurable-fields first to see current state.",
2259
2398
  annotations: {
@@ -2281,7 +2420,7 @@ async function updateFieldConfig(params) {
2281
2420
  }
2282
2421
 
2283
2422
  // src/tools/sdk-get-recipe.ts
2284
- import { z as z26 } from "zod";
2423
+ import { z as z25 } from "zod";
2285
2424
 
2286
2425
  // src/lib/sdk-recipes.ts
2287
2426
  var recipes = {
@@ -2722,8 +2861,8 @@ function getRecipe(goal, runtime = "both") {
2722
2861
  }
2723
2862
 
2724
2863
  // src/tools/sdk-get-recipe.ts
2725
- var schema29 = {
2726
- goal: z26.enum([
2864
+ var schema30 = {
2865
+ goal: z25.enum([
2727
2866
  "fetch-list",
2728
2867
  "fetch-by-id",
2729
2868
  "create-item",
@@ -2735,11 +2874,11 @@ var schema29 = {
2735
2874
  "file-upload",
2736
2875
  "bulk-operations"
2737
2876
  ]).describe("What the user wants to accomplish"),
2738
- runtime: z26.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2739
- collection: z26.string().optional().describe("Specific collection name if applicable"),
2740
- includeExample: z26.boolean().default(true).describe("Whether to include a full code example")
2877
+ runtime: z25.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2878
+ collection: z25.string().optional().describe("Specific collection name if applicable"),
2879
+ includeExample: z25.boolean().default(true).describe("Whether to include a full code example")
2741
2880
  };
2742
- var metadata29 = {
2881
+ var metadata30 = {
2743
2882
  name: "sdk-get-recipe",
2744
2883
  description: "Get a complete SDK code recipe for a specific task. Returns recommended approach, code example, and related documentation links. Use this FIRST when the user asks how to do something with the SDK.",
2745
2884
  annotations: {
@@ -2782,7 +2921,7 @@ function handler3({
2782
2921
  }
2783
2922
 
2784
2923
  // src/tools/sdk-search-docs.ts
2785
- import { z as z27 } from "zod";
2924
+ import { z as z26 } from "zod";
2786
2925
 
2787
2926
  // src/lib/sdk-doc-index.ts
2788
2927
  var docIndex = [
@@ -2910,8 +3049,19 @@ var docIndex = [
2910
3049
  // Webhooks
2911
3050
  {
2912
3051
  title: "Webhooks",
2913
- keywords: ["webhook", "hmac", "signature", "WEBHOOK_SECRET", "server-to-server", "event"],
2914
- summary: "Tenant webhooks deliver server-to-server events such as password reset tokens. Signed with HMAC-SHA256 using PAYLOAD_SECRET.",
3052
+ keywords: [
3053
+ "webhook",
3054
+ "hmac",
3055
+ "signature",
3056
+ "WEBHOOK_SECRET",
3057
+ "server-to-server",
3058
+ "event",
3059
+ "order",
3060
+ "orderChanged",
3061
+ "collection.orderChanged",
3062
+ "isOrderChangedWebhookEvent"
3063
+ ],
3064
+ summary: "Tenant webhooks deliver signed server-to-server events via WEBHOOK_SECRET, including customer password reset and semantic order changes with collection.orderChanged / isOrderChangedWebhookEvent.",
2915
3065
  resourceUri: "docs://sdk/webhook"
2916
3066
  },
2917
3067
  // Order API
@@ -2957,11 +3107,11 @@ function searchDocs(query, limit = 5) {
2957
3107
  }
2958
3108
 
2959
3109
  // src/tools/sdk-search-docs.ts
2960
- var schema30 = {
2961
- query: z27.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
2962
- limit: z27.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
3110
+ var schema31 = {
3111
+ query: z26.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
3112
+ limit: z26.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
2963
3113
  };
2964
- var metadata30 = {
3114
+ var metadata31 = {
2965
3115
  name: "sdk-search-docs",
2966
3116
  description: "Search SDK documentation by keyword. Returns matching topics with summaries and resource links. Use when looking for specific SDK features or patterns.",
2967
3117
  annotations: {
@@ -2996,9 +3146,9 @@ function handler4({
2996
3146
  }
2997
3147
 
2998
3148
  // src/tools/sdk-get-auth-setup.ts
2999
- import { z as z28 } from "zod";
3000
- var schema31 = {
3001
- scenario: z28.enum([
3149
+ import { z as z27 } from "zod";
3150
+ var schema32 = {
3151
+ scenario: z27.enum([
3002
3152
  "browser-client",
3003
3153
  "server-client",
3004
3154
  "customer-auth",
@@ -3007,7 +3157,7 @@ var schema31 = {
3007
3157
  "webhook-verification"
3008
3158
  ]).describe("Authentication scenario")
3009
3159
  };
3010
- var metadata31 = {
3160
+ var metadata32 = {
3011
3161
  name: "sdk-get-auth-setup",
3012
3162
  description: "Get the current authentication setup for a specific scenario. Returns env var names, code snippets, and security notes.",
3013
3163
  annotations: {
@@ -3131,13 +3281,19 @@ export SOFTWARE_SECRET_KEY=sk01_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
3131
3281
  envVars: ["WEBHOOK_SECRET"],
3132
3282
  code: `import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
3133
3283
 
3284
+ function getWebhookSecret(): string {
3285
+ const secret = process.env.WEBHOOK_SECRET
3286
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
3287
+ return secret
3288
+ }
3289
+
3134
3290
  const customerAuthHandler = createCustomerAuthWebhookHandler({
3135
3291
  passwordReset: sendPasswordResetEmail,
3136
3292
  })
3137
3293
 
3138
3294
  export async function POST(request: Request) {
3139
3295
  return handleWebhook(request, customerAuthHandler, {
3140
- secret: process.env.WEBHOOK_SECRET!,
3296
+ secret: getWebhookSecret(),
3141
3297
  })
3142
3298
  }`,
3143
3299
  notes: [
@@ -3163,14 +3319,14 @@ function handler5({
3163
3319
  }
3164
3320
 
3165
3321
  // src/tools/sdk-get-collection-pattern.ts
3166
- import { z as z29 } from "zod";
3322
+ import { z as z28 } from "zod";
3167
3323
  import { COLLECTIONS, SERVER_COLLECTIONS as SERVER_COLLECTIONS4 } from "@01.software/sdk";
3168
- var schema32 = {
3169
- collection: z29.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3170
- operation: z29.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3171
- surface: z29.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3324
+ var schema33 = {
3325
+ collection: z28.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3326
+ operation: z28.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3327
+ surface: z28.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3172
3328
  };
3173
- var metadata32 = {
3329
+ var metadata33 = {
3174
3330
  name: "sdk-get-collection-pattern",
3175
3331
  description: "Get the recommended CRUD pattern for a specific collection. Returns code examples for the chosen API surface and operation type.",
3176
3332
  annotations: {
@@ -3366,14 +3522,14 @@ function handler6({
3366
3522
  }
3367
3523
 
3368
3524
  // src/prompts/sdk-usage-guide.ts
3369
- import { z as z30 } from "zod";
3370
- var schema33 = {
3371
- goal: z30.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3372
- runtime: z30.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3373
- surface: z30.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3374
- collection: z30.string().optional().describe("Specific collection if relevant")
3525
+ import { z as z29 } from "zod";
3526
+ var schema34 = {
3527
+ goal: z29.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3528
+ runtime: z29.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3529
+ surface: z29.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3530
+ collection: z29.string().optional().describe("Specific collection if relevant")
3375
3531
  };
3376
- var metadata33 = {
3532
+ var metadata34 = {
3377
3533
  name: "sdk-usage-guide",
3378
3534
  title: "SDK Usage Guide",
3379
3535
  description: "Provides guidance on how to perform a specific task using the 01.software SDK",
@@ -3521,8 +3677,9 @@ You can perform the "${goal}" task by following the patterns above.
3521
3677
  ### Product detail page (slug-based)
3522
3678
 
3523
3679
  \`\`\`typescript
3524
- const product = await client.commerce.product.detail({ slug })
3525
- if (!product) return notFound()
3680
+ const result = await client.commerce.product.detail({ slug })
3681
+ if (!result.found) return notFound()
3682
+ const product = result.product
3526
3683
  // product: { product, variants, options, brand, categories, tags, images, videos, listing }
3527
3684
  \`\`\`
3528
3685
 
@@ -3544,14 +3701,14 @@ const { allAvailable } = await client.commerce.product.stockCheck({
3544
3701
  }
3545
3702
 
3546
3703
  // src/prompts/collection-query-help.ts
3547
- import { z as z31 } from "zod";
3704
+ import { z as z30 } from "zod";
3548
3705
  import { COLLECTIONS as COLLECTIONS2, SERVER_COLLECTIONS as SERVER_COLLECTIONS5 } from "@01.software/sdk";
3549
- var schema34 = {
3550
- collection: z31.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3551
- operation: z31.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3552
- filters: z31.string().optional().describe("Filter conditions (JSON string, optional)")
3706
+ var schema35 = {
3707
+ collection: z30.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3708
+ operation: z30.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3709
+ filters: z30.string().optional().describe("Filter conditions (JSON string, optional)")
3553
3710
  };
3554
- var metadata34 = {
3711
+ var metadata35 = {
3555
3712
  name: "collection-query-help",
3556
3713
  title: "Collection Query Help",
3557
3714
  description: "Provides guidance on how to write queries for a specific collection",
@@ -3648,16 +3805,16 @@ ${operation === "find" ? `- Use \`where\` option for filtering (Payload query sy
3648
3805
  }
3649
3806
 
3650
3807
  // src/prompts/order-flow-guide.ts
3651
- import { z as z32 } from "zod";
3652
- var schema35 = {
3653
- scenario: z32.enum([
3808
+ import { z as z31 } from "zod";
3809
+ var schema36 = {
3810
+ scenario: z31.enum([
3654
3811
  "simple-order",
3655
3812
  "cart-checkout",
3656
3813
  "return-refund",
3657
3814
  "fulfillment-tracking"
3658
3815
  ]).describe("Order flow scenario")
3659
3816
  };
3660
- var metadata35 = {
3817
+ var metadata36 = {
3661
3818
  name: "order-flow-guide",
3662
3819
  title: "Order Flow Guide",
3663
3820
  description: "Provides step-by-step guidance for ecommerce order flows including creation, checkout, returns, and fulfillment.",
@@ -3672,9 +3829,10 @@ var SCENARIOS = {
3672
3829
  - Provide: orderNumber, customerSnapshot (email required), shippingAddress, orderItems, totalAmount
3673
3830
  - Optional: pgPaymentId (omit for free orders), shippingAmount, discountCode
3674
3831
 
3675
- 2. **Payment Confirmation** \u2192 \`update-transaction\` tool
3676
- - Confirm provider payment with pgPaymentId, paymentKey, and amount
3677
- - Stock is automatically adjusted (stock -= qty, reservedStock += qty)
3832
+ 2. **Payment Confirmation** \u2192 ServerClient \`commerce.orders.confirmPayment()\`
3833
+ - Confirm provider payment with pgPaymentId, provider name, and amount
3834
+ - Successful confirmation transitions the order to \`paid\`
3835
+ - Paid orders reserve sellable quantity (reservedStock += qty); physical stock is decremented on delivery
3678
3836
 
3679
3837
  3. **Fulfillment** \u2192 \`create-fulfillment\` tool
3680
3838
  - Provide carrier + trackingNumber for shipped status
@@ -3694,18 +3852,20 @@ const client = createServerClient({
3694
3852
  const order = await client.commerce.orders.create({
3695
3853
  orderNumber: 'ORD-240101-001',
3696
3854
  customerSnapshot: { email: 'user@example.com', name: 'John' },
3697
- shippingAddress: { postalCode: '06000', address1: '123 Main St' },
3855
+ shippingAddress: { postalCode: '06000', address: '123 Main St' },
3698
3856
  orderItems: [{ product: 'prod-id', variant: 'var-id', option: 'opt-id', quantity: 2 }],
3699
3857
  totalAmount: 59800,
3700
3858
  pgPaymentId: 'pay_xxx' // omit for free orders
3701
3859
  })
3702
3860
 
3703
3861
  // 2. After payment confirmed by provider
3704
- await client.commerce.orders.updateTransaction({
3862
+ await client.commerce.orders.confirmPayment({
3863
+ orderNumber: 'ORD-240101-001',
3705
3864
  pgPaymentId: 'pay_xxx',
3706
- status: 'paid',
3707
- paymentKey: 'payment_key_xxx',
3708
- amount: 59800
3865
+ pgProvider: 'provider',
3866
+ amount: 59800,
3867
+ paymentMethod: 'card',
3868
+ confirmationSource: 'provider_api_confirm'
3709
3869
  })
3710
3870
 
3711
3871
  // 3. Ship items
@@ -3724,7 +3884,7 @@ await client.commerce.orders.createFulfillment({
3724
3884
  2. **Apply Discount** (optional) \u2192 \`apply-discount\` tool
3725
3885
  3. **Calculate Shipping** \u2192 \`calculate-shipping\` tool
3726
3886
  4. **Checkout** \u2192 \`checkout\` tool (converts cart to order)
3727
- 5. **Payment** \u2192 \`update-transaction\` for provider-verified paid transitions
3887
+ 5. **Payment** \u2192 ServerClient \`commerce.orders.confirmPayment()\` for provider-verified paid transitions
3728
3888
 
3729
3889
  ### Key Points
3730
3890
  - Cart has a customer linked \u2014 auto-copied to order on checkout
@@ -3755,12 +3915,13 @@ const order = await client.commerce.orders.checkout({
3755
3915
  1. **Create Return** \u2192 \`create-return\` tool
3756
3916
  - Order must be \`delivered\` or \`confirmed\`
3757
3917
  - Specify returnItems and refundAmount
3758
- - Return status: requested \u2192 processing \u2192 approved \u2192 completed
3918
+ - Operator transitions: requested \u2192 processing/rejected, processing \u2192 approved/rejected
3919
+ - \`completed\` is server-derived and requires \`return-with-refund\`
3759
3920
 
3760
3921
  ### Option B: Return + Refund (atomic, recommended)
3761
3922
  1. **Return with Refund** \u2192 \`return-with-refund\` tool
3762
3923
  - Handles return + stock restoration + transaction update in one call
3763
- - Return immediately completed (bypasses FSM)
3924
+ - Sets the return to \`completed\` after provider-verified refund
3764
3925
  - Requires pgPaymentId and paymentKey for provider-verified refund
3765
3926
 
3766
3927
  ### Key Points
@@ -3776,8 +3937,9 @@ await client.commerce.orders.returnWithRefund({
3776
3937
  orderNumber: 'ORD-240101-001',
3777
3938
  reason: 'defective',
3778
3939
  reasonDetail: 'Product arrived damaged',
3779
- returnItems: [{ orderItem: 'oi-id', quantity: 1 }],
3940
+ returnItems: [{ orderItem: 'oi-id', quantity: 1, restockingFee: 500 }],
3780
3941
  refundAmount: 29900,
3942
+ returnShippingFee: 1500,
3781
3943
  pgPaymentId: 'pay_xxx',
3782
3944
  paymentKey: 'payment_key_xxx'
3783
3945
  })
@@ -3837,14 +3999,14 @@ ${SCENARIOS[scenario] || "Unknown scenario."}
3837
3999
  - \`checkout\`
3838
4000
  - \`create-fulfillment\`, \`update-fulfillment\`
3839
4001
  - \`create-return\`, \`update-return\`, \`return-with-refund\`
3840
- - \`update-transaction\`
4002
+ - \`confirm-payment\`, \`update-transaction\`
3841
4003
  - \`validate-discount\`, \`calculate-shipping\``;
3842
4004
  }
3843
4005
 
3844
4006
  // src/prompts/feature-setup-guide.ts
3845
- import { z as z33 } from "zod";
3846
- var schema36 = {
3847
- feature: z33.enum([
4007
+ import { z as z32 } from "zod";
4008
+ var schema37 = {
4009
+ feature: z32.enum([
3848
4010
  "ecommerce",
3849
4011
  "customers",
3850
4012
  "articles",
@@ -3859,7 +4021,7 @@ var schema36 = {
3859
4021
  "community"
3860
4022
  ]).describe("Feature to get setup guide for")
3861
4023
  };
3862
- var metadata36 = {
4024
+ var metadata37 = {
3863
4025
  name: "feature-setup-guide",
3864
4026
  title: "Feature Setup Guide",
3865
4027
  description: "Setup checklist and remediation guide for a tenant feature. Load with check-feature-progress and get-tenant-context to diagnose setup gaps.",
@@ -4067,7 +4229,7 @@ ${FEATURES[feature] || "Unknown feature."}
4067
4229
  }
4068
4230
 
4069
4231
  // src/resources/(config)/app.ts
4070
- var metadata37 = {
4232
+ var metadata38 = {
4071
4233
  name: "app-config",
4072
4234
  title: "Application Config",
4073
4235
  description: "01.software SDK and MCP server configuration information"
@@ -4111,7 +4273,7 @@ The hosted HTTP MCP endpoint at https://mcp.01.software/mcp exposes only these O
4111
4273
  - \`sdk-get-auth-setup\` - Get framework-specific auth setup guidance
4112
4274
  - \`sdk-get-collection-pattern\` - Get collection-specific usage patterns
4113
4275
 
4114
- ## Local CLI Stdio Surface (30)
4276
+ ## Local CLI Stdio Surface (33)
4115
4277
 
4116
4278
  For trusted local server-key workflows, start the stdio server:
4117
4279
 
@@ -4119,7 +4281,7 @@ For trusted local server-key workflows, start the stdio server:
4119
4281
  npx @01.software/cli mcp
4120
4282
  \`\`\`
4121
4283
 
4122
- Local stdio can expose generic read, order, return, cart, validation, stock, schema, tenant context, feature progress, field config, and guidance tools. Generic collection write tools (create/update/delete/update-many/delete-many) are intentionally absent on every transport; use the SDK server client for generic writes.
4284
+ Local stdio can expose generic read, order, payment confirmation, return, cart, validation, stock, schema, tenant context, feature progress, field config, and guidance tools. Generic collection write tools (create/update/delete/update-many/delete-many) are intentionally absent on every transport; use the SDK server client for generic writes.
4123
4285
 
4124
4286
  ## Rate Limits
4125
4287
 
@@ -4133,7 +4295,7 @@ Rate limits depend on your tenant plan:
4133
4295
 
4134
4296
  // src/resources/(collections)/schema.ts
4135
4297
  import { COLLECTIONS as COLLECTIONS3 } from "@01.software/sdk";
4136
- var metadata38 = {
4298
+ var metadata39 = {
4137
4299
  name: "collections-schema",
4138
4300
  title: "Collection Schema Info",
4139
4301
  description: "Available collections and their schema information"
@@ -4270,7 +4432,7 @@ Total available collections: ${COLLECTIONS3.length}`;
4270
4432
  }
4271
4433
 
4272
4434
  // src/resources/(docs)/getting-started.ts
4273
- var metadata39 = {
4435
+ var metadata40 = {
4274
4436
  name: "docs-getting-started",
4275
4437
  title: "Getting Started",
4276
4438
  description: "01.software SDK getting started guide"
@@ -4331,7 +4493,7 @@ const result = await client.collections.from('products').find({
4331
4493
  }
4332
4494
 
4333
4495
  // src/resources/(docs)/guides.ts
4334
- var metadata40 = {
4496
+ var metadata41 = {
4335
4497
  name: "docs-guides",
4336
4498
  title: "Guides",
4337
4499
  description: "01.software SDK usage guides"
@@ -4544,7 +4706,7 @@ For more implementation guidance, see the [SDK Guide](/developers/sdk).`;
4544
4706
  }
4545
4707
 
4546
4708
  // src/resources/(docs)/api.ts
4547
- var metadata41 = {
4709
+ var metadata42 = {
4548
4710
  name: "docs-api",
4549
4711
  title: "API Reference",
4550
4712
  description: "01.software SDK API reference documentation"
@@ -4827,7 +4989,7 @@ For more details, see the [API documentation](/developers/api).`;
4827
4989
  }
4828
4990
 
4829
4991
  // src/resources/(docs)/query-builder.ts
4830
- var metadata42 = {
4992
+ var metadata43 = {
4831
4993
  name: "docs-query-builder",
4832
4994
  title: "Query Builder",
4833
4995
  description: "01.software SDK Query Builder API reference (client.collections.from)"
@@ -5021,7 +5183,7 @@ console.log(result.hasNextPage) // true
5021
5183
  }
5022
5184
 
5023
5185
  // src/resources/(docs)/react-query.ts
5024
- var metadata43 = {
5186
+ var metadata44 = {
5025
5187
  name: "docs-react-query",
5026
5188
  title: "React Query Hooks",
5027
5189
  description: "01.software SDK React Query hooks reference (@01.software/sdk/query)"
@@ -5253,7 +5415,7 @@ export function ProductList() {
5253
5415
  }
5254
5416
 
5255
5417
  // src/resources/(docs)/server-api.ts
5256
- var metadata44 = {
5418
+ var metadata45 = {
5257
5419
  name: "docs-server-api",
5258
5420
  title: "Server-side API",
5259
5421
  description: "01.software SDK server-side API reference (client.commerce) for orders, fulfillments, returns, carts, and validation"
@@ -5291,16 +5453,16 @@ const order = await client.commerce.orders.create({
5291
5453
  recipientName: 'John Doe',
5292
5454
  phone: '+821012345678',
5293
5455
  postalCode: '06234',
5294
- address1: '123 Main St',
5295
- address2: 'Apt 4B',
5456
+ address: '123 Main St',
5457
+ detailAddress: 'Apt 4B',
5296
5458
  deliveryMessage?: 'Leave at door',
5297
5459
  },
5298
5460
  orderItems: [
5299
- { product: 'product-id', variant: 'variant-id', option: 'option-id', quantity: 2, unitPrice: 29900 }
5461
+ { product: 'product-id', variant: 'variant-id', option: 'option-id', quantity: 2 }
5300
5462
  ],
5301
5463
  totalAmount: 59800,
5302
5464
  shippingAmount?: 3000,
5303
- pgPaymentId?: 'toss-payment-id', // omit for free orders
5465
+ pgPaymentId?: 'provider-payment-id', // omit for free orders
5304
5466
  })
5305
5467
  \`\`\`
5306
5468
 
@@ -5312,7 +5474,7 @@ const order = await client.commerce.orders.checkout({
5312
5474
  cartId: 'cart-id',
5313
5475
  orderNumber: 'ORD-20240101-0001',
5314
5476
  customerSnapshot: { name: 'John Doe', email: 'john@example.com' },
5315
- pgPaymentId?: 'toss-payment-id',
5477
+ pgPaymentId?: 'provider-payment-id',
5316
5478
  })
5317
5479
  \`\`\`
5318
5480
 
@@ -5384,12 +5546,12 @@ const ret = await client.commerce.orders.createReturn({
5384
5546
  \`\`\`
5385
5547
 
5386
5548
  ### updateReturn()
5387
- Update return status.
5549
+ Update operator-driven return status. \`completed\` is server-derived and must go through \`returnWithRefund()\`.
5388
5550
 
5389
5551
  \`\`\`typescript
5390
5552
  const ret = await client.commerce.orders.updateReturn({
5391
5553
  returnId: 'return-id',
5392
- status: 'processing', // processing | approved | completed | rejected
5554
+ status: 'processing', // processing | approved | rejected
5393
5555
  })
5394
5556
  \`\`\`
5395
5557
 
@@ -5402,27 +5564,49 @@ const result = await client.commerce.orders.returnWithRefund({
5402
5564
  reason?: 'defective',
5403
5565
  reasonDetail?: 'Screen cracked on arrival',
5404
5566
  returnItems: [
5405
- { orderItem: 'order-item-id', quantity: 1 }
5567
+ { orderItem: 'order-item-id', quantity: 1, restockingFee?: 500 }
5406
5568
  ],
5407
5569
  refundAmount: 29900,
5408
- pgPaymentId: 'toss-payment-id', // required
5409
- paymentKey: 'toss-payment-key', // required for provider refund
5570
+ returnShippingFee?: 1500,
5571
+ pgPaymentId: 'provider-payment-id', // required
5572
+ paymentKey: 'provider-payment-key', // required for provider refund
5410
5573
  refundReceiptUrl?: 'https://...',
5411
5574
  })
5412
5575
  \`\`\`
5413
5576
 
5414
5577
  ## Transaction API
5415
5578
 
5579
+ ### confirmPayment()
5580
+ Confirm a provider-verified payment and transition the order to paid. Verify the
5581
+ payment with the provider first, then call this endpoint with the provider name,
5582
+ amount, and an idempotency event ID when available.
5583
+
5584
+ \`\`\`typescript
5585
+ const result = await client.commerce.orders.confirmPayment({
5586
+ orderNumber: 'ORD-20240101-0001',
5587
+ pgPaymentId: 'provider-payment-id',
5588
+ pgProvider: 'provider-name',
5589
+ amount: 29900,
5590
+ currency: 'KRW',
5591
+ paymentMethod: 'card',
5592
+ providerStatus: 'PAID',
5593
+ providerEventId: 'provider-event-id',
5594
+ confirmationSource: 'provider_api_confirm',
5595
+ })
5596
+ \`\`\`
5597
+
5416
5598
  ### updateTransaction()
5417
- Confirm or annotate a transaction. Paid transitions require provider
5418
- verification; non-financial annotations can still update pending transactions.
5599
+ Lower-level transaction update path. Prefer \`confirmPayment()\` for normal paid
5600
+ transitions. Use this only for compatibility paths that still require direct
5601
+ transaction annotation after provider verification, or for non-paid pending
5602
+ transaction updates.
5419
5603
 
5420
5604
  \`\`\`typescript
5421
5605
  const tx = await client.commerce.orders.updateTransaction({
5422
- pgPaymentId: 'toss-payment-id',
5423
- status: 'paid', // pending | paid | failed | canceled
5424
- paymentKey: 'toss-payment-key', // required when status is paid
5425
- amount: 29900, // required when status is paid
5606
+ pgPaymentId: 'provider-payment-id',
5607
+ status: 'failed', // pending | paid | failed | canceled
5608
+ paymentMethod: 'card',
5609
+ receiptUrl: 'https://...',
5426
5610
  })
5427
5611
  \`\`\`
5428
5612
 
@@ -5515,7 +5699,7 @@ const result = await client.commerce.shipping.calculate({
5515
5699
  }
5516
5700
 
5517
5701
  // src/resources/(docs)/customer-auth.ts
5518
- var metadata45 = {
5702
+ var metadata46 = {
5519
5703
  name: "docs-customer-auth",
5520
5704
  title: "Customer Auth API",
5521
5705
  description: "01.software SDK Customer Auth API reference (client.customer)"
@@ -5693,7 +5877,7 @@ async function loadProfile() {
5693
5877
  }
5694
5878
 
5695
5879
  // src/resources/(docs)/browser-vs-server.ts
5696
- var metadata46 = {
5880
+ var metadata47 = {
5697
5881
  name: "docs-browser-vs-server",
5698
5882
  title: "Client vs ServerClient",
5699
5883
  description: "When to use Client (createClient) vs ServerClient (createServerClient) in the 01.software SDK"
@@ -5859,7 +6043,7 @@ export function ProductList() {
5859
6043
  }
5860
6044
 
5861
6045
  // src/resources/(docs)/file-upload.ts
5862
- var metadata47 = {
6046
+ var metadata48 = {
5863
6047
  name: "docs-file-upload",
5864
6048
  title: "File Upload",
5865
6049
  description: "01.software SDK file upload patterns using the images collection"
@@ -6010,7 +6194,7 @@ The platform stores files in Cloudflare R2 and serves via CDN (\`cdn.01.software
6010
6194
  }
6011
6195
 
6012
6196
  // src/resources/(docs)/webhook.ts
6013
- var metadata48 = {
6197
+ var metadata49 = {
6014
6198
  name: "docs-webhook",
6015
6199
  title: "Webhooks",
6016
6200
  description: "01.software SDK webhook verification and event handling"
@@ -6018,15 +6202,21 @@ var metadata48 = {
6018
6202
  function handler18() {
6019
6203
  return `# Webhooks
6020
6204
 
6021
- The platform dispatches HMAC-SHA256 signed webhook events to your registered URLs. Tenant developers own routing inside their webhook handler.
6205
+ The platform dispatches HMAC-SHA256 signed webhook events to registered URLs. Tenant developers own routing inside their webhook handler.
6022
6206
 
6023
6207
  ## Webhook Handling
6024
6208
 
6025
- Use the SDK \`handleWebhook\` helper to verify signatures. For customer auth events, use \`createCustomerAuthWebhookHandler\` to wire delivery behavior in your app.
6209
+ 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.
6026
6210
 
6027
6211
  \`\`\`typescript
6028
6212
  import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
6029
6213
 
6214
+ function getWebhookSecret(): string {
6215
+ const secret = process.env.WEBHOOK_SECRET
6216
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6217
+ return secret
6218
+ }
6219
+
6030
6220
  const handler = createCustomerAuthWebhookHandler({
6031
6221
  passwordReset: async (data) => {
6032
6222
  await sendPasswordResetEmail(data)
@@ -6035,7 +6225,7 @@ const handler = createCustomerAuthWebhookHandler({
6035
6225
 
6036
6226
  export async function POST(request: Request) {
6037
6227
  return handleWebhook(request, handler, {
6038
- secret: process.env.WEBHOOK_SECRET!,
6228
+ secret: getWebhookSecret(),
6039
6229
  })
6040
6230
  }
6041
6231
  \`\`\`
@@ -6048,6 +6238,12 @@ export async function POST(request: Request) {
6048
6238
  // app/api/webhooks/route.ts
6049
6239
  import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
6050
6240
 
6241
+ function getWebhookSecret(): string {
6242
+ const secret = process.env.WEBHOOK_SECRET
6243
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6244
+ return secret
6245
+ }
6246
+
6051
6247
  const customerAuthHandler = createCustomerAuthWebhookHandler({
6052
6248
  passwordReset: sendPasswordResetEmail,
6053
6249
  })
@@ -6058,25 +6254,161 @@ export async function POST(request: Request) {
6058
6254
 
6059
6255
  await customerAuthHandler(event)
6060
6256
  }, {
6061
- secret: process.env.WEBHOOK_SECRET!,
6257
+ secret: getWebhookSecret(),
6062
6258
  })
6063
6259
  }
6064
6260
  \`\`\`
6065
6261
 
6262
+ ## Commerce Notification Handler Example
6263
+
6264
+ \`\`\`typescript
6265
+ import {
6266
+ handleWebhook,
6267
+ isCommerceNotificationWebhookEvent,
6268
+ } from '@01.software/sdk/webhook'
6269
+
6270
+ function getWebhookSecret(): string {
6271
+ const secret = process.env.WEBHOOK_SECRET
6272
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6273
+ return secret
6274
+ }
6275
+
6276
+ export async function POST(request: Request) {
6277
+ return handleWebhook(request, async (event) => {
6278
+ if (!isCommerceNotificationWebhookEvent(event)) return
6279
+
6280
+ const idempotencyKey = \`\${event.notification.intentId}:\${event.notification.dedupeKey}\`
6281
+ const processed = await processOnce(idempotencyKey, async () => {
6282
+ if (event.notification.event === 'orderPaid') {
6283
+ const orderId = event.notification.orderId ?? event.data.orderId
6284
+ if (orderId) await updateOrderWorkflow(orderId)
6285
+ }
6286
+
6287
+ if (event.notification.event === 'fulfillmentShipped') {
6288
+ const fulfillmentId =
6289
+ event.notification.fulfillmentId ?? event.data.fulfillmentId
6290
+ if (fulfillmentId) await updateFulfillmentWorkflow(fulfillmentId)
6291
+ }
6292
+ })
6293
+
6294
+ if (!processed) return
6295
+ }, {
6296
+ secret: getWebhookSecret(),
6297
+ })
6298
+ }
6299
+ \`\`\`
6300
+
6301
+ Back \`processOnce()\` with durable storage such as a database unique key or queue idempotency store; do not use process-local memory for webhook idempotency.
6302
+
6303
+ ## Headless Commerce Email Workers
6304
+
6305
+ 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.
6306
+
6307
+ 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.
6308
+
6066
6309
  ## Webhook Payload Structure
6067
6310
 
6068
6311
  All webhook events share this envelope:
6069
6312
 
6070
6313
  \`\`\`typescript
6071
6314
  {
6072
- collection: string, // e.g. 'customers'
6073
- operation: string, // e.g. 'password-reset'
6074
- data: object, // event-specific payload
6315
+ collection: string,
6316
+ operation: string,
6317
+ data: object,
6318
+ eventType?: string,
6319
+ change?: object,
6320
+ notification?: object,
6321
+ timestamp?: string,
6322
+ deliveryId?: string,
6075
6323
  }
6076
6324
  \`\`\`
6077
6325
 
6078
6326
  ## Event Types
6079
6327
 
6328
+ ### Commerce Notification
6329
+
6330
+ 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\`.
6331
+
6332
+ Canonical example (public operational identifiers only; no PII, payment/provider fields, metadata, tracking number, or tracking URL):
6333
+
6334
+ \`\`\`json
6335
+ {
6336
+ "eventType": "commerce.notification",
6337
+ "collection": "orders",
6338
+ "operation": "notification",
6339
+ "data": {
6340
+ "orderId": "order_123",
6341
+ "orderNumber": "ORD-1001",
6342
+ "status": "paid",
6343
+ "totalAmount": 5000,
6344
+ "currency": "KRW"
6345
+ },
6346
+ "notification": {
6347
+ "event": "orderPaid",
6348
+ "intentId": "intent_123",
6349
+ "dedupeKey": "orderPaid:order_123",
6350
+ "orderId": "order_123"
6351
+ },
6352
+ "timestamp": "2026-05-29T00:00:00.000Z",
6353
+ "deliveryId": "delivery_attempt_123"
6354
+ }
6355
+ \`\`\`
6356
+
6357
+ Use \`notification.intentId\` plus \`notification.dedupeKey\` for semantic idempotency. \`deliveryId\` is per delivery attempt / observability and may not be stable across semantic retries.
6358
+ 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.
6359
+
6360
+ V1 source subscription semantics:
6361
+
6362
+ - \`orderPaid\` and \`orderDelivered\` are delivered through \`orders\`-scoped endpoints.
6363
+ - \`fulfillmentShipped\` is delivered through \`fulfillments\`-scoped endpoints.
6364
+ - \`returnRequested\` and \`returnCompleted\` are delivered through \`returns\`-scoped endpoints.
6365
+ - Empty, unscoped, and all-collection endpoints do not receive v1 semantic commerce notifications.
6366
+
6367
+ ### Collection Order Changed
6368
+
6369
+ Admin Panel manual ordering is delivered as a semantic collection update:
6370
+
6371
+ - \`operation\` remains \`"update"\` for compatibility.
6372
+ - \`eventType\` is \`"collection.orderChanged"\`.
6373
+ - SDK handlers should use \`isOrderChangedWebhookEvent()\` from \`@01.software/sdk/webhook\`.
6374
+ - \`change.scope\` identifies collection-level ordering versus join ordering.
6375
+ - Route on public semantics such as \`change.scope.collection\`, \`change.scope.field\`, and \`change.moved.id\`.
6376
+ - Do not branch on hidden Payload order fields or private backing collections; diagnostic fields may still be present.
6377
+ - Customer group member ordering is currently unsupported and does not emit a semantic order-change webhook.
6378
+
6379
+ \`\`\`typescript
6380
+ import { handleWebhook, isOrderChangedWebhookEvent } from '@01.software/sdk/webhook'
6381
+
6382
+ function getWebhookSecret(): string {
6383
+ const secret = process.env.WEBHOOK_SECRET
6384
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6385
+ return secret
6386
+ }
6387
+
6388
+ export async function POST(request: Request) {
6389
+ return handleWebhook(
6390
+ request,
6391
+ async (event) => {
6392
+ if (isOrderChangedWebhookEvent(event)) {
6393
+ if (event.change.scope.kind === 'join') {
6394
+ console.log('Join order changed', {
6395
+ collection: event.change.scope.collection,
6396
+ field: event.change.scope.field,
6397
+ parentId: event.change.scope.id,
6398
+ movedCollection: event.change.moved.collection,
6399
+ movedId: event.change.moved.id,
6400
+ })
6401
+ }
6402
+ return
6403
+ }
6404
+
6405
+ console.log('Content changed', event.collection, event.operation)
6406
+ },
6407
+ { secret: getWebhookSecret() },
6408
+ )
6409
+ }
6410
+ \`\`\`
6411
+
6080
6412
  ### Customer Password Reset
6081
6413
 
6082
6414
  Dispatched when a customer calls \`client.customer.forgotPassword(email)\`.
@@ -6089,8 +6421,8 @@ Dispatched when a customer calls \`client.customer.forgotPassword(email)\`.
6089
6421
  customerId: string,
6090
6422
  email: string,
6091
6423
  name: string,
6092
- resetPasswordToken: string, // raw token to include in reset link
6093
- resetPasswordExpiresAt: string, // ISO 8601 expiry (1 hour from dispatch)
6424
+ resetPasswordToken: string,
6425
+ resetPasswordExpiresAt: string,
6094
6426
  }
6095
6427
  }
6096
6428
  \`\`\`
@@ -6105,11 +6437,13 @@ async function sendPasswordResetEmail(data: {
6105
6437
  resetPasswordToken: string
6106
6438
  resetPasswordExpiresAt: string
6107
6439
  }) {
6108
- const resetUrl = \`https://yourstore.com/reset-password?token=\${data.resetPasswordToken}\`
6440
+ const resetUrl = new URL('https://yourstore.com/reset-password')
6441
+ resetUrl.searchParams.set('token', data.resetPasswordToken)
6442
+
6109
6443
  await emailService.send({
6110
6444
  to: data.email,
6111
6445
  subject: 'Reset your password',
6112
- body: \`Reset link (expires \${data.resetPasswordExpiresAt}): \${resetUrl}\`,
6446
+ body: \`Reset link (expires \${data.resetPasswordExpiresAt}): \${resetUrl.toString()}\`,
6113
6447
  })
6114
6448
  }
6115
6449
  \`\`\`
@@ -6120,11 +6454,11 @@ Failed webhook deliveries are queued with automatic retries. Ensure your handler
6120
6454
 
6121
6455
  ## Webhook Configuration
6122
6456
 
6123
- Configure webhook URLs in the 01.software console under Tenant Settings > Webhooks. Multiple URLs can be registered; all receive every event.`;
6457
+ 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.`;
6124
6458
  }
6125
6459
 
6126
6460
  // src/resources/(docs)/product-detail.ts
6127
- var metadata49 = {
6461
+ var metadata50 = {
6128
6462
  name: "docs-product-detail",
6129
6463
  title: "Product Detail Helper",
6130
6464
  description: "01.software SDK commerce.product.detail helper guide"
@@ -6148,8 +6482,8 @@ const client = createClient({
6148
6482
  })
6149
6483
 
6150
6484
  const detail = await client.commerce.product.detail({ slug: 'my-product' })
6151
- if (!detail) return notFound()
6152
- const selection = resolveProductSelection(detail, {
6485
+ if (!detail.found) return notFound()
6486
+ const selection = resolveProductSelection(detail.product, {
6153
6487
  search: '?opt.option-color=color-black',
6154
6488
  })
6155
6489
  // selection.selectedVariant, selection.price, selection.stock, selection.media
@@ -6200,23 +6534,41 @@ export default async function ProductPage({ params }: { params: { slug: string }
6200
6534
  publishableKey: process.env.NEXT_PUBLIC_SOFTWARE_PUBLISHABLE_KEY!,
6201
6535
  })
6202
6536
  const detail = await client.commerce.product.detail({ slug: params.slug })
6203
- if (!detail) return notFound()
6204
- return <ProductView detail={detail} />
6537
+ if (!detail.found) return notFound()
6538
+ return <ProductView detail={detail.product} />
6205
6539
  }
6206
6540
  \`\`\`
6207
6541
 
6208
- ## The \`null\` return contract
6542
+ ## The \`ProductDetailResult\` return contract
6543
+
6544
+ 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.
6209
6545
 
6210
- 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.
6546
+ 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.
6211
6547
 
6212
6548
  ## Backend correlation
6213
6549
 
6214
- Log \`client.lastRequestId\` against backend logs \u2014 the endpoint records the exact 404 code alongside the request ID.`;
6550
+ Log \`client.lastRequestId\` against backend logs \u2014 the endpoint records the exact 404 reason alongside the request ID.`;
6215
6551
  }
6216
6552
 
6217
6553
  // src/server.ts
6218
6554
  var REGISTERED_TOOLS_BY_SERVER = /* @__PURE__ */ new WeakMap();
6219
- function registerTool(server, schema37, meta, handler20) {
6555
+ function hasToolPolicy(toolName) {
6556
+ return Object.prototype.hasOwnProperty.call(TOOL_POLICY_MANIFEST, toolName);
6557
+ }
6558
+ function runtimeAnnotationsFor(meta) {
6559
+ if (!hasToolPolicy(meta.name)) {
6560
+ throw new Error(`No tool-policy entry for registered MCP tool ${meta.name}`);
6561
+ }
6562
+ const policy = TOOL_POLICY_MANIFEST[meta.name];
6563
+ return {
6564
+ title: meta.annotations?.title,
6565
+ readOnlyHint: policy.annotationPolicy.readOnly,
6566
+ destructiveHint: policy.annotationPolicy.destructive,
6567
+ idempotentHint: policy.annotationPolicy.idempotent,
6568
+ openWorldHint: policy.annotationPolicy.openWorld
6569
+ };
6570
+ }
6571
+ function registerTool(server, schema38, meta, handler20) {
6220
6572
  let registered = REGISTERED_TOOLS_BY_SERVER.get(server);
6221
6573
  if (!registered) {
6222
6574
  registered = /* @__PURE__ */ new Set();
@@ -6227,16 +6579,20 @@ function registerTool(server, schema37, meta, handler20) {
6227
6579
  meta.name,
6228
6580
  {
6229
6581
  description: meta.description,
6230
- inputSchema: schema37,
6231
- annotations: meta.annotations
6582
+ inputSchema: schema38,
6583
+ annotations: runtimeAnnotationsFor(meta)
6232
6584
  },
6233
6585
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6234
6586
  async (params) => {
6235
6587
  const ctx = tenantAuthContext();
6236
6588
  if (ctx) {
6237
- const decision = evaluateToolPolicy(meta.name, ctx.scopes);
6589
+ const decision = evaluateToolPolicy(
6590
+ meta.name,
6591
+ ctx.scopes,
6592
+ ctx.tenantRole
6593
+ );
6238
6594
  if (!decision.allowed) {
6239
- const status = decision.reason === "insufficient_scope" ? 403 : 500;
6595
+ const status = decision.reason === "insufficient_scope" || decision.reason === "insufficient_role" ? 403 : 500;
6240
6596
  return {
6241
6597
  content: [
6242
6598
  {
@@ -6273,13 +6629,13 @@ function registerTool(server, schema37, meta, handler20) {
6273
6629
  }
6274
6630
  );
6275
6631
  }
6276
- function registerPrompt(server, schema37, meta, handler20) {
6632
+ function registerPrompt(server, schema38, meta, handler20) {
6277
6633
  server.registerPrompt(
6278
6634
  meta.name,
6279
6635
  {
6280
6636
  title: meta.title,
6281
6637
  description: meta.description,
6282
- argsSchema: schema37
6638
+ argsSchema: schema38
6283
6639
  },
6284
6640
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6285
6641
  (params) => ({
@@ -6351,211 +6707,232 @@ function createServer(options = {}) {
6351
6707
  server,
6352
6708
  schema10,
6353
6709
  metadata10,
6354
- createReturn
6710
+ confirmPayment
6355
6711
  );
6356
6712
  registerTool(
6357
6713
  server,
6358
6714
  schema11,
6359
6715
  metadata11,
6360
- updateReturn
6716
+ createReturn
6361
6717
  );
6362
6718
  registerTool(
6363
6719
  server,
6364
6720
  schema12,
6365
6721
  metadata12,
6366
- returnWithRefund
6722
+ updateReturn
6367
6723
  );
6368
- registerTool(server, schema13, metadata13, addCartItem);
6369
6724
  registerTool(
6370
6725
  server,
6371
- schema14,
6372
- metadata14,
6373
- updateCartItem
6726
+ schema13,
6727
+ metadata13,
6728
+ returnWithRefund
6374
6729
  );
6730
+ registerTool(server, schema14, metadata14, addCartItem);
6375
6731
  registerTool(
6376
6732
  server,
6377
6733
  schema15,
6378
6734
  metadata15,
6379
- removeCartItem
6735
+ updateCartItem
6380
6736
  );
6381
6737
  registerTool(
6382
6738
  server,
6383
6739
  schema16,
6384
6740
  metadata16,
6385
- applyDiscount
6741
+ removeCartItem
6386
6742
  );
6387
6743
  registerTool(
6388
6744
  server,
6389
6745
  schema17,
6390
6746
  metadata17,
6391
- removeDiscount
6747
+ applyDiscount
6392
6748
  );
6393
- registerTool(server, schema18, metadata18, clearCart);
6394
6749
  registerTool(
6395
6750
  server,
6396
- schema19,
6397
- metadata19,
6398
- validateDiscount
6751
+ schema18,
6752
+ metadata18,
6753
+ removeDiscount
6399
6754
  );
6755
+ registerTool(server, schema19, metadata19, clearCart);
6400
6756
  registerTool(
6401
6757
  server,
6402
6758
  schema20,
6403
6759
  metadata20,
6760
+ validateDiscount
6761
+ );
6762
+ registerTool(
6763
+ server,
6764
+ schema21,
6765
+ metadata21,
6404
6766
  calculateShipping
6405
6767
  );
6406
- registerTool(server, schema21, metadata21, stockCheck);
6407
- registerTool(server, schema22, metadata22, productDetail);
6768
+ registerTool(server, schema22, metadata22, stockCheck);
6408
6769
  registerTool(
6409
6770
  server,
6410
6771
  schema23,
6411
6772
  metadata23,
6773
+ productDetail
6774
+ );
6775
+ registerTool(
6776
+ server,
6777
+ schema24,
6778
+ metadata24,
6412
6779
  productUpsert
6413
6780
  );
6414
6781
  }
6415
- registerTool(
6416
- server,
6417
- schema24,
6418
- metadata24,
6419
- getCollectionSchemaTool
6420
- );
6421
6782
  registerTool(
6422
6783
  server,
6423
6784
  schema25,
6424
6785
  metadata25,
6425
- handler
6786
+ getCollectionSchemaTool
6426
6787
  );
6427
6788
  registerTool(
6428
6789
  server,
6429
6790
  schema26,
6430
6791
  metadata26,
6431
- handler2
6792
+ handler
6432
6793
  );
6433
6794
  registerTool(
6434
6795
  server,
6435
6796
  schema27,
6436
6797
  metadata27,
6437
- listConfigurableFields
6798
+ handler2
6438
6799
  );
6439
6800
  registerTool(
6440
6801
  server,
6441
6802
  schema28,
6442
6803
  metadata28,
6443
- updateFieldConfig
6804
+ listConfigurableFields
6444
6805
  );
6445
6806
  registerTool(
6446
6807
  server,
6447
6808
  schema29,
6448
6809
  metadata29,
6449
- handler3
6810
+ updateFieldConfig
6450
6811
  );
6451
6812
  registerTool(
6452
6813
  server,
6453
6814
  schema30,
6454
6815
  metadata30,
6455
- handler4
6816
+ handler3
6456
6817
  );
6457
6818
  registerTool(
6458
6819
  server,
6459
6820
  schema31,
6460
6821
  metadata31,
6461
- handler5
6822
+ handler4
6462
6823
  );
6463
6824
  registerTool(
6464
6825
  server,
6465
6826
  schema32,
6466
6827
  metadata32,
6467
- handler6
6828
+ handler5
6468
6829
  );
6469
- registerPrompt(
6830
+ registerTool(
6470
6831
  server,
6471
6832
  schema33,
6472
6833
  metadata33,
6473
- sdkUsageGuide
6834
+ handler6
6474
6835
  );
6475
6836
  registerPrompt(
6476
6837
  server,
6477
6838
  schema34,
6478
6839
  metadata34,
6479
- collectionQueryHelp
6840
+ sdkUsageGuide
6480
6841
  );
6481
6842
  registerPrompt(
6482
6843
  server,
6483
6844
  schema35,
6484
6845
  metadata35,
6485
- orderFlowGuide
6846
+ collectionQueryHelp
6486
6847
  );
6487
6848
  registerPrompt(
6488
6849
  server,
6489
6850
  schema36,
6490
6851
  metadata36,
6852
+ orderFlowGuide
6853
+ );
6854
+ registerPrompt(
6855
+ server,
6856
+ schema37,
6857
+ metadata37,
6491
6858
  featureSetupGuide
6492
6859
  );
6493
6860
  registerStaticResource(
6494
6861
  server,
6495
- "config://app",
6496
- metadata37,
6862
+ mcpResourceUri("app-config"),
6863
+ metadata38,
6497
6864
  handler7
6498
6865
  );
6499
6866
  registerStaticResource(
6500
6867
  server,
6501
- "collections://schema",
6502
- metadata38,
6868
+ mcpResourceUri("collections-schema"),
6869
+ metadata39,
6503
6870
  handler8
6504
6871
  );
6505
6872
  registerStaticResource(
6506
6873
  server,
6507
- "docs://sdk/getting-started",
6508
- metadata39,
6874
+ mcpResourceUri("docs-getting-started"),
6875
+ metadata40,
6509
6876
  handler9
6510
6877
  );
6511
- registerStaticResource(server, "docs://sdk/guides", metadata40, handler10);
6512
- registerStaticResource(server, "docs://sdk/api", metadata41, handler11);
6513
6878
  registerStaticResource(
6514
6879
  server,
6515
- "docs://sdk/query-builder",
6880
+ mcpResourceUri("docs-guides"),
6881
+ metadata41,
6882
+ handler10
6883
+ );
6884
+ registerStaticResource(
6885
+ server,
6886
+ mcpResourceUri("docs-api"),
6516
6887
  metadata42,
6517
- handler12
6888
+ handler11
6518
6889
  );
6519
6890
  registerStaticResource(
6520
6891
  server,
6521
- "docs://sdk/react-query",
6892
+ mcpResourceUri("docs-query-builder"),
6522
6893
  metadata43,
6523
- handler13
6894
+ handler12
6524
6895
  );
6525
6896
  registerStaticResource(
6526
6897
  server,
6527
- "docs://sdk/server-api",
6898
+ mcpResourceUri("docs-react-query"),
6528
6899
  metadata44,
6529
- handler14
6900
+ handler13
6530
6901
  );
6531
6902
  registerStaticResource(
6532
6903
  server,
6533
- "docs://sdk/customer-auth",
6904
+ mcpResourceUri("docs-server-api"),
6534
6905
  metadata45,
6535
- handler15
6906
+ handler14
6536
6907
  );
6537
6908
  registerStaticResource(
6538
6909
  server,
6539
- "docs://sdk/browser-vs-server",
6910
+ mcpResourceUri("docs-customer-auth"),
6540
6911
  metadata46,
6541
- handler16
6912
+ handler15
6542
6913
  );
6543
6914
  registerStaticResource(
6544
6915
  server,
6545
- "docs://sdk/file-upload",
6916
+ mcpResourceUri("docs-browser-vs-server"),
6546
6917
  metadata47,
6547
- handler17
6918
+ handler16
6548
6919
  );
6549
6920
  registerStaticResource(
6550
6921
  server,
6551
- "docs://sdk/webhook",
6922
+ mcpResourceUri("docs-file-upload"),
6552
6923
  metadata48,
6553
- handler18
6924
+ handler17
6554
6925
  );
6555
6926
  registerStaticResource(
6556
6927
  server,
6557
- "docs://sdk/product-detail",
6928
+ mcpResourceUri("docs-webhook"),
6558
6929
  metadata49,
6930
+ handler18
6931
+ );
6932
+ registerStaticResource(
6933
+ server,
6934
+ mcpResourceUri("docs-product-detail"),
6935
+ metadata50,
6559
6936
  handler19
6560
6937
  );
6561
6938
  return server;
@@ -6568,6 +6945,7 @@ export {
6568
6945
  MCP_TENANT_CLAIM,
6569
6946
  MCP_TENANT_ROLE_CLAIM,
6570
6947
  MCP_SCOPES,
6948
+ MCP_RESOURCE_LABELS,
6571
6949
  requestContext,
6572
6950
  mcpServicePublicJwks,
6573
6951
  createMcpTelemetrySummary,
@@ -6575,4 +6953,4 @@ export {
6575
6953
  flushMcpTelemetrySummary,
6576
6954
  createServer
6577
6955
  };
6578
- //# sourceMappingURL=chunk-2EPYMNHW.js.map
6956
+ //# sourceMappingURL=chunk-3TIDAOYP.js.map