@burdenoff/mcp-libs 2026.1030.4 → 2026.1031.1

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.
@@ -17,21 +17,22 @@ var VEHICLE_FIELDS = `
17
17
  id vehicleNumber type status make model year licensePlate capacity
18
18
  currentLocation fuelLevel mileage ownershipType ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
19
19
  `;
20
- var PRODUCT_FIELDS = `
20
+ var CARGO_ITEM_FIELDS = `
21
21
  id name sku description category brand weight value dimensions fragile
22
22
  hazardous temperatureControlled ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
23
23
  `;
24
- var ORDER_STATUS_HISTORY_FIELDS = `
25
- id orderId status previousStatus notes location createdAt
24
+ var DELIVERY_JOB_STATUS_HISTORY_FIELDS = `
25
+ id deliveryJobId status previousStatus notes location createdAt
26
26
  `;
27
- var ORDER_FIELDS = `
28
- id orderNumber customerId driverId vehicleId orderType status priority
29
- pickupAddress deliveryAddress items pricing trackingNumber scheduledDelivery
30
- specialInstructions ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
27
+ var DELIVERY_JOB_FIELDS = `
28
+ id deliveryJobNumber customerId driverId vehicleId routeId storeOrderId status
29
+ priority pickupAddress deliveryAddress cargoItems pricing trackingNumber
30
+ scheduledDelivery specialInstructions ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
31
31
  `;
32
32
  var SHIPMENT_FIELDS = `
33
- id shipmentNumber orderId customerId carrierId origin destination status
34
- trackingNumber cargoDetails estimatedDelivery actualDelivery
33
+ id shipmentNumber deliveryJobId storeOrderId customerId carrierId origin
34
+ destination status statusRevision primaryMode isMultiModal trackingNumber
35
+ cargoDetails estimatedDelivery actualDelivery totalFreightCost freightCurrency
35
36
  ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
36
37
  `;
37
38
  var TRACKING_EVENT_FIELDS = `
@@ -40,7 +41,7 @@ var TRACKING_EVENT_FIELDS = `
40
41
  ${CONTEXT_FIELDS}
41
42
  `;
42
43
  var TRACKING_ALERT_FIELDS = `
43
- shipmentId shipmentNumber alertType message
44
+ shipmentId shipmentNumber alertType message predictedDelivery riskScore signals
44
45
  `;
45
46
  var ROUTE_FIELDS = `
46
47
  id name status shipmentId driverId vehicleId waypoints estimatedDistance
@@ -56,24 +57,21 @@ var WAREHOUSE_FIELDS = `
56
57
  totalCapacity usedCapacity ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
57
58
  `;
58
59
  var INVENTORY_ITEM_FIELDS = `
59
- id productId warehouseId locationId onHand available allocated damaged
60
+ id cargoItemId warehouseId locationId onHand available allocated damaged
60
61
  reorderPoint safetyStock unitCost ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
61
62
  `;
62
63
  var INVENTORY_TRANSACTION_FIELDS = `
63
- id transactionNumber type productId warehouseId inventoryItemId quantity
64
+ id transactionNumber type cargoItemId warehouseId inventoryItemId quantity
64
65
  unitCost referenceType referenceId notes ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
65
66
  `;
67
+ var MARKETPLACE_AUDIT_FIELDS = `workspaceId createdBy onBehalfOf updatedBy createdAt updatedAt deletedAt`;
66
68
  var SERVICE_OFFERING_FIELDS = `
67
- id name providerId category description price currency availability
68
- ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
69
+ id providerId name description category price currency pricingUnit transitDays
70
+ availability isActive ${MARKETPLACE_AUDIT_FIELDS}
69
71
  `;
70
72
  var SERVICE_PROVIDER_FIELDS = `
71
- id name type description isActive isVerified rating services contactInfo
72
- ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
73
- `;
74
- var REPORT_FIELDS = `
75
- id name type status description configuration schedule lastGenerated
76
- ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
73
+ id name type description rating contactInfo services serviceAreas isVerified isActive
74
+ offeringsCount ${MARKETPLACE_AUDIT_FIELDS}
77
75
  `;
78
76
  var GET_CUSTOMER = `
79
77
  query MovethewheelsGetCustomer($id: ID!) {
@@ -170,76 +168,84 @@ var DELETE_VEHICLE = `
170
168
  deleteVehicle(id: $id)
171
169
  }
172
170
  `;
173
- var GET_PRODUCT = `
174
- query MovethewheelsGetProduct($id: ID!) {
175
- product(id: $id) { ${PRODUCT_FIELDS} }
171
+ var GET_CARGO_ITEM = `
172
+ query MovethewheelsGetCargoItem($id: ID!) {
173
+ cargoItem(id: $id) { ${CARGO_ITEM_FIELDS} }
176
174
  }
177
175
  `;
178
- var LIST_PRODUCTS = `
179
- query MovethewheelsListProducts($filter: ProductFilterInput, $pagination: PaginationInput) {
180
- products(filter: $filter, pagination: $pagination) { ${PRODUCT_FIELDS} }
176
+ var LIST_CARGO_ITEMS = `
177
+ query MovethewheelsListCargoItems($filter: CargoItemFilterInput, $pagination: PaginationInput) {
178
+ cargoItems(filter: $filter, pagination: $pagination) { ${CARGO_ITEM_FIELDS} }
181
179
  }
182
180
  `;
183
- var CREATE_PRODUCT = `
184
- mutation MovethewheelsCreateProduct($input: CreateProductInput!) {
185
- createProduct(input: $input) { ${PRODUCT_FIELDS} }
181
+ var CREATE_CARGO_ITEM = `
182
+ mutation MovethewheelsCreateCargoItem($input: CreateCargoItemInput!) {
183
+ createCargoItem(input: $input) { ${CARGO_ITEM_FIELDS} }
186
184
  }
187
185
  `;
188
- var UPDATE_PRODUCT = `
189
- mutation MovethewheelsUpdateProduct($id: ID!, $input: UpdateProductInput!) {
190
- updateProduct(id: $id, input: $input) { ${PRODUCT_FIELDS} }
186
+ var UPDATE_CARGO_ITEM = `
187
+ mutation MovethewheelsUpdateCargoItem($id: ID!, $input: UpdateCargoItemInput!) {
188
+ updateCargoItem(id: $id, input: $input) { ${CARGO_ITEM_FIELDS} }
191
189
  }
192
190
  `;
193
- var DELETE_PRODUCT = `
194
- mutation MovethewheelsDeleteProduct($id: ID!) {
195
- deleteProduct(id: $id)
191
+ var DELETE_CARGO_ITEM = `
192
+ mutation MovethewheelsDeleteCargoItem($id: ID!) {
193
+ deleteCargoItem(id: $id)
196
194
  }
197
195
  `;
198
- var GET_ORDER = `
199
- query MovethewheelsGetOrder($id: ID!) {
200
- movethewheelsOrder(id: $id) {
201
- ${ORDER_FIELDS}
196
+ var GET_DELIVERY_JOB = `
197
+ query MovethewheelsGetDeliveryJob($id: ID!) {
198
+ deliveryJob(id: $id) {
199
+ ${DELIVERY_JOB_FIELDS}
202
200
  customer { id name email phone }
203
201
  driver { id firstName lastName status }
204
202
  vehicle { id vehicleNumber type status }
203
+ route { id name status }
205
204
  shipment { id shipmentNumber status }
206
- statusHistory { ${ORDER_STATUS_HISTORY_FIELDS} }
205
+ statusHistory { ${DELIVERY_JOB_STATUS_HISTORY_FIELDS} }
207
206
  }
208
207
  }
209
208
  `;
210
- var LIST_ORDERS = `
211
- query MovethewheelsListOrders($filter: OrderFilterInput, $pagination: PaginationInput) {
212
- movethewheelsOrders(filter: $filter, pagination: $pagination) { ${ORDER_FIELDS} }
209
+ var LIST_DELIVERY_JOBS = `
210
+ query MovethewheelsListDeliveryJobs(
211
+ $filter: DeliveryJobFilterInput
212
+ $pagination: PaginationInput
213
+ ) {
214
+ deliveryJobs(filter: $filter, pagination: $pagination) { ${DELIVERY_JOB_FIELDS} }
213
215
  }
214
216
  `;
215
- var CREATE_ORDER = `
216
- mutation MovethewheelsCreateOrder($input: CreateOrderInput!) {
217
- createMovethewheelsOrder(input: $input) { ${ORDER_FIELDS} }
217
+ var CREATE_DELIVERY_JOB = `
218
+ mutation MovethewheelsCreateDeliveryJob($input: CreateDeliveryJobInput!) {
219
+ createDeliveryJob(input: $input) { ${DELIVERY_JOB_FIELDS} }
218
220
  }
219
221
  `;
220
- var UPDATE_ORDER = `
221
- mutation MovethewheelsUpdateOrder($id: ID!, $input: UpdateOrderInput!) {
222
- updateMovethewheelsOrder(id: $id, input: $input) { ${ORDER_FIELDS} }
222
+ var UPDATE_DELIVERY_JOB = `
223
+ mutation MovethewheelsUpdateDeliveryJob($id: ID!, $input: UpdateDeliveryJobInput!) {
224
+ updateDeliveryJob(id: $id, input: $input) { ${DELIVERY_JOB_FIELDS} }
223
225
  }
224
226
  `;
225
- var UPDATE_ORDER_STATUS = `
226
- mutation MovethewheelsUpdateOrderStatus($id: ID!, $input: UpdateOrderStatusInput!) {
227
- updateMovethewheelsOrderStatus(id: $id, input: $input) {
228
- ${ORDER_FIELDS}
229
- statusHistory { ${ORDER_STATUS_HISTORY_FIELDS} }
227
+ var UPDATE_DELIVERY_JOB_STATUS = `
228
+ mutation MovethewheelsUpdateDeliveryJobStatus(
229
+ $id: ID!
230
+ $input: UpdateDeliveryJobStatusInput!
231
+ ) {
232
+ updateDeliveryJobStatus(id: $id, input: $input) {
233
+ ${DELIVERY_JOB_FIELDS}
234
+ statusHistory { ${DELIVERY_JOB_STATUS_HISTORY_FIELDS} }
230
235
  }
231
236
  }
232
237
  `;
233
- var DELETE_ORDER = `
234
- mutation MovethewheelsDeleteOrder($id: ID!) {
235
- deleteMovethewheelsOrder(id: $id)
238
+ var DELETE_DELIVERY_JOB = `
239
+ mutation MovethewheelsDeleteDeliveryJob($id: ID!) {
240
+ deleteDeliveryJob(id: $id)
236
241
  }
237
242
  `;
238
243
  var GET_SHIPMENT = `
239
244
  query MovethewheelsGetShipment($id: ID!) {
240
245
  shipment(id: $id) {
241
246
  ${SHIPMENT_FIELDS}
242
- order { id orderNumber status }
247
+ deliveryJob { id deliveryJobNumber status }
248
+ serviceProvider { id name type isVerified isActive }
243
249
  trackingEvents { ${TRACKING_EVENT_FIELDS} }
244
250
  }
245
251
  }
@@ -269,9 +275,11 @@ var DELETE_SHIPMENT = `
269
275
  deleteShipment(id: $id)
270
276
  }
271
277
  `;
272
- var GET_ORDER_TRACKING = `
273
- query MovethewheelsOrderTracking($orderId: ID!, $pagination: PaginationInput) {
274
- orderTracking(orderId: $orderId, pagination: $pagination) { ${TRACKING_EVENT_FIELDS} }
278
+ var GET_DELIVERY_JOB_TRACKING = `
279
+ query MovethewheelsDeliveryJobTracking($deliveryJobId: ID!, $pagination: PaginationInput) {
280
+ deliveryJobTracking(deliveryJobId: $deliveryJobId, pagination: $pagination) {
281
+ ${TRACKING_EVENT_FIELDS}
282
+ }
275
283
  }
276
284
  `;
277
285
  var GET_SHIPMENT_TRACKING = `
@@ -366,7 +374,7 @@ var GET_INVENTORY_ITEM = `
366
374
  query MovethewheelsGetInventoryItem($id: ID!) {
367
375
  inventoryItem(id: $id) {
368
376
  ${INVENTORY_ITEM_FIELDS}
369
- product { id name sku }
377
+ cargoItem { id name sku }
370
378
  warehouse { id name code }
371
379
  location { id locationCode }
372
380
  }
@@ -413,6 +421,14 @@ var ADJUST_INVENTORY_STOCK = `
413
421
  adjustInventoryStock(input: $input) { ${INVENTORY_ITEM_FIELDS} }
414
422
  }
415
423
  `;
424
+ var TRANSFER_INVENTORY_STOCK = `
425
+ mutation MovethewheelsTransferInventoryStock($input: TransferInventoryStockInput!) {
426
+ transferInventoryStock(input: $input) {
427
+ source { ${INVENTORY_ITEM_FIELDS} }
428
+ destination { ${INVENTORY_ITEM_FIELDS} }
429
+ }
430
+ }
431
+ `;
416
432
  var DELETE_INVENTORY_ITEM = `
417
433
  mutation MovethewheelsDeleteInventoryItem($id: ID!) {
418
434
  deleteInventoryItem(id: $id)
@@ -433,19 +449,19 @@ var GET_SERVICE_PROVIDER = `
433
449
  `;
434
450
  var LIST_SERVICE_PROVIDERS = `
435
451
  query MovethewheelsListServiceProviders(
436
- $filter: ServiceProviderFilterInput
452
+ $filter: MtwServiceProviderFilterInput
437
453
  $pagination: PaginationInput
438
454
  ) {
439
455
  serviceProviders(filter: $filter, pagination: $pagination) { ${SERVICE_PROVIDER_FIELDS} }
440
456
  }
441
457
  `;
442
458
  var CREATE_SERVICE_PROVIDER = `
443
- mutation MovethewheelsCreateServiceProvider($input: CreateServiceProviderInput!) {
459
+ mutation MovethewheelsCreateServiceProvider($input: MtwCreateServiceProviderInput!) {
444
460
  createServiceProvider(input: $input) { ${SERVICE_PROVIDER_FIELDS} }
445
461
  }
446
462
  `;
447
463
  var UPDATE_SERVICE_PROVIDER = `
448
- mutation MovethewheelsUpdateServiceProvider($id: ID!, $input: UpdateServiceProviderInput!) {
464
+ mutation MovethewheelsUpdateServiceProvider($id: ID!, $input: MtwUpdateServiceProviderInput!) {
449
465
  updateServiceProvider(id: $id, input: $input) { ${SERVICE_PROVIDER_FIELDS} }
450
466
  }
451
467
  `;
@@ -458,25 +474,28 @@ var GET_SERVICE_OFFERING = `
458
474
  query MovethewheelsGetServiceOffering($id: ID!) {
459
475
  serviceOffering(id: $id) {
460
476
  ${SERVICE_OFFERING_FIELDS}
461
- provider { id name type }
477
+ provider { id name type isVerified isActive }
462
478
  }
463
479
  }
464
480
  `;
465
481
  var LIST_SERVICE_OFFERINGS = `
466
482
  query MovethewheelsListServiceOfferings(
467
- $filter: ServiceOfferingFilterInput
483
+ $filter: MtwServiceOfferingFilterInput
468
484
  $pagination: PaginationInput
469
485
  ) {
470
- serviceOfferings(filter: $filter, pagination: $pagination) { ${SERVICE_OFFERING_FIELDS} }
486
+ serviceOfferings(filter: $filter, pagination: $pagination) {
487
+ ${SERVICE_OFFERING_FIELDS}
488
+ provider { id name type isVerified }
489
+ }
471
490
  }
472
491
  `;
473
492
  var CREATE_SERVICE_OFFERING = `
474
- mutation MovethewheelsCreateServiceOffering($input: CreateServiceOfferingInput!) {
493
+ mutation MovethewheelsCreateServiceOffering($input: MtwCreateServiceOfferingInput!) {
475
494
  createServiceOffering(input: $input) { ${SERVICE_OFFERING_FIELDS} }
476
495
  }
477
496
  `;
478
497
  var UPDATE_SERVICE_OFFERING = `
479
- mutation MovethewheelsUpdateServiceOffering($id: ID!, $input: UpdateServiceOfferingInput!) {
498
+ mutation MovethewheelsUpdateServiceOffering($id: ID!, $input: MtwUpdateServiceOfferingInput!) {
480
499
  updateServiceOffering(id: $id, input: $input) { ${SERVICE_OFFERING_FIELDS} }
481
500
  }
482
501
  `;
@@ -485,65 +504,19 @@ var DELETE_SERVICE_OFFERING = `
485
504
  deleteServiceOffering(id: $id)
486
505
  }
487
506
  `;
488
- var GET_REPORT = `
489
- query MovethewheelsGetReport($id: ID!) {
490
- movethewheelsReport(id: $id) { ${REPORT_FIELDS} }
491
- }
492
- `;
493
- var LIST_REPORTS = `
494
- query MovethewheelsListReports(
495
- $filter: MovethewheelsReportFilterInput
496
- $pagination: PaginationInput
497
- ) {
498
- movethewheelsReports(filter: $filter, pagination: $pagination) { ${REPORT_FIELDS} }
499
- }
500
- `;
501
- var CREATE_REPORT = `
502
- mutation MovethewheelsCreateReport($input: CreateMovethewheelsReportInput!) {
503
- createMovethewheelsReport(input: $input) { ${REPORT_FIELDS} }
507
+ var MARKETPLACE_STATS = `
508
+ query MovethewheelsMarketplaceStats {
509
+ marketplaceStats { providers verifiedProviders activeProviders offerings avgRating }
504
510
  }
505
511
  `;
506
- var UPDATE_REPORT = `
507
- mutation MovethewheelsUpdateReport($id: ID!, $input: UpdateMovethewheelsReportInput!) {
508
- updateMovethewheelsReport(id: $id, input: $input) { ${REPORT_FIELDS} }
509
- }
510
- `;
511
- var DELETE_REPORT = `
512
- mutation MovethewheelsDeleteReport($id: ID!) {
513
- deleteMovethewheelsReport(id: $id)
514
- }
515
- `;
516
- var GENERATE_REPORT = `
517
- mutation MovethewheelsGenerateReport($input: GenerateMovethewheelsReportInput!) {
518
- generateMovethewheelsReport(input: $input) {
519
- generatedAt
520
- result
521
- report { ${REPORT_FIELDS} }
512
+ var ASSIGN_SHIPMENT_SERVICE_PROVIDER = `
513
+ mutation MovethewheelsAssignShipmentServiceProvider($shipmentId: ID!, $providerId: ID) {
514
+ assignShipmentServiceProvider(shipmentId: $shipmentId, providerId: $providerId) {
515
+ id shipmentNumber status carrierId
516
+ serviceProvider { id name type isVerified isActive deletedAt }
522
517
  }
523
518
  }
524
519
  `;
525
- var GET_MODULE_SETTINGS = `
526
- query MovethewheelsModuleSettings {
527
- moduleSettings { workspaceId preferences updatedAt }
528
- }
529
- `;
530
- var UPDATE_MODULE_SETTINGS = `
531
- mutation MovethewheelsUpdateModuleSettings(
532
- $input: UpdateMovethewheelsModuleSettingsInput!
533
- ) {
534
- updateModuleSettings(input: $input) { workspaceId preferences updatedAt }
535
- }
536
- `;
537
- var EXPORT_DATA = `
538
- mutation MovethewheelsExportData($input: MovethewheelsExportDataInput!) {
539
- exportData(input: $input) { success message payload }
540
- }
541
- `;
542
- var IMPORT_DATA = `
543
- mutation MovethewheelsImportData($input: MovethewheelsImportDataInput!) {
544
- importData(input: $input) { success message payload }
545
- }
546
- `;
547
520
  var GET_ANALYTICS = `
548
521
  query MovethewheelsAnalytics {
549
522
  analytics {
@@ -556,19 +529,33 @@ var GET_ANALYTICS = `
556
529
  var GET_DASHBOARD_METRICS = `
557
530
  query MovethewheelsDashboardMetrics {
558
531
  dashboardMetrics {
559
- totalOrders
532
+ totalDeliveryJobs
560
533
  activeDeliveries
561
534
  activeVehicles
562
535
  availableDrivers
563
536
  lowStockItems
564
537
  totalRevenue
565
- recentOrders { id orderNumber status priority createdAt }
538
+ onTimeDeliveryRate
539
+ customerSatisfaction
540
+ recentDeliveryJobs { id deliveryJobNumber status priority createdAt }
566
541
  }
567
542
  }
568
543
  `;
569
- var GET_ORDER_STATS = `
570
- query MovethewheelsOrderStats {
571
- orderStats { total pending inTransit delivered cancelled failed }
544
+ var GET_DELIVERY_JOB_STATS = `
545
+ query MovethewheelsDeliveryJobStats {
546
+ deliveryJobStats {
547
+ total
548
+ pending
549
+ confirmed
550
+ assigned
551
+ pickedUp
552
+ inTransit
553
+ outForDelivery
554
+ delivered
555
+ cancelled
556
+ failed
557
+ returned
558
+ }
572
559
  }
573
560
  `;
574
561
  var GET_FLEET_STATS = `
@@ -581,6 +568,7 @@ var GET_FLEET_STATS = `
581
568
  totalDrivers
582
569
  availableDrivers
583
570
  onDeliveryDrivers
571
+ avgDriverRating
584
572
  }
585
573
  }
586
574
  `;
@@ -595,8 +583,8 @@ var GET_FINANCE_METRICS = `
595
583
  `;
596
584
  var DriverStatusEnum = z.enum(["AVAILABLE", "INACTIVE", "OFF_DUTY", "ON_BREAK", "ON_DELIVERY"]).describe("Availability/duty status of a driver");
597
585
  var InventoryTransactionTypeEnum = z.enum(["ADJUSTMENT", "ISSUE", "RECEIPT", "RETURN", "TRANSFER"]).describe("Type of inventory ledger movement");
598
- var OrderPriorityEnum = z.enum(["CRITICAL", "HIGH", "LOW", "MEDIUM", "URGENT"]).describe("Fulfilment priority of an order");
599
- var OrderStatusEnum = z.enum([
586
+ var DeliveryPriorityEnum = z.enum(["CRITICAL", "HIGH", "LOW", "MEDIUM", "URGENT"]).describe("Dispatch priority of a delivery job");
587
+ var DeliveryJobStatusEnum = z.enum([
600
588
  "ASSIGNED",
601
589
  "CANCELLED",
602
590
  "CONFIRMED",
@@ -607,8 +595,7 @@ var OrderStatusEnum = z.enum([
607
595
  "PENDING",
608
596
  "PICKED_UP",
609
597
  "RETURNED"
610
- ]).describe("Fulfilment status of an order");
611
- var OrderTypeEnum = z.enum(["B2B", "B2C", "MARKETPLACE", "SUBSCRIPTION"]).describe("Commercial type of an order");
598
+ ]).describe("Lifecycle status of a delivery job");
612
599
  var RouteStatusEnum = z.enum(["CANCELLED", "COMPLETED", "IN_PROGRESS", "PLANNED"]).describe("Lifecycle status of a route");
613
600
  var ShipmentStatusEnum = z.enum(["DELIVERED", "FAILED", "IN_TRANSIT", "PICKED_UP", "PLANNED", "RETURNED"]).describe("Lifecycle status of a shipment");
614
601
  var TrackingEventTypeEnum = z.enum([
@@ -634,6 +621,32 @@ var VehicleTypeEnum = z.enum([
634
621
  "VAN"
635
622
  ]).describe("Class of vehicle in the fleet");
636
623
  var WarehouseTypeEnum = z.enum(["COLD_STORAGE", "CROSS_DOCK", "DISTRIBUTION", "FULFILLMENT", "RETAIL"]).describe("Type of warehouse facility");
624
+ var ServiceProviderTypeEnum = z.enum([
625
+ "CARRIER",
626
+ "FREIGHT_FORWARDER",
627
+ "THIRD_PARTY_LOGISTICS",
628
+ "WAREHOUSE",
629
+ "CUSTOMS_BROKER",
630
+ "LAST_MILE",
631
+ "COURIER",
632
+ "OTHER"
633
+ ]).describe("Kind of marketplace service provider");
634
+ var ServiceOfferingCategoryEnum = z.enum([
635
+ "FULL_TRUCKLOAD",
636
+ "LESS_THAN_TRUCKLOAD",
637
+ "LAST_MILE",
638
+ "EXPRESS",
639
+ "OCEAN_FREIGHT",
640
+ "AIR_FREIGHT",
641
+ "RAIL_FREIGHT",
642
+ "WAREHOUSING",
643
+ "CUSTOMS_CLEARANCE",
644
+ "COLD_CHAIN",
645
+ "OTHER"
646
+ ]).describe("What a marketplace service offering provides");
647
+ var ServiceAvailabilityEnum = z.enum(["AVAILABLE", "LIMITED", "UNAVAILABLE"]).describe("Whether the provider currently has capacity for an offering");
648
+ var IsoDateTime = z.string().datetime({ offset: true }).describe("ISO 8601 date-time, e.g. 2026-10-31T09:30:00Z");
649
+ var StockQuantity = z.number().int().min(0).max(2147483647);
637
650
  var JsonObject = z.record(z.string(), z.unknown());
638
651
  var JsonValue = z.union([JsonObject, z.array(z.unknown())]);
639
652
 
@@ -862,7 +875,7 @@ function registerDriverTools(server, ctx, track) {
862
875
  status: DriverStatusEnum.optional().describe("Initial status (default AVAILABLE)"),
863
876
  licenseNumber: z.string().optional().describe("Driving license number"),
864
877
  licenseClass: z.string().optional().describe("Driving license class"),
865
- licenseExpiry: z.string().optional().describe("License expiry (ISO 8601 DateTime)"),
878
+ licenseExpiry: IsoDateTime.optional().describe("License expiry (ISO 8601 date-time)"),
866
879
  certifications: JsonObject.optional().describe("Certifications JSON"),
867
880
  currentLocation: JsonObject.optional().describe("Current location JSON ({ lat, lng })"),
868
881
  performanceMetrics: JsonObject.optional().describe("Performance metrics JSON"),
@@ -926,7 +939,9 @@ function registerDriverTools(server, ctx, track) {
926
939
  status: DriverStatusEnum.optional().describe("Updated status"),
927
940
  licenseNumber: z.string().optional().describe("Updated license number"),
928
941
  licenseClass: z.string().optional().describe("Updated license class"),
929
- licenseExpiry: z.string().optional().describe("Updated license expiry (ISO 8601)"),
942
+ licenseExpiry: IsoDateTime.optional().describe(
943
+ "Updated license expiry (ISO 8601 date-time)"
944
+ ),
930
945
  certifications: JsonObject.optional().describe("Updated certifications JSON"),
931
946
  currentLocation: JsonObject.optional().describe("Updated location JSON"),
932
947
  performanceMetrics: JsonObject.optional().describe("Updated performance metrics JSON"),
@@ -1284,23 +1299,23 @@ function registerVehicleTools(server, ctx, track) {
1284
1299
  }
1285
1300
  );
1286
1301
  }
1287
- function registerProductTools(server, ctx, track) {
1302
+ function registerCargoTools(server, ctx, track) {
1288
1303
  server.registerTool(
1289
1304
  track(mcpToolName(ctx.productName, "cargo_get")),
1290
1305
  {
1291
- title: "Get Product",
1292
- description: "Fetch a single product (cargo SKU) by ID.",
1293
- inputSchema: { id: z.string().describe("Product ID") }
1306
+ title: "Get Cargo Item",
1307
+ description: "Fetch a single cargo item (cargo SKU) by ID.",
1308
+ inputSchema: { id: z.string().describe("Cargo item ID") }
1294
1309
  },
1295
1310
  async ({ id }) => {
1296
1311
  try {
1297
- const data = await ctx.gql.workspace.request(GET_PRODUCT, { id });
1298
- if (!data.product) return errorResult(`Product ${id} not found`);
1299
- return jsonResult(data.product);
1312
+ const data = await ctx.gql.workspace.request(GET_CARGO_ITEM, { id });
1313
+ if (!data.cargoItem) return errorResult(`Cargo item ${id} not found`);
1314
+ return jsonResult(data.cargoItem);
1300
1315
  } catch (error) {
1301
1316
  ctx.logger.error("movethewheels cargo_get failed", { error: String(error) });
1302
1317
  return errorResult(
1303
- `Failed to get product: ${error instanceof Error ? error.message : String(error)}`
1318
+ `Failed to get cargo item: ${error instanceof Error ? error.message : String(error)}`
1304
1319
  );
1305
1320
  }
1306
1321
  }
@@ -1308,8 +1323,8 @@ function registerProductTools(server, ctx, track) {
1308
1323
  server.registerTool(
1309
1324
  track(mcpToolName(ctx.productName, "cargo_list")),
1310
1325
  {
1311
- title: "List Products",
1312
- description: "List products with optional category/sku/text filters and pagination.",
1326
+ title: "List Cargo Items",
1327
+ description: "List cargo items with optional category/sku/text filters and pagination.",
1313
1328
  inputSchema: {
1314
1329
  search: z.string().optional().describe("Free-text search across name/description"),
1315
1330
  category: z.string().optional().describe("Filter by category"),
@@ -1324,15 +1339,15 @@ function registerProductTools(server, ctx, track) {
1324
1339
  if (search !== void 0) filter.search = search;
1325
1340
  if (category !== void 0) filter.category = category;
1326
1341
  if (sku !== void 0) filter.sku = sku;
1327
- const data = await ctx.gql.workspace.request(LIST_PRODUCTS, {
1342
+ const data = await ctx.gql.workspace.request(LIST_CARGO_ITEMS, {
1328
1343
  filter: Object.keys(filter).length > 0 ? filter : void 0,
1329
1344
  pagination: { limit: limit ?? 50, offset: offset ?? 0 }
1330
1345
  });
1331
- return jsonResult(data.products);
1346
+ return jsonResult(data.cargoItems);
1332
1347
  } catch (error) {
1333
1348
  ctx.logger.error("movethewheels cargo_list failed", { error: String(error) });
1334
1349
  return errorResult(
1335
- `Failed to list products: ${error instanceof Error ? error.message : String(error)}`
1350
+ `Failed to list cargo items: ${error instanceof Error ? error.message : String(error)}`
1336
1351
  );
1337
1352
  }
1338
1353
  }
@@ -1340,10 +1355,10 @@ function registerProductTools(server, ctx, track) {
1340
1355
  server.registerTool(
1341
1356
  track(mcpToolName(ctx.productName, "cargo_create")),
1342
1357
  {
1343
- title: "Create Product",
1344
- description: "Create a product (cargo SKU). `name` and `sku` are required.",
1358
+ title: "Create Cargo Item",
1359
+ description: "Create a cargo item (cargo SKU). `name` and `sku` are required; `sku` must be unique in the workspace.",
1345
1360
  inputSchema: {
1346
- name: z.string().min(1).describe("Product name"),
1361
+ name: z.string().min(1).describe("Cargo item name"),
1347
1362
  sku: z.string().min(1).describe("Stock-keeping unit (unique)"),
1348
1363
  description: z.string().optional().describe("Description"),
1349
1364
  category: z.string().optional().describe("Category"),
@@ -1382,12 +1397,12 @@ function registerProductTools(server, ctx, track) {
1382
1397
  if (temperatureControlled !== void 0) {
1383
1398
  input.temperatureControlled = temperatureControlled;
1384
1399
  }
1385
- const data = await ctx.gql.workspace.request(CREATE_PRODUCT, { input });
1386
- return jsonResult(data.createProduct);
1400
+ const data = await ctx.gql.workspace.request(CREATE_CARGO_ITEM, { input });
1401
+ return jsonResult(data.createCargoItem);
1387
1402
  } catch (error) {
1388
1403
  ctx.logger.error("movethewheels cargo_create failed", { error: String(error) });
1389
1404
  return errorResult(
1390
- `Failed to create product: ${error instanceof Error ? error.message : String(error)}`
1405
+ `Failed to create cargo item: ${error instanceof Error ? error.message : String(error)}`
1391
1406
  );
1392
1407
  }
1393
1408
  }
@@ -1395,10 +1410,10 @@ function registerProductTools(server, ctx, track) {
1395
1410
  server.registerTool(
1396
1411
  track(mcpToolName(ctx.productName, "cargo_update")),
1397
1412
  {
1398
- title: "Update Product",
1399
- description: "Update a product. At least one mutable field must be provided.",
1413
+ title: "Update Cargo Item",
1414
+ description: "Update a cargo item. At least one mutable field must be provided.",
1400
1415
  inputSchema: {
1401
- id: z.string().describe("Product ID"),
1416
+ id: z.string().describe("Cargo item ID"),
1402
1417
  name: z.string().optional().describe("Updated name"),
1403
1418
  sku: z.string().optional().describe("Updated SKU"),
1404
1419
  description: z.string().optional().describe("Updated description"),
@@ -1444,12 +1459,12 @@ function registerProductTools(server, ctx, track) {
1444
1459
  if (Object.keys(input).length === 0) {
1445
1460
  return errorResult("No updates specified \u2014 provide at least one mutable field.");
1446
1461
  }
1447
- const data = await ctx.gql.workspace.request(UPDATE_PRODUCT, { id, input });
1448
- return jsonResult(data.updateProduct);
1462
+ const data = await ctx.gql.workspace.request(UPDATE_CARGO_ITEM, { id, input });
1463
+ return jsonResult(data.updateCargoItem);
1449
1464
  } catch (error) {
1450
1465
  ctx.logger.error("movethewheels cargo_update failed", { error: String(error) });
1451
1466
  return errorResult(
1452
- `Failed to update product: ${error instanceof Error ? error.message : String(error)}`
1467
+ `Failed to update cargo item: ${error instanceof Error ? error.message : String(error)}`
1453
1468
  );
1454
1469
  }
1455
1470
  }
@@ -1457,62 +1472,63 @@ function registerProductTools(server, ctx, track) {
1457
1472
  server.registerTool(
1458
1473
  track(mcpToolName(ctx.productName, "cargo_delete")),
1459
1474
  {
1460
- title: "Delete Product",
1461
- description: "Soft-delete a product by ID.",
1462
- inputSchema: { id: z.string().describe("Product ID") }
1475
+ title: "Delete Cargo Item",
1476
+ description: "Soft-delete a cargo item by ID.",
1477
+ inputSchema: { id: z.string().describe("Cargo item ID") }
1463
1478
  },
1464
1479
  async ({ id }) => {
1465
1480
  try {
1466
1481
  const data = await ctx.gql.workspace.request(
1467
- DELETE_PRODUCT,
1482
+ DELETE_CARGO_ITEM,
1468
1483
  { id }
1469
1484
  );
1470
- return jsonResult({ deleted: data.deleteProduct, id });
1485
+ return jsonResult({ deleted: data.deleteCargoItem, id });
1471
1486
  } catch (error) {
1472
1487
  ctx.logger.error("movethewheels cargo_delete failed", { error: String(error) });
1473
1488
  return errorResult(
1474
- `Failed to delete product: ${error instanceof Error ? error.message : String(error)}`
1489
+ `Failed to delete cargo item: ${error instanceof Error ? error.message : String(error)}`
1475
1490
  );
1476
1491
  }
1477
1492
  }
1478
1493
  );
1479
1494
  }
1480
- function registerOrderTools(server, ctx, track) {
1495
+ var errorMessage = (error) => error instanceof Error ? error.message : String(error);
1496
+ function registerDeliveryJobTools(server, ctx, track) {
1481
1497
  server.registerTool(
1482
- track(mcpToolName(ctx.productName, "orders_get")),
1498
+ track(mcpToolName(ctx.productName, "delivery_jobs_get")),
1483
1499
  {
1484
- title: "Get Order",
1485
- description: "Fetch a single delivery order by ID, including customer/driver/vehicle/shipment links and status history.",
1486
- inputSchema: { id: z.string().describe("Order ID") }
1500
+ title: "Get Delivery Job",
1501
+ description: "Fetch a single delivery job by ID, including its customer, driver, vehicle, route and shipment links and its status history.",
1502
+ inputSchema: { id: z.string().describe("Delivery job ID") }
1487
1503
  },
1488
1504
  async ({ id }) => {
1489
1505
  try {
1490
- const data = await ctx.gql.workspace.request(GET_ORDER, { id });
1491
- if (!data.movethewheelsOrder) return errorResult(`Order ${id} not found`);
1492
- return jsonResult(data.movethewheelsOrder);
1506
+ const data = await ctx.gql.workspace.request(GET_DELIVERY_JOB, { id });
1507
+ if (!data.deliveryJob) return errorResult(`Delivery job ${id} not found`);
1508
+ return jsonResult(data.deliveryJob);
1493
1509
  } catch (error) {
1494
- ctx.logger.error("movethewheels orders_get failed", { error: String(error) });
1495
- return errorResult(
1496
- `Failed to get order: ${error instanceof Error ? error.message : String(error)}`
1497
- );
1510
+ ctx.logger.error("movethewheels delivery_jobs_get failed", { error: String(error) });
1511
+ return errorResult(`Failed to get delivery job: ${errorMessage(error)}`);
1498
1512
  }
1499
1513
  }
1500
1514
  );
1501
1515
  server.registerTool(
1502
- track(mcpToolName(ctx.productName, "orders_list")),
1516
+ track(mcpToolName(ctx.productName, "delivery_jobs_list")),
1503
1517
  {
1504
- title: "List Orders",
1505
- description: "List delivery orders with optional customer/driver/vehicle/type/priority/status/text filters and pagination.",
1518
+ title: "List Delivery Jobs",
1519
+ description: "List delivery jobs with optional customer/driver/vehicle/route/store-order/priority/status/text filters and pagination. Set `unassigned` to true to find jobs with no driver yet.",
1506
1520
  inputSchema: {
1507
- search: z.string().optional().describe("Free-text search across orderNumber"),
1521
+ search: z.string().optional().describe("Free-text search across deliveryJobNumber"),
1508
1522
  customerId: z.string().optional().describe("Filter by customer ID"),
1509
1523
  driverId: z.string().optional().describe("Filter by driver ID"),
1510
1524
  vehicleId: z.string().optional().describe("Filter by vehicle ID"),
1511
- orderType: OrderTypeEnum.optional().describe("Filter by order type"),
1512
- priority: OrderPriorityEnum.optional().describe("Filter by priority"),
1513
- status: OrderStatusEnum.optional().describe("Filter by status"),
1514
- limit: z.number().int().optional().describe("Page size (default 50)"),
1515
- offset: z.number().int().optional().describe("Pagination offset (default 0)")
1525
+ routeId: z.string().optional().describe("Filter by route ID"),
1526
+ storeOrderId: z.string().optional().describe("Filter by global-store order ID"),
1527
+ priority: DeliveryPriorityEnum.optional().describe("Filter by priority"),
1528
+ status: DeliveryJobStatusEnum.optional().describe("Filter by status"),
1529
+ unassigned: z.boolean().optional().describe("Only jobs with no driver assigned"),
1530
+ limit: z.number().int().min(1).max(100).optional().describe("Page size (default 50)"),
1531
+ offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
1516
1532
  }
1517
1533
  },
1518
1534
  async ({
@@ -1520,9 +1536,11 @@ function registerOrderTools(server, ctx, track) {
1520
1536
  customerId,
1521
1537
  driverId,
1522
1538
  vehicleId,
1523
- orderType,
1539
+ routeId,
1540
+ storeOrderId,
1524
1541
  priority,
1525
1542
  status,
1543
+ unassigned,
1526
1544
  limit,
1527
1545
  offset
1528
1546
  }) => {
@@ -1532,55 +1550,61 @@ function registerOrderTools(server, ctx, track) {
1532
1550
  if (customerId !== void 0) filter.customerId = customerId;
1533
1551
  if (driverId !== void 0) filter.driverId = driverId;
1534
1552
  if (vehicleId !== void 0) filter.vehicleId = vehicleId;
1535
- if (orderType !== void 0) filter.orderType = orderType;
1553
+ if (routeId !== void 0) filter.routeId = routeId;
1554
+ if (storeOrderId !== void 0) filter.storeOrderId = storeOrderId;
1536
1555
  if (priority !== void 0) filter.priority = priority;
1537
1556
  if (status !== void 0) filter.status = status;
1538
- const data = await ctx.gql.workspace.request(LIST_ORDERS, {
1557
+ if (unassigned !== void 0) filter.unassigned = unassigned;
1558
+ const data = await ctx.gql.workspace.request(LIST_DELIVERY_JOBS, {
1539
1559
  filter: Object.keys(filter).length > 0 ? filter : void 0,
1540
1560
  pagination: { limit: limit ?? 50, offset: offset ?? 0 }
1541
1561
  });
1542
- return jsonResult(data.movethewheelsOrders);
1562
+ return jsonResult(data.deliveryJobs);
1543
1563
  } catch (error) {
1544
- ctx.logger.error("movethewheels orders_list failed", { error: String(error) });
1545
- return errorResult(
1546
- `Failed to list orders: ${error instanceof Error ? error.message : String(error)}`
1547
- );
1564
+ ctx.logger.error("movethewheels delivery_jobs_list failed", { error: String(error) });
1565
+ return errorResult(`Failed to list delivery jobs: ${errorMessage(error)}`);
1548
1566
  }
1549
1567
  }
1550
1568
  );
1551
1569
  server.registerTool(
1552
- track(mcpToolName(ctx.productName, "orders_create")),
1570
+ track(mcpToolName(ctx.productName, "delivery_jobs_create")),
1553
1571
  {
1554
- title: "Create Order",
1555
- description: "Create a delivery order. `customerId`, `orderNumber`, `pickupAddress`, `deliveryAddress`, and `items` are required. `orderType` defaults to B2C, `priority` to MEDIUM, `status` to PENDING.",
1572
+ title: "Create Delivery Job",
1573
+ description: "Create a delivery job. `customerId`, `deliveryJobNumber`, `pickupAddress`, `deliveryAddress` and `cargoItems` are required. `priority` defaults to MEDIUM and `status` to PENDING.",
1556
1574
  inputSchema: {
1557
- customerId: z.string().min(1).describe("Ordering customer ID"),
1558
- orderNumber: z.string().min(1).describe("Human-readable order number (unique)"),
1575
+ customerId: z.string().min(1).describe("Customer the job is delivered for"),
1576
+ deliveryJobNumber: z.string().min(1).describe("Human-readable delivery job number (unique in the workspace)"),
1559
1577
  pickupAddress: JsonObject.describe("Pickup address JSON"),
1560
1578
  deliveryAddress: JsonObject.describe("Delivery address JSON"),
1561
- items: JsonValue.describe("Order items JSON (array of line items)"),
1562
- orderType: OrderTypeEnum.optional().describe("Order type (default B2C)"),
1563
- priority: OrderPriorityEnum.optional().describe("Priority (default MEDIUM)"),
1564
- status: OrderStatusEnum.optional().describe("Initial status (default PENDING)"),
1579
+ cargoItems: JsonValue.describe(
1580
+ "Cargo carried by the job (JSON, usually an array of { cargoItemId or sku, quantity })"
1581
+ ),
1582
+ priority: DeliveryPriorityEnum.optional().describe("Priority (default MEDIUM)"),
1583
+ status: DeliveryJobStatusEnum.optional().describe("Initial status (default PENDING)"),
1565
1584
  driverId: z.string().optional().describe("Assigned driver ID"),
1566
1585
  vehicleId: z.string().optional().describe("Assigned vehicle ID"),
1586
+ routeId: z.string().optional().describe("Route the job runs on"),
1587
+ storeOrderId: z.string().optional().describe("Global-store order this job fulfils, when it came from checkout"),
1567
1588
  pricing: JsonObject.optional().describe("Pricing breakdown JSON"),
1568
- scheduledDelivery: z.string().optional().describe("Scheduled delivery (ISO 8601 DateTime)"),
1589
+ scheduledDelivery: IsoDateTime.optional().describe(
1590
+ "Scheduled delivery (ISO 8601 date-time)"
1591
+ ),
1569
1592
  specialInstructions: z.string().optional().describe("Special handling instructions"),
1570
1593
  trackingNumber: z.string().optional().describe("Tracking number")
1571
1594
  }
1572
1595
  },
1573
1596
  async ({
1574
1597
  customerId,
1575
- orderNumber,
1598
+ deliveryJobNumber,
1576
1599
  pickupAddress,
1577
1600
  deliveryAddress,
1578
- items,
1579
- orderType,
1601
+ cargoItems,
1580
1602
  priority,
1581
1603
  status,
1582
1604
  driverId,
1583
1605
  vehicleId,
1606
+ routeId,
1607
+ storeOrderId,
1584
1608
  pricing,
1585
1609
  scheduledDelivery,
1586
1610
  specialInstructions,
@@ -1589,48 +1613,49 @@ function registerOrderTools(server, ctx, track) {
1589
1613
  try {
1590
1614
  const input = {
1591
1615
  customerId,
1592
- orderNumber,
1616
+ deliveryJobNumber,
1593
1617
  pickupAddress,
1594
1618
  deliveryAddress,
1595
- items
1619
+ cargoItems
1596
1620
  };
1597
- if (orderType !== void 0) input.orderType = orderType;
1598
1621
  if (priority !== void 0) input.priority = priority;
1599
1622
  if (status !== void 0) input.status = status;
1600
1623
  if (driverId !== void 0) input.driverId = driverId;
1601
1624
  if (vehicleId !== void 0) input.vehicleId = vehicleId;
1625
+ if (routeId !== void 0) input.routeId = routeId;
1626
+ if (storeOrderId !== void 0) input.storeOrderId = storeOrderId;
1602
1627
  if (pricing !== void 0) input.pricing = pricing;
1603
1628
  if (scheduledDelivery !== void 0) input.scheduledDelivery = scheduledDelivery;
1604
1629
  if (specialInstructions !== void 0) input.specialInstructions = specialInstructions;
1605
1630
  if (trackingNumber !== void 0) input.trackingNumber = trackingNumber;
1606
- const data = await ctx.gql.workspace.request(CREATE_ORDER, { input });
1607
- return jsonResult(data.createMovethewheelsOrder);
1631
+ const data = await ctx.gql.workspace.request(CREATE_DELIVERY_JOB, { input });
1632
+ return jsonResult(data.createDeliveryJob);
1608
1633
  } catch (error) {
1609
- ctx.logger.error("movethewheels orders_create failed", { error: String(error) });
1610
- return errorResult(
1611
- `Failed to create order: ${error instanceof Error ? error.message : String(error)}`
1612
- );
1634
+ ctx.logger.error("movethewheels delivery_jobs_create failed", { error: String(error) });
1635
+ return errorResult(`Failed to create delivery job: ${errorMessage(error)}`);
1613
1636
  }
1614
1637
  }
1615
1638
  );
1616
1639
  server.registerTool(
1617
- track(mcpToolName(ctx.productName, "orders_update")),
1640
+ track(mcpToolName(ctx.productName, "delivery_jobs_update")),
1618
1641
  {
1619
- title: "Update Order",
1620
- description: "Update a delivery order. At least one mutable field must be provided.",
1642
+ title: "Update Delivery Job",
1643
+ description: "Update a delivery job (assignment, addresses, cargo, schedule). At least one mutable field must be provided. Use delivery_jobs_update_status to move it through its lifecycle so the change is recorded in the status history.",
1621
1644
  inputSchema: {
1622
- id: z.string().describe("Order ID"),
1645
+ id: z.string().describe("Delivery job ID"),
1623
1646
  customerId: z.string().optional().describe("Updated customer ID"),
1624
1647
  driverId: z.string().optional().describe("Updated driver ID"),
1625
1648
  vehicleId: z.string().optional().describe("Updated vehicle ID"),
1626
- orderType: OrderTypeEnum.optional().describe("Updated order type"),
1627
- priority: OrderPriorityEnum.optional().describe("Updated priority"),
1628
- status: OrderStatusEnum.optional().describe("Updated status"),
1649
+ routeId: z.string().optional().describe("Updated route ID"),
1650
+ storeOrderId: z.string().optional().describe("Updated global-store order ID"),
1651
+ priority: DeliveryPriorityEnum.optional().describe("Updated priority"),
1629
1652
  pickupAddress: JsonObject.optional().describe("Updated pickup address JSON"),
1630
1653
  deliveryAddress: JsonObject.optional().describe("Updated delivery address JSON"),
1631
- items: JsonValue.optional().describe("Updated items JSON"),
1654
+ cargoItems: JsonValue.optional().describe("Updated cargo JSON"),
1632
1655
  pricing: JsonObject.optional().describe("Updated pricing JSON"),
1633
- scheduledDelivery: z.string().optional().describe("Updated scheduled delivery (ISO 8601)"),
1656
+ scheduledDelivery: IsoDateTime.optional().describe(
1657
+ "Updated scheduled delivery (ISO 8601 date-time)"
1658
+ ),
1634
1659
  specialInstructions: z.string().optional().describe("Updated special instructions"),
1635
1660
  trackingNumber: z.string().optional().describe("Updated tracking number")
1636
1661
  }
@@ -1640,12 +1665,12 @@ function registerOrderTools(server, ctx, track) {
1640
1665
  customerId,
1641
1666
  driverId,
1642
1667
  vehicleId,
1643
- orderType,
1668
+ routeId,
1669
+ storeOrderId,
1644
1670
  priority,
1645
- status,
1646
1671
  pickupAddress,
1647
1672
  deliveryAddress,
1648
- items,
1673
+ cargoItems,
1649
1674
  pricing,
1650
1675
  scheduledDelivery,
1651
1676
  specialInstructions,
@@ -1656,12 +1681,12 @@ function registerOrderTools(server, ctx, track) {
1656
1681
  if (customerId !== void 0) input.customerId = customerId;
1657
1682
  if (driverId !== void 0) input.driverId = driverId;
1658
1683
  if (vehicleId !== void 0) input.vehicleId = vehicleId;
1659
- if (orderType !== void 0) input.orderType = orderType;
1684
+ if (routeId !== void 0) input.routeId = routeId;
1685
+ if (storeOrderId !== void 0) input.storeOrderId = storeOrderId;
1660
1686
  if (priority !== void 0) input.priority = priority;
1661
- if (status !== void 0) input.status = status;
1662
1687
  if (pickupAddress !== void 0) input.pickupAddress = pickupAddress;
1663
1688
  if (deliveryAddress !== void 0) input.deliveryAddress = deliveryAddress;
1664
- if (items !== void 0) input.items = items;
1689
+ if (cargoItems !== void 0) input.cargoItems = cargoItems;
1665
1690
  if (pricing !== void 0) input.pricing = pricing;
1666
1691
  if (scheduledDelivery !== void 0) input.scheduledDelivery = scheduledDelivery;
1667
1692
  if (specialInstructions !== void 0) input.specialInstructions = specialInstructions;
@@ -1669,26 +1694,24 @@ function registerOrderTools(server, ctx, track) {
1669
1694
  if (Object.keys(input).length === 0) {
1670
1695
  return errorResult("No updates specified \u2014 provide at least one mutable field.");
1671
1696
  }
1672
- const data = await ctx.gql.workspace.request(UPDATE_ORDER, { id, input });
1673
- return jsonResult(data.updateMovethewheelsOrder);
1697
+ const data = await ctx.gql.workspace.request(UPDATE_DELIVERY_JOB, { id, input });
1698
+ return jsonResult(data.updateDeliveryJob);
1674
1699
  } catch (error) {
1675
- ctx.logger.error("movethewheels orders_update failed", { error: String(error) });
1676
- return errorResult(
1677
- `Failed to update order: ${error instanceof Error ? error.message : String(error)}`
1678
- );
1700
+ ctx.logger.error("movethewheels delivery_jobs_update failed", { error: String(error) });
1701
+ return errorResult(`Failed to update delivery job: ${errorMessage(error)}`);
1679
1702
  }
1680
1703
  }
1681
1704
  );
1682
1705
  server.registerTool(
1683
- track(mcpToolName(ctx.productName, "orders_update_status")),
1706
+ track(mcpToolName(ctx.productName, "delivery_jobs_update_status")),
1684
1707
  {
1685
- title: "Update Order Status",
1686
- description: "Advance an order through its delivery lifecycle (e.g. PENDING \u2192 CONFIRMED \u2192 ASSIGNED \u2192 PICKED_UP \u2192 IN_TRANSIT \u2192 OUT_FOR_DELIVERY \u2192 DELIVERED, or CANCELLED/FAILED/RETURNED). Records a status-history entry.",
1708
+ title: "Update Delivery Job Status",
1709
+ description: "Advance a delivery job through its lifecycle (PENDING \u2192 CONFIRMED \u2192 ASSIGNED \u2192 PICKED_UP \u2192 IN_TRANSIT \u2192 OUT_FOR_DELIVERY \u2192 DELIVERED, or CANCELLED / FAILED / RETURNED). Records a status-history entry.",
1687
1710
  inputSchema: {
1688
- id: z.string().describe("Order ID"),
1689
- status: OrderStatusEnum.describe("New order status"),
1711
+ id: z.string().describe("Delivery job ID"),
1712
+ status: DeliveryJobStatusEnum.describe("New delivery job status"),
1690
1713
  notes: z.string().optional().describe("Status-change notes"),
1691
- location: JsonObject.optional().describe("Location JSON at time of status change")
1714
+ location: JsonObject.optional().describe("Location JSON at the time of the change")
1692
1715
  }
1693
1716
  },
1694
1717
  async ({ id, status, notes, location }) => {
@@ -1696,35 +1719,33 @@ function registerOrderTools(server, ctx, track) {
1696
1719
  const input = { status };
1697
1720
  if (notes !== void 0) input.notes = notes;
1698
1721
  if (location !== void 0) input.location = location;
1699
- const data = await ctx.gql.workspace.request(UPDATE_ORDER_STATUS, { id, input });
1700
- return jsonResult(data.updateMovethewheelsOrderStatus);
1722
+ const data = await ctx.gql.workspace.request(UPDATE_DELIVERY_JOB_STATUS, { id, input });
1723
+ return jsonResult(data.updateDeliveryJobStatus);
1701
1724
  } catch (error) {
1702
- ctx.logger.error("movethewheels orders_update_status failed", { error: String(error) });
1703
- return errorResult(
1704
- `Failed to update order status: ${error instanceof Error ? error.message : String(error)}`
1705
- );
1725
+ ctx.logger.error("movethewheels delivery_jobs_update_status failed", {
1726
+ error: String(error)
1727
+ });
1728
+ return errorResult(`Failed to update delivery job status: ${errorMessage(error)}`);
1706
1729
  }
1707
1730
  }
1708
1731
  );
1709
1732
  server.registerTool(
1710
- track(mcpToolName(ctx.productName, "orders_delete")),
1733
+ track(mcpToolName(ctx.productName, "delivery_jobs_delete")),
1711
1734
  {
1712
- title: "Delete Order",
1713
- description: "Soft-delete a delivery order by ID.",
1714
- inputSchema: { id: z.string().describe("Order ID") }
1735
+ title: "Delete Delivery Job",
1736
+ description: "Soft-delete a delivery job by ID.",
1737
+ inputSchema: { id: z.string().describe("Delivery job ID") }
1715
1738
  },
1716
1739
  async ({ id }) => {
1717
1740
  try {
1718
1741
  const data = await ctx.gql.workspace.request(
1719
- DELETE_ORDER,
1742
+ DELETE_DELIVERY_JOB,
1720
1743
  { id }
1721
1744
  );
1722
- return jsonResult({ deleted: data.deleteMovethewheelsOrder, id });
1745
+ return jsonResult({ deleted: data.deleteDeliveryJob, id });
1723
1746
  } catch (error) {
1724
- ctx.logger.error("movethewheels orders_delete failed", { error: String(error) });
1725
- return errorResult(
1726
- `Failed to delete order: ${error instanceof Error ? error.message : String(error)}`
1727
- );
1747
+ ctx.logger.error("movethewheels delivery_jobs_delete failed", { error: String(error) });
1748
+ return errorResult(`Failed to delete delivery job: ${errorMessage(error)}`);
1728
1749
  }
1729
1750
  }
1730
1751
  );
@@ -1734,7 +1755,7 @@ function registerShipmentTools(server, ctx, track) {
1734
1755
  track(mcpToolName(ctx.productName, "shipments_get")),
1735
1756
  {
1736
1757
  title: "Get Shipment",
1737
- description: "Fetch a single shipment by ID, including its linked order and tracking events.",
1758
+ description: "Fetch a single shipment by ID, including its delivery job, marketplace carrier and tracking events.",
1738
1759
  inputSchema: { id: z.string().describe("Shipment ID") }
1739
1760
  },
1740
1761
  async ({ id }) => {
@@ -1754,24 +1775,38 @@ function registerShipmentTools(server, ctx, track) {
1754
1775
  track(mcpToolName(ctx.productName, "shipments_list")),
1755
1776
  {
1756
1777
  title: "List Shipments",
1757
- description: "List shipments with optional order/customer/carrier/status/text filters and pagination.",
1778
+ description: "List shipments with optional delivery-job/customer/carrier/driver/vehicle/status/text filters and pagination.",
1758
1779
  inputSchema: {
1759
1780
  search: z.string().optional().describe("Free-text search across shipmentNumber"),
1760
- orderId: z.string().optional().describe("Filter by order ID"),
1781
+ deliveryJobId: z.string().optional().describe("Filter by delivery job ID"),
1761
1782
  customerId: z.string().optional().describe("Filter by customer ID"),
1762
1783
  carrierId: z.string().optional().describe("Filter by carrier ID"),
1784
+ driverId: z.string().optional().describe("Filter by assigned driver ID"),
1785
+ vehicleId: z.string().optional().describe("Filter by assigned vehicle ID"),
1763
1786
  status: ShipmentStatusEnum.optional().describe("Filter by shipment status"),
1764
1787
  limit: z.number().int().optional().describe("Page size (default 50)"),
1765
1788
  offset: z.number().int().optional().describe("Pagination offset (default 0)")
1766
1789
  }
1767
1790
  },
1768
- async ({ search, orderId, customerId, carrierId, status, limit, offset }) => {
1791
+ async ({
1792
+ search,
1793
+ deliveryJobId,
1794
+ customerId,
1795
+ carrierId,
1796
+ driverId,
1797
+ vehicleId,
1798
+ status,
1799
+ limit,
1800
+ offset
1801
+ }) => {
1769
1802
  try {
1770
1803
  const filter = {};
1771
1804
  if (search !== void 0) filter.search = search;
1772
- if (orderId !== void 0) filter.orderId = orderId;
1805
+ if (deliveryJobId !== void 0) filter.deliveryJobId = deliveryJobId;
1773
1806
  if (customerId !== void 0) filter.customerId = customerId;
1774
1807
  if (carrierId !== void 0) filter.carrierId = carrierId;
1808
+ if (driverId !== void 0) filter.driverId = driverId;
1809
+ if (vehicleId !== void 0) filter.vehicleId = vehicleId;
1775
1810
  if (status !== void 0) filter.status = status;
1776
1811
  const data = await ctx.gql.workspace.request(LIST_SHIPMENTS, {
1777
1812
  filter: Object.keys(filter).length > 0 ? filter : void 0,
@@ -1816,27 +1851,31 @@ function registerShipmentTools(server, ctx, track) {
1816
1851
  track(mcpToolName(ctx.productName, "shipments_create")),
1817
1852
  {
1818
1853
  title: "Create Shipment",
1819
- description: "Create a shipment for an order. `orderId`, `shipmentNumber`, `origin`, and `destination` are required. `status` defaults to PLANNED.",
1854
+ description: "Create a shipment. `shipmentNumber`, `origin`, and `destination` are required; link it to the delivery job it carries with `deliveryJobId`. `status` defaults to PLANNED.",
1820
1855
  inputSchema: {
1821
- orderId: z.string().min(1).describe("Source order ID"),
1822
1856
  shipmentNumber: z.string().min(1).describe("Human-readable shipment number (unique)"),
1823
1857
  origin: JsonObject.describe("Origin address JSON"),
1824
1858
  destination: JsonObject.describe("Destination address JSON"),
1825
1859
  status: ShipmentStatusEnum.optional().describe("Initial status (default PLANNED)"),
1860
+ deliveryJobId: z.string().optional().describe("Delivery job this shipment carries"),
1861
+ storeOrderId: z.string().optional().describe("Global-store order this shipment fulfils"),
1826
1862
  customerId: z.string().optional().describe("Customer ID"),
1827
1863
  carrierId: z.string().optional().describe("Carrier ID"),
1828
1864
  trackingNumber: z.string().optional().describe("Carrier tracking number"),
1829
1865
  cargoDetails: JsonObject.optional().describe("Cargo details JSON"),
1830
- estimatedDelivery: z.string().optional().describe("Estimated delivery (ISO 8601 DateTime)"),
1831
- actualDelivery: z.string().optional().describe("Actual delivery (ISO 8601 DateTime)")
1866
+ estimatedDelivery: IsoDateTime.optional().describe(
1867
+ "Estimated delivery (ISO 8601 date-time)"
1868
+ ),
1869
+ actualDelivery: IsoDateTime.optional().describe("Actual delivery (ISO 8601 date-time)")
1832
1870
  }
1833
1871
  },
1834
1872
  async ({
1835
- orderId,
1836
1873
  shipmentNumber,
1837
1874
  origin,
1838
1875
  destination,
1839
1876
  status,
1877
+ deliveryJobId,
1878
+ storeOrderId,
1840
1879
  customerId,
1841
1880
  carrierId,
1842
1881
  trackingNumber,
@@ -1845,8 +1884,10 @@ function registerShipmentTools(server, ctx, track) {
1845
1884
  actualDelivery
1846
1885
  }) => {
1847
1886
  try {
1848
- const input = { orderId, shipmentNumber, origin, destination };
1887
+ const input = { shipmentNumber, origin, destination };
1849
1888
  if (status !== void 0) input.status = status;
1889
+ if (deliveryJobId !== void 0) input.deliveryJobId = deliveryJobId;
1890
+ if (storeOrderId !== void 0) input.storeOrderId = storeOrderId;
1850
1891
  if (customerId !== void 0) input.customerId = customerId;
1851
1892
  if (carrierId !== void 0) input.carrierId = carrierId;
1852
1893
  if (trackingNumber !== void 0) input.trackingNumber = trackingNumber;
@@ -1871,19 +1912,31 @@ function registerShipmentTools(server, ctx, track) {
1871
1912
  inputSchema: {
1872
1913
  id: z.string().describe("Shipment ID"),
1873
1914
  status: ShipmentStatusEnum.optional().describe("Updated status"),
1915
+ statusReason: z.string().optional().describe("Why the status changed (kept with the status decision)"),
1916
+ expectedStatusRevision: z.number().int().min(0).optional().describe(
1917
+ "statusRevision you last read; the update is refused if the shipment changed since"
1918
+ ),
1919
+ deliveryJobId: z.string().optional().describe("Updated delivery job ID"),
1874
1920
  customerId: z.string().optional().describe("Updated customer ID"),
1875
1921
  carrierId: z.string().optional().describe("Updated carrier ID"),
1876
1922
  origin: JsonObject.optional().describe("Updated origin JSON"),
1877
1923
  destination: JsonObject.optional().describe("Updated destination JSON"),
1878
1924
  trackingNumber: z.string().optional().describe("Updated tracking number"),
1879
1925
  cargoDetails: JsonObject.optional().describe("Updated cargo details JSON"),
1880
- estimatedDelivery: z.string().optional().describe("Updated estimated delivery (ISO 8601)"),
1881
- actualDelivery: z.string().optional().describe("Updated actual delivery (ISO 8601)")
1926
+ estimatedDelivery: IsoDateTime.optional().describe(
1927
+ "Updated estimated delivery (ISO 8601 date-time)"
1928
+ ),
1929
+ actualDelivery: IsoDateTime.optional().describe(
1930
+ "Updated actual delivery (ISO 8601 date-time)"
1931
+ )
1882
1932
  }
1883
1933
  },
1884
1934
  async ({
1885
1935
  id,
1886
1936
  status,
1937
+ statusReason,
1938
+ expectedStatusRevision,
1939
+ deliveryJobId,
1887
1940
  customerId,
1888
1941
  carrierId,
1889
1942
  origin,
@@ -1896,6 +1949,11 @@ function registerShipmentTools(server, ctx, track) {
1896
1949
  try {
1897
1950
  const input = {};
1898
1951
  if (status !== void 0) input.status = status;
1952
+ if (statusReason !== void 0) input.statusReason = statusReason;
1953
+ if (expectedStatusRevision !== void 0) {
1954
+ input.expectedStatusRevision = expectedStatusRevision;
1955
+ }
1956
+ if (deliveryJobId !== void 0) input.deliveryJobId = deliveryJobId;
1899
1957
  if (customerId !== void 0) input.customerId = customerId;
1900
1958
  if (carrierId !== void 0) input.carrierId = carrierId;
1901
1959
  if (origin !== void 0) input.origin = origin;
@@ -1942,27 +2000,29 @@ function registerShipmentTools(server, ctx, track) {
1942
2000
  }
1943
2001
  function registerTrackingTools(server, ctx, track) {
1944
2002
  server.registerTool(
1945
- track(mcpToolName(ctx.productName, "tracking_order_events")),
2003
+ track(mcpToolName(ctx.productName, "tracking_delivery_job_events")),
1946
2004
  {
1947
- title: "Order Tracking Timeline",
1948
- description: "List tracking events for an order (across its shipments), most recent first.",
2005
+ title: "Delivery Job Tracking Timeline",
2006
+ description: "List tracking events for a delivery job (across its shipments), most recent first.",
1949
2007
  inputSchema: {
1950
- orderId: z.string().describe("Order ID"),
2008
+ deliveryJobId: z.string().describe("Delivery job ID"),
1951
2009
  limit: z.number().int().optional().describe("Page size (default 50)"),
1952
2010
  offset: z.number().int().optional().describe("Pagination offset (default 0)")
1953
2011
  }
1954
2012
  },
1955
- async ({ orderId, limit, offset }) => {
2013
+ async ({ deliveryJobId, limit, offset }) => {
1956
2014
  try {
1957
- const data = await ctx.gql.workspace.request(GET_ORDER_TRACKING, {
1958
- orderId,
2015
+ const data = await ctx.gql.workspace.request(GET_DELIVERY_JOB_TRACKING, {
2016
+ deliveryJobId,
1959
2017
  pagination: { limit: limit ?? 50, offset: offset ?? 0 }
1960
2018
  });
1961
- return jsonResult(data.orderTracking);
2019
+ return jsonResult(data.deliveryJobTracking);
1962
2020
  } catch (error) {
1963
- ctx.logger.error("movethewheels tracking_order_events failed", { error: String(error) });
2021
+ ctx.logger.error("movethewheels tracking_delivery_job_events failed", {
2022
+ error: String(error)
2023
+ });
1964
2024
  return errorResult(
1965
- `Failed to get order tracking: ${error instanceof Error ? error.message : String(error)}`
2025
+ `Failed to get delivery job tracking: ${error instanceof Error ? error.message : String(error)}`
1966
2026
  );
1967
2027
  }
1968
2028
  }
@@ -1997,7 +2057,7 @@ function registerTrackingTools(server, ctx, track) {
1997
2057
  track(mcpToolName(ctx.productName, "tracking_alerts")),
1998
2058
  {
1999
2059
  title: "Tracking Alerts",
2000
- description: "List active tracking alerts (delayed / exception shipments needing attention).",
2060
+ description: "List tracking alerts: DELAYED once a promised delivery has passed, AT_RISK when the forecast predicts the promise will be missed (with riskScore and signals).",
2001
2061
  inputSchema: {
2002
2062
  limit: z.number().int().optional().describe("Page size (default 50)"),
2003
2063
  offset: z.number().int().optional().describe("Pagination offset (default 0)")
@@ -2027,7 +2087,7 @@ function registerTrackingTools(server, ctx, track) {
2027
2087
  eventType: TrackingEventTypeEnum.describe("Type of tracking event"),
2028
2088
  details: z.string().optional().describe("Free-text event details"),
2029
2089
  location: JsonObject.optional().describe("Location JSON ({ lat, lng, address })"),
2030
- timestamp: z.string().optional().describe("Event timestamp (ISO 8601; defaults to now)")
2090
+ timestamp: IsoDateTime.optional().describe("Event timestamp (ISO 8601; defaults to now)")
2031
2091
  }
2032
2092
  },
2033
2093
  async ({ shipmentId, eventType, details, location, timestamp }) => {
@@ -2541,7 +2601,7 @@ function registerInventoryTools(server, ctx, track) {
2541
2601
  track(mcpToolName(ctx.productName, "inventory_get_item")),
2542
2602
  {
2543
2603
  title: "Get Inventory Item",
2544
- description: "Fetch a single inventory item by ID, including its product, warehouse, and location.",
2604
+ description: "Fetch a single inventory item by ID, including its cargo item, warehouse, and location.",
2545
2605
  inputSchema: { id: z.string().describe("Inventory item ID") }
2546
2606
  },
2547
2607
  async ({ id }) => {
@@ -2561,23 +2621,25 @@ function registerInventoryTools(server, ctx, track) {
2561
2621
  track(mcpToolName(ctx.productName, "inventory_list_items")),
2562
2622
  {
2563
2623
  title: "List Inventory Items",
2564
- description: "List inventory items with optional product/warehouse/location/text filters and pagination.",
2624
+ description: "List inventory items with optional cargo-item/warehouse/location/text filters and pagination. Set `lowStock` to true to list only items at or below their reorder point.",
2565
2625
  inputSchema: {
2566
2626
  search: z.string().optional().describe("Free-text search"),
2567
- productId: z.string().optional().describe("Filter by product ID"),
2627
+ cargoItemId: z.string().optional().describe("Filter by cargo item ID"),
2568
2628
  warehouseId: z.string().optional().describe("Filter by warehouse ID"),
2569
2629
  locationId: z.string().optional().describe("Filter by location ID"),
2630
+ lowStock: z.boolean().optional().describe("Only items at or below their reorder point"),
2570
2631
  limit: z.number().int().optional().describe("Page size (default 50)"),
2571
2632
  offset: z.number().int().optional().describe("Pagination offset (default 0)")
2572
2633
  }
2573
2634
  },
2574
- async ({ search, productId, warehouseId, locationId, limit, offset }) => {
2635
+ async ({ search, cargoItemId, warehouseId, locationId, lowStock, limit, offset }) => {
2575
2636
  try {
2576
2637
  const filter = {};
2577
2638
  if (search !== void 0) filter.search = search;
2578
- if (productId !== void 0) filter.productId = productId;
2639
+ if (cargoItemId !== void 0) filter.cargoItemId = cargoItemId;
2579
2640
  if (warehouseId !== void 0) filter.warehouseId = warehouseId;
2580
2641
  if (locationId !== void 0) filter.locationId = locationId;
2642
+ if (lowStock !== void 0) filter.lowStock = lowStock;
2581
2643
  const data = await ctx.gql.workspace.request(LIST_INVENTORY_ITEMS, {
2582
2644
  filter: Object.keys(filter).length > 0 ? filter : void 0,
2583
2645
  pagination: { limit: limit ?? 50, offset: offset ?? 0 }
@@ -2614,23 +2676,25 @@ function registerInventoryTools(server, ctx, track) {
2614
2676
  track(mcpToolName(ctx.productName, "inventory_list_transactions")),
2615
2677
  {
2616
2678
  title: "List Inventory Transactions",
2617
- description: "List inventory ledger transactions (receipts/issues/transfers/adjustments/returns) with optional product/warehouse/location/text filters.",
2679
+ description: "List inventory ledger transactions (receipts/issues/transfers/adjustments/returns) with optional cargo-item/warehouse/location/inventory-item/text filters.",
2618
2680
  inputSchema: {
2619
2681
  search: z.string().optional().describe("Free-text search"),
2620
- productId: z.string().optional().describe("Filter by product ID"),
2682
+ cargoItemId: z.string().optional().describe("Filter by cargo item ID"),
2621
2683
  warehouseId: z.string().optional().describe("Filter by warehouse ID"),
2622
2684
  locationId: z.string().optional().describe("Filter by location ID"),
2685
+ inventoryItemId: z.string().optional().describe("Filter by inventory item ID"),
2623
2686
  limit: z.number().int().optional().describe("Page size (default 50)"),
2624
2687
  offset: z.number().int().optional().describe("Pagination offset (default 0)")
2625
2688
  }
2626
2689
  },
2627
- async ({ search, productId, warehouseId, locationId, limit, offset }) => {
2690
+ async ({ search, cargoItemId, warehouseId, locationId, inventoryItemId, limit, offset }) => {
2628
2691
  try {
2629
2692
  const filter = {};
2630
2693
  if (search !== void 0) filter.search = search;
2631
- if (productId !== void 0) filter.productId = productId;
2694
+ if (cargoItemId !== void 0) filter.cargoItemId = cargoItemId;
2632
2695
  if (warehouseId !== void 0) filter.warehouseId = warehouseId;
2633
2696
  if (locationId !== void 0) filter.locationId = locationId;
2697
+ if (inventoryItemId !== void 0) filter.inventoryItemId = inventoryItemId;
2634
2698
  const data = await ctx.gql.workspace.request(LIST_INVENTORY_TRANSACTIONS, {
2635
2699
  filter: Object.keys(filter).length > 0 ? filter : void 0,
2636
2700
  pagination: { limit: limit ?? 50, offset: offset ?? 0 }
@@ -2650,22 +2714,22 @@ function registerInventoryTools(server, ctx, track) {
2650
2714
  track(mcpToolName(ctx.productName, "inventory_create_item")),
2651
2715
  {
2652
2716
  title: "Create Inventory Item",
2653
- description: "Create an inventory item for a product at a warehouse. `productId` and `warehouseId` are required; stock counts default to 0.",
2717
+ description: "Create an inventory item for a cargo item at a warehouse. `cargoItemId` and `warehouseId` are required; stock counts default to 0 and must satisfy available + allocated + damaged = onHand.",
2654
2718
  inputSchema: {
2655
- productId: z.string().min(1).describe("Product ID"),
2719
+ cargoItemId: z.string().min(1).describe("Cargo item ID"),
2656
2720
  warehouseId: z.string().min(1).describe("Warehouse ID"),
2657
2721
  locationId: z.string().optional().describe("Storage location ID"),
2658
- onHand: z.number().int().optional().describe("On-hand quantity (default 0)"),
2659
- available: z.number().int().optional().describe("Available quantity (default 0)"),
2660
- allocated: z.number().int().optional().describe("Allocated quantity (default 0)"),
2661
- damaged: z.number().int().optional().describe("Damaged quantity (default 0)"),
2662
- reorderPoint: z.number().int().optional().describe("Reorder point"),
2663
- safetyStock: z.number().int().optional().describe("Safety stock"),
2664
- unitCost: z.number().optional().describe("Unit cost")
2722
+ onHand: StockQuantity.optional().describe("On-hand quantity (default 0)"),
2723
+ available: StockQuantity.optional().describe("Available quantity (default 0)"),
2724
+ allocated: StockQuantity.optional().describe("Allocated quantity (default 0)"),
2725
+ damaged: StockQuantity.optional().describe("Damaged quantity (default 0)"),
2726
+ reorderPoint: StockQuantity.optional().describe("Reorder point"),
2727
+ safetyStock: StockQuantity.optional().describe("Safety stock"),
2728
+ unitCost: z.number().nonnegative().optional().describe("Unit cost")
2665
2729
  }
2666
2730
  },
2667
2731
  async ({
2668
- productId,
2732
+ cargoItemId,
2669
2733
  warehouseId,
2670
2734
  locationId,
2671
2735
  onHand,
@@ -2677,7 +2741,7 @@ function registerInventoryTools(server, ctx, track) {
2677
2741
  unitCost
2678
2742
  }) => {
2679
2743
  try {
2680
- const input = { productId, warehouseId };
2744
+ const input = { cargoItemId, warehouseId };
2681
2745
  if (locationId !== void 0) input.locationId = locationId;
2682
2746
  if (onHand !== void 0) input.onHand = onHand;
2683
2747
  if (available !== void 0) input.available = available;
@@ -2686,6 +2750,17 @@ function registerInventoryTools(server, ctx, track) {
2686
2750
  if (reorderPoint !== void 0) input.reorderPoint = reorderPoint;
2687
2751
  if (safetyStock !== void 0) input.safetyStock = safetyStock;
2688
2752
  if (unitCost !== void 0) input.unitCost = unitCost;
2753
+ const counts = {
2754
+ onHand: onHand ?? 0,
2755
+ available: available ?? 0,
2756
+ allocated: allocated ?? 0,
2757
+ damaged: damaged ?? 0
2758
+ };
2759
+ if (counts.available + counts.allocated + counts.damaged !== counts.onHand) {
2760
+ return errorResult(
2761
+ `Stock counts do not balance: available (${counts.available}) + allocated (${counts.allocated}) + damaged (${counts.damaged}) must equal onHand (${counts.onHand}).`
2762
+ );
2763
+ }
2689
2764
  const data = await ctx.gql.workspace.request(CREATE_INVENTORY_ITEM, { input });
2690
2765
  return jsonResult(data.createInventoryItem);
2691
2766
  } catch (error) {
@@ -2700,17 +2775,17 @@ function registerInventoryTools(server, ctx, track) {
2700
2775
  track(mcpToolName(ctx.productName, "inventory_update_item")),
2701
2776
  {
2702
2777
  title: "Update Inventory Item",
2703
- description: "Update an inventory item. At least one mutable field must be provided.",
2778
+ description: "Update an inventory item. At least one mutable field must be provided. Counts left out keep their current value, and the result must satisfy available + allocated + damaged = onHand. A stocked line cannot be moved to another location; use inventory_transfer_stock.",
2704
2779
  inputSchema: {
2705
2780
  id: z.string().describe("Inventory item ID"),
2706
2781
  locationId: z.string().optional().describe("Updated location ID"),
2707
- onHand: z.number().int().optional().describe("Updated on-hand quantity"),
2708
- available: z.number().int().optional().describe("Updated available quantity"),
2709
- allocated: z.number().int().optional().describe("Updated allocated quantity"),
2710
- damaged: z.number().int().optional().describe("Updated damaged quantity"),
2711
- reorderPoint: z.number().int().optional().describe("Updated reorder point"),
2712
- safetyStock: z.number().int().optional().describe("Updated safety stock"),
2713
- unitCost: z.number().optional().describe("Updated unit cost")
2782
+ onHand: StockQuantity.optional().describe("Updated on-hand quantity"),
2783
+ available: StockQuantity.optional().describe("Updated available quantity"),
2784
+ allocated: StockQuantity.optional().describe("Updated allocated quantity"),
2785
+ damaged: StockQuantity.optional().describe("Updated damaged quantity"),
2786
+ reorderPoint: StockQuantity.optional().describe("Updated reorder point"),
2787
+ safetyStock: StockQuantity.optional().describe("Updated safety stock"),
2788
+ unitCost: z.number().nonnegative().optional().describe("Updated unit cost")
2714
2789
  }
2715
2790
  },
2716
2791
  async ({
@@ -2751,13 +2826,13 @@ function registerInventoryTools(server, ctx, track) {
2751
2826
  track(mcpToolName(ctx.productName, "inventory_adjust_stock")),
2752
2827
  {
2753
2828
  title: "Adjust Inventory Stock",
2754
- description: "Directly set one or more stock counts (onHand/available/allocated/damaged) for an inventory item. Provide the item id and at least one count.",
2829
+ description: "Directly set one or more stock counts (onHand/available/allocated/damaged) for an inventory item. Provide the item id and at least one count; counts left out keep their current value, and the result must satisfy available + allocated + damaged = onHand. The change is written to the inventory ledger as an ADJUSTMENT.",
2755
2830
  inputSchema: {
2756
2831
  id: z.string().describe("Inventory item ID"),
2757
- onHand: z.number().int().optional().describe("New on-hand quantity"),
2758
- available: z.number().int().optional().describe("New available quantity"),
2759
- allocated: z.number().int().optional().describe("New allocated quantity"),
2760
- damaged: z.number().int().optional().describe("New damaged quantity")
2832
+ onHand: StockQuantity.optional().describe("New on-hand quantity"),
2833
+ available: StockQuantity.optional().describe("New available quantity"),
2834
+ allocated: StockQuantity.optional().describe("New allocated quantity"),
2835
+ damaged: StockQuantity.optional().describe("New damaged quantity")
2761
2836
  }
2762
2837
  },
2763
2838
  async ({ id, onHand, available, allocated, damaged }) => {
@@ -2782,20 +2857,50 @@ function registerInventoryTools(server, ctx, track) {
2782
2857
  }
2783
2858
  }
2784
2859
  );
2860
+ server.registerTool(
2861
+ track(mcpToolName(ctx.productName, "inventory_transfer_stock")),
2862
+ {
2863
+ title: "Transfer Inventory Stock",
2864
+ description: "Move available stock from one inventory item to another of the same cargo item (for example between warehouses or bins). Both sides are updated atomically and the move is recorded as a TRANSFER pair in the ledger. Fails if the source does not have enough available stock.",
2865
+ inputSchema: {
2866
+ sourceInventoryItemId: z.string().min(1).describe("Inventory item to take stock from"),
2867
+ destinationInventoryItemId: z.string().min(1).describe("Inventory item to add stock to"),
2868
+ quantity: z.number().int().min(1).max(2147483647).describe("Units to move (taken from the source available count)")
2869
+ }
2870
+ },
2871
+ async ({ sourceInventoryItemId, destinationInventoryItemId, quantity }) => {
2872
+ if (sourceInventoryItemId === destinationInventoryItemId) {
2873
+ return errorResult("Source and destination inventory items must be different.");
2874
+ }
2875
+ try {
2876
+ const data = await ctx.gql.workspace.request(TRANSFER_INVENTORY_STOCK, {
2877
+ input: { sourceInventoryItemId, destinationInventoryItemId, quantity }
2878
+ });
2879
+ return jsonResult(data.transferInventoryStock);
2880
+ } catch (error) {
2881
+ ctx.logger.error("movethewheels inventory_transfer_stock failed", {
2882
+ error: String(error)
2883
+ });
2884
+ return errorResult(
2885
+ `Failed to transfer inventory stock: ${error instanceof Error ? error.message : String(error)}`
2886
+ );
2887
+ }
2888
+ }
2889
+ );
2785
2890
  server.registerTool(
2786
2891
  track(mcpToolName(ctx.productName, "inventory_create_transaction")),
2787
2892
  {
2788
2893
  title: "Create Inventory Transaction",
2789
- description: "Record an inventory ledger transaction (RECEIPT/ISSUE/TRANSFER/ADJUSTMENT/RETURN). `transactionNumber`, `type`, `productId`, `warehouseId`, and `quantity` are required.",
2894
+ description: "Record an inventory ledger transaction (RECEIPT/ISSUE/TRANSFER/ADJUSTMENT/RETURN). `transactionNumber`, `type`, `cargoItemId`, `warehouseId`, and `quantity` are required.",
2790
2895
  inputSchema: {
2791
2896
  transactionNumber: z.string().min(1).describe("Transaction number (unique)"),
2792
2897
  type: InventoryTransactionTypeEnum.describe("Transaction type"),
2793
- productId: z.string().min(1).describe("Product ID"),
2898
+ cargoItemId: z.string().min(1).describe("Cargo item ID"),
2794
2899
  warehouseId: z.string().min(1).describe("Warehouse ID"),
2795
2900
  quantity: z.number().int().describe("Quantity moved (sign per transaction semantics)"),
2796
2901
  inventoryItemId: z.string().optional().describe("Affected inventory item ID"),
2797
- unitCost: z.number().optional().describe("Unit cost"),
2798
- referenceType: z.string().optional().describe('Reference type, e.g. "order", "shipment"'),
2902
+ unitCost: z.number().nonnegative().optional().describe("Unit cost"),
2903
+ referenceType: z.string().optional().describe('Reference type, e.g. "delivery_job", "shipment"'),
2799
2904
  referenceId: z.string().optional().describe("Reference ID"),
2800
2905
  notes: z.string().optional().describe("Notes")
2801
2906
  }
@@ -2803,7 +2908,7 @@ function registerInventoryTools(server, ctx, track) {
2803
2908
  async ({
2804
2909
  transactionNumber,
2805
2910
  type,
2806
- productId,
2911
+ cargoItemId,
2807
2912
  warehouseId,
2808
2913
  quantity,
2809
2914
  inventoryItemId,
@@ -2816,7 +2921,7 @@ function registerInventoryTools(server, ctx, track) {
2816
2921
  const input = {
2817
2922
  transactionNumber,
2818
2923
  type,
2819
- productId,
2924
+ cargoItemId,
2820
2925
  warehouseId,
2821
2926
  quantity
2822
2927
  };
@@ -2860,12 +2965,28 @@ function registerInventoryTools(server, ctx, track) {
2860
2965
  }
2861
2966
  );
2862
2967
  }
2968
+ var Rating = z.number().min(0).max(5);
2969
+ var Tags = z.array(z.string().min(1));
2970
+ var Currency = z.string().regex(/^[A-Za-z]{3}$/).describe('ISO 4217 currency code, e.g. "INR" or "USD"');
2971
+ function definedOnly(source) {
2972
+ const out = {};
2973
+ for (const [key, value] of Object.entries(source)) {
2974
+ if (value !== void 0) out[key] = value;
2975
+ }
2976
+ return out;
2977
+ }
2978
+ function failure(ctx, tool, action, error) {
2979
+ ctx.logger.error(`movethewheels ${tool} failed`, { error: String(error) });
2980
+ return errorResult(
2981
+ `Failed to ${action}: ${error instanceof Error ? error.message : String(error)}`
2982
+ );
2983
+ }
2863
2984
  function registerMarketplaceTools(server, ctx, track) {
2864
2985
  server.registerTool(
2865
2986
  track(mcpToolName(ctx.productName, "marketplace_get_provider")),
2866
2987
  {
2867
2988
  title: "Get Service Provider",
2868
- description: "Fetch a single logistics service provider by ID, including its offerings.",
2989
+ description: "Fetch a single marketplace service provider by ID, including its offerings.",
2869
2990
  inputSchema: { id: z.string().describe("Service provider ID") }
2870
2991
  },
2871
2992
  async ({ id }) => {
@@ -2874,10 +2995,7 @@ function registerMarketplaceTools(server, ctx, track) {
2874
2995
  if (!data.serviceProvider) return errorResult(`Service provider ${id} not found`);
2875
2996
  return jsonResult(data.serviceProvider);
2876
2997
  } catch (error) {
2877
- ctx.logger.error("movethewheels marketplace_get_provider failed", { error: String(error) });
2878
- return errorResult(
2879
- `Failed to get service provider: ${error instanceof Error ? error.message : String(error)}`
2880
- );
2998
+ return failure(ctx, "marketplace_get_provider", "get service provider", error);
2881
2999
  }
2882
3000
  }
2883
3001
  );
@@ -2885,33 +3003,27 @@ function registerMarketplaceTools(server, ctx, track) {
2885
3003
  track(mcpToolName(ctx.productName, "marketplace_list_providers")),
2886
3004
  {
2887
3005
  title: "List Service Providers",
2888
- description: "List logistics service providers with optional type/active/text filters and pagination.",
3006
+ description: "List marketplace service providers with optional type/verified/active/rating/text filters and pagination.",
2889
3007
  inputSchema: {
2890
- search: z.string().optional().describe("Free-text search across name/description"),
2891
- type: z.string().optional().describe("Filter by provider type"),
3008
+ search: z.string().optional().describe("Case-insensitive match on name, description, services and service areas"),
3009
+ type: ServiceProviderTypeEnum.optional(),
3010
+ isVerified: z.boolean().optional().describe("Only verified (or unverified) providers"),
2892
3011
  isActive: z.boolean().optional().describe("Filter by active flag"),
2893
- limit: z.number().int().optional().describe("Page size (default 50)"),
2894
- offset: z.number().int().optional().describe("Pagination offset (default 0)")
3012
+ minRating: Rating.optional().describe("Only providers rated at least this (0-5)"),
3013
+ limit: z.number().int().positive().optional().describe("Page size (default 50)"),
3014
+ offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
2895
3015
  }
2896
3016
  },
2897
- async ({ search, type, isActive, limit, offset }) => {
3017
+ async ({ search, type, isVerified, isActive, minRating, limit, offset }) => {
2898
3018
  try {
2899
- const filter = {};
2900
- if (search !== void 0) filter.search = search;
2901
- if (type !== void 0) filter.type = type;
2902
- if (isActive !== void 0) filter.isActive = isActive;
3019
+ const filter = definedOnly({ search, type, isVerified, isActive, minRating });
2903
3020
  const data = await ctx.gql.workspace.request(LIST_SERVICE_PROVIDERS, {
2904
3021
  filter: Object.keys(filter).length > 0 ? filter : void 0,
2905
3022
  pagination: { limit: limit ?? 50, offset: offset ?? 0 }
2906
3023
  });
2907
3024
  return jsonResult(data.serviceProviders);
2908
3025
  } catch (error) {
2909
- ctx.logger.error("movethewheels marketplace_list_providers failed", {
2910
- error: String(error)
2911
- });
2912
- return errorResult(
2913
- `Failed to list service providers: ${error instanceof Error ? error.message : String(error)}`
2914
- );
3026
+ return failure(ctx, "marketplace_list_providers", "list service providers", error);
2915
3027
  }
2916
3028
  }
2917
3029
  );
@@ -2919,36 +3031,27 @@ function registerMarketplaceTools(server, ctx, track) {
2919
3031
  track(mcpToolName(ctx.productName, "marketplace_create_provider")),
2920
3032
  {
2921
3033
  title: "Create Service Provider",
2922
- description: "Onboard a logistics service provider. `name` and `type` are required; `isActive` defaults to true, `isVerified` to false.",
3034
+ description: "Add a service provider to the workspace marketplace directory. `name` and `type` are required; `isActive` defaults to true, `isVerified` to false.",
2923
3035
  inputSchema: {
2924
3036
  name: z.string().min(1).describe("Provider name"),
2925
- type: z.string().min(1).describe('Provider type, e.g. "carrier", "broker"'),
3037
+ type: ServiceProviderTypeEnum,
2926
3038
  description: z.string().optional().describe("Description"),
2927
- isActive: z.boolean().optional().describe("Active flag (default true)"),
3039
+ rating: Rating.optional().describe("The workspace's own rating, 0-5"),
3040
+ contactInfo: JsonObject.optional().describe(
3041
+ "Contact details, e.g. { contactName, email, phone, website }"
3042
+ ),
3043
+ services: Tags.optional().describe('Short service tags, e.g. ["reefer", "hazmat"]'),
3044
+ serviceAreas: Tags.optional().describe("Regions, lanes or cities covered"),
2928
3045
  isVerified: z.boolean().optional().describe("Verified flag (default false)"),
2929
- rating: z.number().optional().describe("Rating"),
2930
- services: JsonObject.optional().describe("Services JSON"),
2931
- contactInfo: JsonObject.optional().describe("Contact info JSON")
3046
+ isActive: z.boolean().optional().describe("Active flag (default true)")
2932
3047
  }
2933
3048
  },
2934
- async ({ name, type, description, isActive, isVerified, rating, services, contactInfo }) => {
3049
+ async (args) => {
2935
3050
  try {
2936
- const input = { name, type };
2937
- if (description !== void 0) input.description = description;
2938
- if (isActive !== void 0) input.isActive = isActive;
2939
- if (isVerified !== void 0) input.isVerified = isVerified;
2940
- if (rating !== void 0) input.rating = rating;
2941
- if (services !== void 0) input.services = services;
2942
- if (contactInfo !== void 0) input.contactInfo = contactInfo;
2943
- const data = await ctx.gql.workspace.request(CREATE_SERVICE_PROVIDER, { input });
3051
+ const data = await ctx.gql.workspace.request(CREATE_SERVICE_PROVIDER, { input: definedOnly(args) });
2944
3052
  return jsonResult(data.createServiceProvider);
2945
3053
  } catch (error) {
2946
- ctx.logger.error("movethewheels marketplace_create_provider failed", {
2947
- error: String(error)
2948
- });
2949
- return errorResult(
2950
- `Failed to create service provider: ${error instanceof Error ? error.message : String(error)}`
2951
- );
3054
+ return failure(ctx, "marketplace_create_provider", "create service provider", error);
2952
3055
  }
2953
3056
  }
2954
3057
  );
@@ -2959,49 +3062,27 @@ function registerMarketplaceTools(server, ctx, track) {
2959
3062
  description: "Update a service provider. At least one mutable field must be provided.",
2960
3063
  inputSchema: {
2961
3064
  id: z.string().describe("Service provider ID"),
2962
- name: z.string().optional().describe("Updated name"),
2963
- type: z.string().optional().describe("Updated type"),
3065
+ name: z.string().min(1).optional().describe("Updated name"),
3066
+ type: ServiceProviderTypeEnum.optional(),
2964
3067
  description: z.string().optional().describe("Updated description"),
2965
- isActive: z.boolean().optional().describe("Updated active flag"),
3068
+ rating: Rating.optional().describe("Updated rating, 0-5"),
3069
+ contactInfo: JsonObject.optional().describe("Updated contact details"),
3070
+ services: Tags.optional().describe("Replacement service tags"),
3071
+ serviceAreas: Tags.optional().describe("Replacement service areas"),
2966
3072
  isVerified: z.boolean().optional().describe("Updated verified flag"),
2967
- rating: z.number().optional().describe("Updated rating"),
2968
- services: JsonObject.optional().describe("Updated services JSON"),
2969
- contactInfo: JsonObject.optional().describe("Updated contact info JSON")
3073
+ isActive: z.boolean().optional().describe("Updated active flag")
2970
3074
  }
2971
3075
  },
2972
- async ({
2973
- id,
2974
- name,
2975
- type,
2976
- description,
2977
- isActive,
2978
- isVerified,
2979
- rating,
2980
- services,
2981
- contactInfo
2982
- }) => {
3076
+ async ({ id, ...rest }) => {
2983
3077
  try {
2984
- const input = {};
2985
- if (name !== void 0) input.name = name;
2986
- if (type !== void 0) input.type = type;
2987
- if (description !== void 0) input.description = description;
2988
- if (isActive !== void 0) input.isActive = isActive;
2989
- if (isVerified !== void 0) input.isVerified = isVerified;
2990
- if (rating !== void 0) input.rating = rating;
2991
- if (services !== void 0) input.services = services;
2992
- if (contactInfo !== void 0) input.contactInfo = contactInfo;
3078
+ const input = definedOnly(rest);
2993
3079
  if (Object.keys(input).length === 0) {
2994
3080
  return errorResult("No updates specified \u2014 provide at least one mutable field.");
2995
3081
  }
2996
3082
  const data = await ctx.gql.workspace.request(UPDATE_SERVICE_PROVIDER, { id, input });
2997
3083
  return jsonResult(data.updateServiceProvider);
2998
3084
  } catch (error) {
2999
- ctx.logger.error("movethewheels marketplace_update_provider failed", {
3000
- error: String(error)
3001
- });
3002
- return errorResult(
3003
- `Failed to update service provider: ${error instanceof Error ? error.message : String(error)}`
3004
- );
3085
+ return failure(ctx, "marketplace_update_provider", "update service provider", error);
3005
3086
  }
3006
3087
  }
3007
3088
  );
@@ -3009,7 +3090,7 @@ function registerMarketplaceTools(server, ctx, track) {
3009
3090
  track(mcpToolName(ctx.productName, "marketplace_delete_provider")),
3010
3091
  {
3011
3092
  title: "Delete Service Provider",
3012
- description: "Soft-delete a service provider by ID.",
3093
+ description: "Soft-delete a service provider and its offerings. Shipments that already use it as carrier keep the reference.",
3013
3094
  inputSchema: { id: z.string().describe("Service provider ID") }
3014
3095
  },
3015
3096
  async ({ id }) => {
@@ -3020,12 +3101,7 @@ function registerMarketplaceTools(server, ctx, track) {
3020
3101
  );
3021
3102
  return jsonResult({ deleted: data.deleteServiceProvider, id });
3022
3103
  } catch (error) {
3023
- ctx.logger.error("movethewheels marketplace_delete_provider failed", {
3024
- error: String(error)
3025
- });
3026
- return errorResult(
3027
- `Failed to delete service provider: ${error instanceof Error ? error.message : String(error)}`
3028
- );
3104
+ return failure(ctx, "marketplace_delete_provider", "delete service provider", error);
3029
3105
  }
3030
3106
  }
3031
3107
  );
@@ -3042,10 +3118,7 @@ function registerMarketplaceTools(server, ctx, track) {
3042
3118
  if (!data.serviceOffering) return errorResult(`Service offering ${id} not found`);
3043
3119
  return jsonResult(data.serviceOffering);
3044
3120
  } catch (error) {
3045
- ctx.logger.error("movethewheels marketplace_get_offering failed", { error: String(error) });
3046
- return errorResult(
3047
- `Failed to get service offering: ${error instanceof Error ? error.message : String(error)}`
3048
- );
3121
+ return failure(ctx, "marketplace_get_offering", "get service offering", error);
3049
3122
  }
3050
3123
  }
3051
3124
  );
@@ -3053,33 +3126,28 @@ function registerMarketplaceTools(server, ctx, track) {
3053
3126
  track(mcpToolName(ctx.productName, "marketplace_list_offerings")),
3054
3127
  {
3055
3128
  title: "List Service Offerings",
3056
- description: "List service offerings with optional provider/category/text filters and pagination.",
3129
+ description: "List service offerings with optional provider/category/availability/price/text filters and pagination.",
3057
3130
  inputSchema: {
3058
- search: z.string().optional().describe("Free-text search across name/description"),
3131
+ search: z.string().optional().describe("Case-insensitive match on name and description"),
3059
3132
  providerId: z.string().optional().describe("Filter by provider ID"),
3060
- category: z.string().optional().describe("Filter by category"),
3061
- limit: z.number().int().optional().describe("Page size (default 50)"),
3062
- offset: z.number().int().optional().describe("Pagination offset (default 0)")
3133
+ category: ServiceOfferingCategoryEnum.optional(),
3134
+ availability: ServiceAvailabilityEnum.optional(),
3135
+ isActive: z.boolean().optional().describe("Filter by active flag"),
3136
+ maxPrice: z.number().min(0).optional().describe("Only offerings at or below this price"),
3137
+ limit: z.number().int().positive().optional().describe("Page size (default 50)"),
3138
+ offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)")
3063
3139
  }
3064
3140
  },
3065
- async ({ search, providerId, category, limit, offset }) => {
3141
+ async ({ limit, offset, ...rest }) => {
3066
3142
  try {
3067
- const filter = {};
3068
- if (search !== void 0) filter.search = search;
3069
- if (providerId !== void 0) filter.providerId = providerId;
3070
- if (category !== void 0) filter.category = category;
3143
+ const filter = definedOnly(rest);
3071
3144
  const data = await ctx.gql.workspace.request(LIST_SERVICE_OFFERINGS, {
3072
3145
  filter: Object.keys(filter).length > 0 ? filter : void 0,
3073
3146
  pagination: { limit: limit ?? 50, offset: offset ?? 0 }
3074
3147
  });
3075
3148
  return jsonResult(data.serviceOfferings);
3076
3149
  } catch (error) {
3077
- ctx.logger.error("movethewheels marketplace_list_offerings failed", {
3078
- error: String(error)
3079
- });
3080
- return errorResult(
3081
- `Failed to list service offerings: ${error instanceof Error ? error.message : String(error)}`
3082
- );
3150
+ return failure(ctx, "marketplace_list_offerings", "list service offerings", error);
3083
3151
  }
3084
3152
  }
3085
3153
  );
@@ -3087,33 +3155,26 @@ function registerMarketplaceTools(server, ctx, track) {
3087
3155
  track(mcpToolName(ctx.productName, "marketplace_create_offering")),
3088
3156
  {
3089
3157
  title: "Create Service Offering",
3090
- description: 'Create a service offering for a provider. `name`, `price`, and `providerId` are required; `currency` defaults to "USD".',
3158
+ description: 'Publish a service offering for a provider. `providerId`, `name` and `category` are required; omit `price` when priced on request. `currency` defaults to "USD", `availability` to AVAILABLE.',
3091
3159
  inputSchema: {
3092
- name: z.string().min(1).describe("Offering name"),
3093
- price: z.number().describe("Price"),
3094
3160
  providerId: z.string().min(1).describe("Owning provider ID"),
3095
- category: z.string().optional().describe("Category"),
3161
+ name: z.string().min(1).describe("Offering name"),
3162
+ category: ServiceOfferingCategoryEnum,
3096
3163
  description: z.string().optional().describe("Description"),
3097
- currency: z.string().optional().describe('Currency (default "USD")'),
3098
- availability: JsonObject.optional().describe("Availability JSON")
3164
+ price: z.number().min(0).optional().describe("Indicative price in `currency`"),
3165
+ currency: Currency.optional(),
3166
+ pricingUnit: z.string().optional().describe('What the price is charged per, e.g. "per km" or "per pallet"'),
3167
+ transitDays: z.number().int().min(0).optional().describe("Typical transit time in days"),
3168
+ availability: ServiceAvailabilityEnum.optional(),
3169
+ isActive: z.boolean().optional().describe("Active flag (default true)")
3099
3170
  }
3100
3171
  },
3101
- async ({ name, price, providerId, category, description, currency, availability }) => {
3172
+ async (args) => {
3102
3173
  try {
3103
- const input = { name, price, providerId };
3104
- if (category !== void 0) input.category = category;
3105
- if (description !== void 0) input.description = description;
3106
- if (currency !== void 0) input.currency = currency;
3107
- if (availability !== void 0) input.availability = availability;
3108
- const data = await ctx.gql.workspace.request(CREATE_SERVICE_OFFERING, { input });
3174
+ const data = await ctx.gql.workspace.request(CREATE_SERVICE_OFFERING, { input: definedOnly(args) });
3109
3175
  return jsonResult(data.createServiceOffering);
3110
3176
  } catch (error) {
3111
- ctx.logger.error("movethewheels marketplace_create_offering failed", {
3112
- error: String(error)
3113
- });
3114
- return errorResult(
3115
- `Failed to create service offering: ${error instanceof Error ? error.message : String(error)}`
3116
- );
3177
+ return failure(ctx, "marketplace_create_offering", "create service offering", error);
3117
3178
  }
3118
3179
  }
3119
3180
  );
@@ -3124,37 +3185,27 @@ function registerMarketplaceTools(server, ctx, track) {
3124
3185
  description: "Update a service offering. At least one mutable field must be provided.",
3125
3186
  inputSchema: {
3126
3187
  id: z.string().describe("Service offering ID"),
3127
- name: z.string().optional().describe("Updated name"),
3128
- price: z.number().optional().describe("Updated price"),
3129
- providerId: z.string().optional().describe("Updated provider ID"),
3130
- category: z.string().optional().describe("Updated category"),
3188
+ name: z.string().min(1).optional().describe("Updated name"),
3189
+ category: ServiceOfferingCategoryEnum.optional(),
3131
3190
  description: z.string().optional().describe("Updated description"),
3132
- currency: z.string().optional().describe("Updated currency"),
3133
- availability: JsonObject.optional().describe("Updated availability JSON")
3191
+ price: z.number().min(0).optional().describe("Updated price"),
3192
+ currency: Currency.optional(),
3193
+ pricingUnit: z.string().optional().describe("Updated pricing unit"),
3194
+ transitDays: z.number().int().min(0).optional().describe("Updated transit days"),
3195
+ availability: ServiceAvailabilityEnum.optional(),
3196
+ isActive: z.boolean().optional().describe("Updated active flag")
3134
3197
  }
3135
3198
  },
3136
- async ({ id, name, price, providerId, category, description, currency, availability }) => {
3199
+ async ({ id, ...rest }) => {
3137
3200
  try {
3138
- const input = {};
3139
- if (name !== void 0) input.name = name;
3140
- if (price !== void 0) input.price = price;
3141
- if (providerId !== void 0) input.providerId = providerId;
3142
- if (category !== void 0) input.category = category;
3143
- if (description !== void 0) input.description = description;
3144
- if (currency !== void 0) input.currency = currency;
3145
- if (availability !== void 0) input.availability = availability;
3201
+ const input = definedOnly(rest);
3146
3202
  if (Object.keys(input).length === 0) {
3147
3203
  return errorResult("No updates specified \u2014 provide at least one mutable field.");
3148
3204
  }
3149
3205
  const data = await ctx.gql.workspace.request(UPDATE_SERVICE_OFFERING, { id, input });
3150
3206
  return jsonResult(data.updateServiceOffering);
3151
3207
  } catch (error) {
3152
- ctx.logger.error("movethewheels marketplace_update_offering failed", {
3153
- error: String(error)
3154
- });
3155
- return errorResult(
3156
- `Failed to update service offering: ${error instanceof Error ? error.message : String(error)}`
3157
- );
3208
+ return failure(ctx, "marketplace_update_offering", "update service offering", error);
3158
3209
  }
3159
3210
  }
3160
3211
  );
@@ -3173,266 +3224,42 @@ function registerMarketplaceTools(server, ctx, track) {
3173
3224
  );
3174
3225
  return jsonResult({ deleted: data.deleteServiceOffering, id });
3175
3226
  } catch (error) {
3176
- ctx.logger.error("movethewheels marketplace_delete_offering failed", {
3177
- error: String(error)
3178
- });
3179
- return errorResult(
3180
- `Failed to delete service offering: ${error instanceof Error ? error.message : String(error)}`
3181
- );
3182
- }
3183
- }
3184
- );
3185
- }
3186
- function registerReportTools(server, ctx, track) {
3187
- server.registerTool(
3188
- track(mcpToolName(ctx.productName, "reports_get")),
3189
- {
3190
- title: "Get Report",
3191
- description: "Fetch a single report definition by ID.",
3192
- inputSchema: { id: z.string().describe("Report ID") }
3193
- },
3194
- async ({ id }) => {
3195
- try {
3196
- const data = await ctx.gql.workspace.request(GET_REPORT, { id });
3197
- if (!data.movethewheelsReport) return errorResult(`Report ${id} not found`);
3198
- return jsonResult(data.movethewheelsReport);
3199
- } catch (error) {
3200
- ctx.logger.error("movethewheels reports_get failed", { error: String(error) });
3201
- return errorResult(
3202
- `Failed to get report: ${error instanceof Error ? error.message : String(error)}`
3203
- );
3204
- }
3205
- }
3206
- );
3207
- server.registerTool(
3208
- track(mcpToolName(ctx.productName, "reports_list")),
3209
- {
3210
- title: "List Reports",
3211
- description: "List report definitions with optional type/status/text filters and pagination.",
3212
- inputSchema: {
3213
- search: z.string().optional().describe("Free-text search across name"),
3214
- type: z.string().optional().describe("Filter by report type"),
3215
- status: z.string().optional().describe('Filter by status, e.g. "DRAFT", "ACTIVE"'),
3216
- limit: z.number().int().optional().describe("Page size (default 50)"),
3217
- offset: z.number().int().optional().describe("Pagination offset (default 0)")
3218
- }
3219
- },
3220
- async ({ search, type, status, limit, offset }) => {
3221
- try {
3222
- const filter = {};
3223
- if (search !== void 0) filter.search = search;
3224
- if (type !== void 0) filter.type = type;
3225
- if (status !== void 0) filter.status = status;
3226
- const data = await ctx.gql.workspace.request(LIST_REPORTS, {
3227
- filter: Object.keys(filter).length > 0 ? filter : void 0,
3228
- pagination: { limit: limit ?? 50, offset: offset ?? 0 }
3229
- });
3230
- return jsonResult(data.movethewheelsReports);
3231
- } catch (error) {
3232
- ctx.logger.error("movethewheels reports_list failed", { error: String(error) });
3233
- return errorResult(
3234
- `Failed to list reports: ${error instanceof Error ? error.message : String(error)}`
3235
- );
3236
- }
3237
- }
3238
- );
3239
- server.registerTool(
3240
- track(mcpToolName(ctx.productName, "reports_create")),
3241
- {
3242
- title: "Create Report",
3243
- description: 'Create a report definition. `name` and `type` are required; `status` defaults to "DRAFT".',
3244
- inputSchema: {
3245
- name: z.string().min(1).describe("Report name"),
3246
- type: z.string().min(1).describe("Report type"),
3247
- status: z.string().optional().describe('Status (default "DRAFT")'),
3248
- description: z.string().optional().describe("Description"),
3249
- configuration: JsonObject.optional().describe("Report configuration JSON"),
3250
- schedule: z.string().optional().describe("Schedule (e.g. cron string)")
3251
- }
3252
- },
3253
- async ({ name, type, status, description, configuration, schedule }) => {
3254
- try {
3255
- const input = { name, type };
3256
- if (status !== void 0) input.status = status;
3257
- if (description !== void 0) input.description = description;
3258
- if (configuration !== void 0) input.configuration = configuration;
3259
- if (schedule !== void 0) input.schedule = schedule;
3260
- const data = await ctx.gql.workspace.request(CREATE_REPORT, { input });
3261
- return jsonResult(data.createMovethewheelsReport);
3262
- } catch (error) {
3263
- ctx.logger.error("movethewheels reports_create failed", { error: String(error) });
3264
- return errorResult(
3265
- `Failed to create report: ${error instanceof Error ? error.message : String(error)}`
3266
- );
3267
- }
3268
- }
3269
- );
3270
- server.registerTool(
3271
- track(mcpToolName(ctx.productName, "reports_update")),
3272
- {
3273
- title: "Update Report",
3274
- description: "Update a report definition. At least one mutable field must be provided.",
3275
- inputSchema: {
3276
- id: z.string().describe("Report ID"),
3277
- name: z.string().optional().describe("Updated name"),
3278
- type: z.string().optional().describe("Updated type"),
3279
- status: z.string().optional().describe("Updated status"),
3280
- description: z.string().optional().describe("Updated description"),
3281
- configuration: JsonObject.optional().describe("Updated configuration JSON"),
3282
- schedule: z.string().optional().describe("Updated schedule")
3283
- }
3284
- },
3285
- async ({ id, name, type, status, description, configuration, schedule }) => {
3286
- try {
3287
- const input = {};
3288
- if (name !== void 0) input.name = name;
3289
- if (type !== void 0) input.type = type;
3290
- if (status !== void 0) input.status = status;
3291
- if (description !== void 0) input.description = description;
3292
- if (configuration !== void 0) input.configuration = configuration;
3293
- if (schedule !== void 0) input.schedule = schedule;
3294
- if (Object.keys(input).length === 0) {
3295
- return errorResult("No updates specified \u2014 provide at least one mutable field.");
3296
- }
3297
- const data = await ctx.gql.workspace.request(UPDATE_REPORT, { id, input });
3298
- return jsonResult(data.updateMovethewheelsReport);
3299
- } catch (error) {
3300
- ctx.logger.error("movethewheels reports_update failed", { error: String(error) });
3301
- return errorResult(
3302
- `Failed to update report: ${error instanceof Error ? error.message : String(error)}`
3303
- );
3304
- }
3305
- }
3306
- );
3307
- server.registerTool(
3308
- track(mcpToolName(ctx.productName, "reports_generate")),
3309
- {
3310
- title: "Generate Report",
3311
- description: "Run a report definition and return the generated result payload.",
3312
- inputSchema: {
3313
- reportId: z.string().describe("Report ID to generate"),
3314
- parameters: JsonObject.optional().describe("Runtime parameters JSON")
3315
- }
3316
- },
3317
- async ({ reportId, parameters }) => {
3318
- try {
3319
- const input = { reportId };
3320
- if (parameters !== void 0) input.parameters = parameters;
3321
- const data = await ctx.gql.workspace.request(GENERATE_REPORT, { input });
3322
- return jsonResult(data.generateMovethewheelsReport);
3323
- } catch (error) {
3324
- ctx.logger.error("movethewheels reports_generate failed", { error: String(error) });
3325
- return errorResult(
3326
- `Failed to generate report: ${error instanceof Error ? error.message : String(error)}`
3327
- );
3328
- }
3329
- }
3330
- );
3331
- server.registerTool(
3332
- track(mcpToolName(ctx.productName, "reports_delete")),
3333
- {
3334
- title: "Delete Report",
3335
- description: "Soft-delete a report definition by ID.",
3336
- inputSchema: { id: z.string().describe("Report ID") }
3337
- },
3338
- async ({ id }) => {
3339
- try {
3340
- const data = await ctx.gql.workspace.request(
3341
- DELETE_REPORT,
3342
- { id }
3343
- );
3344
- return jsonResult({ deleted: data.deleteMovethewheelsReport, id });
3345
- } catch (error) {
3346
- ctx.logger.error("movethewheels reports_delete failed", { error: String(error) });
3347
- return errorResult(
3348
- `Failed to delete report: ${error instanceof Error ? error.message : String(error)}`
3349
- );
3227
+ return failure(ctx, "marketplace_delete_offering", "delete service offering", error);
3350
3228
  }
3351
3229
  }
3352
3230
  );
3353
3231
  server.registerTool(
3354
- track(mcpToolName(ctx.productName, "settings_get")),
3232
+ track(mcpToolName(ctx.productName, "marketplace_stats")),
3355
3233
  {
3356
- title: "Get Module Settings",
3357
- description: "Fetch the Movethewheels module settings (preferences) for the bound workspace.",
3234
+ title: "Marketplace Stats",
3235
+ description: "Counts of providers (total, verified, active) and live offerings, plus the average provider rating.",
3358
3236
  inputSchema: {}
3359
3237
  },
3360
3238
  async () => {
3361
3239
  try {
3362
- const data = await ctx.gql.workspace.request(GET_MODULE_SETTINGS, {});
3363
- return jsonResult(data.moduleSettings);
3240
+ const data = await ctx.gql.workspace.request(MARKETPLACE_STATS, {});
3241
+ return jsonResult(data.marketplaceStats);
3364
3242
  } catch (error) {
3365
- ctx.logger.error("movethewheels settings_get failed", { error: String(error) });
3366
- return errorResult(
3367
- `Failed to get module settings: ${error instanceof Error ? error.message : String(error)}`
3368
- );
3369
- }
3370
- }
3371
- );
3372
- server.registerTool(
3373
- track(mcpToolName(ctx.productName, "settings_update")),
3374
- {
3375
- title: "Update Module Settings",
3376
- description: "Replace the Movethewheels module preferences JSON for the bound workspace.",
3377
- inputSchema: {
3378
- preferences: JsonObject.describe("Module preferences JSON (full replacement)")
3379
- }
3380
- },
3381
- async ({ preferences }) => {
3382
- try {
3383
- const data = await ctx.gql.workspace.request(UPDATE_MODULE_SETTINGS, { input: { preferences } });
3384
- return jsonResult(data.updateModuleSettings);
3385
- } catch (error) {
3386
- ctx.logger.error("movethewheels settings_update failed", { error: String(error) });
3387
- return errorResult(
3388
- `Failed to update module settings: ${error instanceof Error ? error.message : String(error)}`
3389
- );
3243
+ return failure(ctx, "marketplace_stats", "get marketplace stats", error);
3390
3244
  }
3391
3245
  }
3392
3246
  );
3393
3247
  server.registerTool(
3394
- track(mcpToolName(ctx.productName, "data_export")),
3248
+ track(mcpToolName(ctx.productName, "marketplace_assign_shipment")),
3395
3249
  {
3396
- title: "Export Data",
3397
- description: 'Export a Movethewheels resource (e.g. "orders", "shipments", "inventory") as a payload. `format` defaults to "json".',
3250
+ title: "Assign Provider to Shipment",
3251
+ description: "Make a marketplace provider the shipment's carrier, or clear the carrier by passing providerId null. Unverified or inactive providers are allowed; check their flags first.",
3398
3252
  inputSchema: {
3399
- resource: z.string().min(1).describe('Resource to export, e.g. "orders"'),
3400
- format: z.string().optional().describe('Export format (default "json")')
3401
- }
3402
- },
3403
- async ({ resource, format }) => {
3404
- try {
3405
- const input = { resource };
3406
- if (format !== void 0) input.format = format;
3407
- const data = await ctx.gql.workspace.request(EXPORT_DATA, { input });
3408
- return jsonResult(data.exportData);
3409
- } catch (error) {
3410
- ctx.logger.error("movethewheels data_export failed", { error: String(error) });
3411
- return errorResult(
3412
- `Failed to export data: ${error instanceof Error ? error.message : String(error)}`
3413
- );
3414
- }
3415
- }
3416
- );
3417
- server.registerTool(
3418
- track(mcpToolName(ctx.productName, "data_import")),
3419
- {
3420
- title: "Import Data",
3421
- description: 'Import a payload into a Movethewheels resource (e.g. "orders", "customers"). `resource` and `payload` are required.',
3422
- inputSchema: {
3423
- resource: z.string().min(1).describe('Resource to import into, e.g. "customers"'),
3424
- payload: JsonObject.describe("Payload JSON to import")
3253
+ shipmentId: z.string().min(1).describe("Shipment ID"),
3254
+ providerId: z.string().min(1).nullable().describe("Service provider ID, or null to clear the carrier")
3425
3255
  }
3426
3256
  },
3427
- async ({ resource, payload }) => {
3257
+ async ({ shipmentId, providerId }) => {
3428
3258
  try {
3429
- const data = await ctx.gql.workspace.request(IMPORT_DATA, { input: { resource, payload } });
3430
- return jsonResult(data.importData);
3259
+ const data = await ctx.gql.workspace.request(ASSIGN_SHIPMENT_SERVICE_PROVIDER, { shipmentId, providerId });
3260
+ return jsonResult(data.assignShipmentServiceProvider);
3431
3261
  } catch (error) {
3432
- ctx.logger.error("movethewheels data_import failed", { error: String(error) });
3433
- return errorResult(
3434
- `Failed to import data: ${error instanceof Error ? error.message : String(error)}`
3435
- );
3262
+ return failure(ctx, "marketplace_assign_shipment", "assign provider to shipment", error);
3436
3263
  }
3437
3264
  }
3438
3265
  );
@@ -3444,7 +3271,7 @@ function registerAnalyticsTools(server, ctx, track) {
3444
3271
  track(mcpToolName(ctx.productName, "analytics_series")),
3445
3272
  {
3446
3273
  title: "Analytics Time Series",
3447
- description: "Time-series trends for orders, deliveries, and revenue.",
3274
+ description: "Time-series trends for delivery jobs (orderTrend), deliveries, and revenue.",
3448
3275
  inputSchema: {}
3449
3276
  },
3450
3277
  async () => {
@@ -3463,7 +3290,7 @@ function registerAnalyticsTools(server, ctx, track) {
3463
3290
  track(mcpToolName(ctx.productName, "analytics_dashboard")),
3464
3291
  {
3465
3292
  title: "Dashboard Metrics",
3466
- description: "Headline operations KPIs: total orders, active deliveries, active vehicles, available drivers, low-stock items, total revenue, and recent orders.",
3293
+ description: "Headline operations KPIs: total delivery jobs, active deliveries, active vehicles, available drivers, low-stock items, total revenue, on-time delivery rate, customer satisfaction, and the most recent delivery jobs.",
3467
3294
  inputSchema: {}
3468
3295
  },
3469
3296
  async () => {
@@ -3479,20 +3306,22 @@ function registerAnalyticsTools(server, ctx, track) {
3479
3306
  }
3480
3307
  );
3481
3308
  server.registerTool(
3482
- track(mcpToolName(ctx.productName, "analytics_order_stats")),
3309
+ track(mcpToolName(ctx.productName, "analytics_delivery_job_stats")),
3483
3310
  {
3484
- title: "Order Stats",
3485
- description: "Order counts by lifecycle bucket: total, pending, in-transit, delivered, cancelled, failed.",
3311
+ title: "Delivery Job Stats",
3312
+ description: "Delivery job counts by lifecycle status: total, pending, confirmed, assigned, picked up, in transit, out for delivery, delivered, cancelled, failed, returned.",
3486
3313
  inputSchema: {}
3487
3314
  },
3488
3315
  async () => {
3489
3316
  try {
3490
- const data = await ctx.gql.workspace.request(GET_ORDER_STATS, {});
3491
- return jsonResult(data.orderStats);
3317
+ const data = await ctx.gql.workspace.request(GET_DELIVERY_JOB_STATS, {});
3318
+ return jsonResult(data.deliveryJobStats);
3492
3319
  } catch (error) {
3493
- ctx.logger.error("movethewheels analytics_order_stats failed", { error: String(error) });
3320
+ ctx.logger.error("movethewheels analytics_delivery_job_stats failed", {
3321
+ error: String(error)
3322
+ });
3494
3323
  return errorResult(
3495
- `Failed to get order stats: ${error instanceof Error ? error.message : String(error)}`
3324
+ `Failed to get delivery job stats: ${error instanceof Error ? error.message : String(error)}`
3496
3325
  );
3497
3326
  }
3498
3327
  }
@@ -3561,32 +3390,38 @@ Logistics / fleet / warehouse / last-mile-delivery operations platform.
3561
3390
  - Customer \u2014 shipper/consignee (B2B/B2C)
3562
3391
  - Driver \u2014 fleet driver (status, license, telemetry)
3563
3392
  - Vehicle \u2014 fleet vehicle (type, status, capacity, location)
3564
- - Product \u2014 cargo SKU master (weight, dimensions, hazardous/fragile/temp)
3565
- - MovethewheelsOrder (+OrderStatusHistory) \u2014 delivery order + status timeline
3566
- - Shipment (+TrackingEvent) \u2014 freight shipment + tracking timeline
3393
+ - CargoItem \u2014 cargo SKU master (weight, dimensions, hazardous/fragile/temp).
3394
+ Not a sellable product: storefront SKUs live in global-store-svc.
3395
+ - DeliveryJob (+DeliveryJobStatusHistory) \u2014 the dispatch unit (pickup,
3396
+ delivery, cargo, driver/vehicle/route) + status timeline. Not a checkout
3397
+ order: the order of record is a global-store StoreOrder (storeOrderId).
3398
+ - Shipment (+TrackingEvent) \u2014 freight shipment for a delivery job + tracking
3399
+ timeline; carrierId may point at a marketplace ServiceProvider
3567
3400
  - Route \u2014 planned/optimized delivery route
3568
3401
  - Warehouse (+WarehouseLocation) \u2014 facilities + storage locations
3569
3402
  - InventoryItem (+InventoryTransaction) \u2014 stock at a warehouse + ledger
3570
3403
  - ServiceProvider (+ServiceOffering) \u2014 3PL marketplace providers + offerings
3571
- - MovethewheelsReport \u2014 report definitions
3572
3404
 
3573
3405
  ## Enums
3574
3406
  - DriverStatus: AVAILABLE, INACTIVE, OFF_DUTY, ON_BREAK, ON_DELIVERY
3575
3407
  - VehicleStatus: ACTIVE, DECOMMISSIONED, INACTIVE, IN_TRANSIT, MAINTENANCE
3576
3408
  - VehicleType: BICYCLE, DRONE, FLATBED, MOTORCYCLE, REFRIGERATED, SEMI_TRAILER, TRUCK, VAN
3577
- - OrderType: B2B, B2C, MARKETPLACE, SUBSCRIPTION
3578
- - OrderPriority: CRITICAL, HIGH, LOW, MEDIUM, URGENT
3579
- - OrderStatus: PENDING, CONFIRMED, ASSIGNED, PICKED_UP, IN_TRANSIT, OUT_FOR_DELIVERY, DELIVERED, CANCELLED, FAILED, RETURNED
3409
+ - DeliveryPriority: CRITICAL, HIGH, LOW, MEDIUM, URGENT
3410
+ - DeliveryJobStatus: PENDING, CONFIRMED, ASSIGNED, PICKED_UP, IN_TRANSIT, OUT_FOR_DELIVERY, DELIVERED, CANCELLED, FAILED, RETURNED
3580
3411
  - ShipmentStatus: PLANNED, PICKED_UP, IN_TRANSIT, DELIVERED, FAILED, RETURNED
3581
3412
  - TrackingEventType: CREATED, PICKED_UP, DEPARTED, ARRIVED, IN_TRANSIT, OUT_FOR_DELIVERY, DELIVERED, FAILED, RETURNED
3582
3413
  - RouteStatus: PLANNED, IN_PROGRESS, COMPLETED, CANCELLED
3583
3414
  - WarehouseType: COLD_STORAGE, CROSS_DOCK, DISTRIBUTION, FULFILLMENT, RETAIL
3584
3415
  - InventoryTransactionType: RECEIPT, ISSUE, TRANSFER, ADJUSTMENT, RETURN
3585
3416
 
3417
+ ## Stock rule
3418
+ Inventory counts are non-negative integers and available + allocated + damaged
3419
+ must equal onHand. Move stock between lines with inventory_transfer_stock.
3420
+
3586
3421
  ## Tool groups
3587
- customers, drivers, vehicles, products, orders, shipments, tracking, routes,
3588
- warehouses, inventory, marketplace (service providers + offerings), reports
3589
- (+ settings + import/export), analytics.
3422
+ customers, drivers, vehicles, cargo, delivery_jobs, shipments, tracking,
3423
+ routes, warehouses, inventory, marketplace (service providers + offerings),
3424
+ analytics.
3590
3425
  All run against the WORKSPACE gateway (workspace-scoped). The subgraph has no
3591
3426
  @public health field, so there is no health tool.
3592
3427
  `;
@@ -3600,7 +3435,7 @@ All run against the WORKSPACE gateway (workspace-scoped). The subgraph has no
3600
3435
  dashboardUri,
3601
3436
  {
3602
3437
  title: "Movethewheels Dashboard Metrics",
3603
- description: "Live headline operations KPIs (orders, active deliveries, vehicles, drivers, low-stock, revenue).",
3438
+ description: "Live headline operations KPIs (delivery jobs, active deliveries, vehicles, drivers, low-stock, revenue, on-time rate).",
3604
3439
  mimeType: "application/json"
3605
3440
  },
3606
3441
  async () => {
@@ -3718,28 +3553,28 @@ function registerMovethewheelsPrompts(server, ctx, track) {
3718
3553
  fulfilmentName,
3719
3554
  {
3720
3555
  title: "Delivery Fulfilment",
3721
- description: "Guide for fulfilling a delivery order end to end: create the order, create a shipment, assign a driver/vehicle, and advance it through tracking to delivery.",
3556
+ description: "Guide for fulfilling a delivery job end to end: create the job, assign a driver/vehicle, create a shipment, and advance it through tracking to delivery.",
3722
3557
  argsSchema: {
3723
- customerId: z.string().optional().describe("Customer placing the order"),
3724
- orderId: z.string().optional().describe("Existing order ID to fulfil")
3558
+ customerId: z.string().optional().describe("Customer the delivery is for"),
3559
+ deliveryJobId: z.string().optional().describe("Existing delivery job ID to fulfil")
3725
3560
  }
3726
3561
  },
3727
- ({ customerId, orderId }) => {
3728
- ctx.logger.debug(`Prompt ${fulfilmentName} called`, { customerId, orderId });
3729
- const orderNote = orderId ? `Operate the existing order "${orderId}".` : customerId ? `Create a new order for customer "${customerId}".` : `First pick a customer with ${p}_customers_list (or create one with ${p}_customers_create).`;
3562
+ ({ customerId, deliveryJobId }) => {
3563
+ ctx.logger.debug(`Prompt ${fulfilmentName} called`, { customerId, deliveryJobId });
3564
+ const jobNote = deliveryJobId ? `Operate the existing delivery job "${deliveryJobId}".` : customerId ? `Create a new delivery job for customer "${customerId}".` : `First pick a customer with ${p}_customers_list (or create one with ${p}_customers_create).`;
3730
3565
  return {
3731
3566
  messages: [
3732
3567
  {
3733
3568
  role: "user",
3734
3569
  content: {
3735
3570
  type: "text",
3736
- text: `Help me fulfil a Movethewheels delivery order. ${orderNote}
3571
+ text: `Help me fulfil a Movethewheels delivery job. ${jobNote}
3737
3572
 
3738
- 1. **Order**: If needed, use ${p}_orders_create with a unique orderNumber, pickupAddress, deliveryAddress, and items.
3739
- 2. **Assign Capacity**: Use ${p}_drivers_list (status=AVAILABLE) and ${p}_vehicles_list (status=ACTIVE), then ${p}_drivers_assign_vehicle and ${p}_orders_update to attach driverId/vehicleId.
3740
- 3. **Shipment**: Use ${p}_shipments_create with the orderId, a unique shipmentNumber, origin, and destination.
3741
- 4. **Track**: As the shipment moves, use ${p}_tracking_add_event (PICKED_UP \u2192 IN_TRANSIT \u2192 OUT_FOR_DELIVERY \u2192 DELIVERED) and mirror order state with ${p}_orders_update_status.
3742
- 5. **Verify**: Use ${p}_tracking_order_events to confirm the timeline and ${p}_orders_get for the final state.
3573
+ 1. **Delivery job**: If needed, use ${p}_delivery_jobs_create with a unique deliveryJobNumber, pickupAddress, deliveryAddress, and cargoItems.
3574
+ 2. **Assign Capacity**: Use ${p}_drivers_list (status=AVAILABLE) and ${p}_vehicles_list (status=ACTIVE), then ${p}_drivers_assign_vehicle and ${p}_delivery_jobs_update to attach driverId/vehicleId.
3575
+ 3. **Shipment**: Use ${p}_shipments_create with the deliveryJobId, a unique shipmentNumber, origin, and destination.
3576
+ 4. **Track**: As the shipment moves, use ${p}_tracking_add_event (PICKED_UP \u2192 IN_TRANSIT \u2192 OUT_FOR_DELIVERY \u2192 DELIVERED) and mirror the job's state with ${p}_delivery_jobs_update_status.
3577
+ 5. **Verify**: Use ${p}_tracking_delivery_job_events to confirm the timeline and ${p}_delivery_jobs_get for the final state.
3743
3578
 
3744
3579
  Show results at each step and confirm before marking DELIVERED.`
3745
3580
  }
@@ -3752,7 +3587,7 @@ Show results at each step and confirm before marking DELIVERED.`
3752
3587
  fleetName,
3753
3588
  {
3754
3589
  title: "Fleet & Warehouse Operations",
3755
- description: "Daily operations workflow: review KPIs, triage the order queue and tracking alerts, balance fleet status, and watch low inventory.",
3590
+ description: "Daily operations workflow: review KPIs, triage the delivery-job queue and tracking alerts, balance fleet status, and watch low inventory.",
3756
3591
  argsSchema: {}
3757
3592
  },
3758
3593
  () => {
@@ -3765,11 +3600,11 @@ Show results at each step and confirm before marking DELIVERED.`
3765
3600
  type: "text",
3766
3601
  text: `Run daily Movethewheels operations.
3767
3602
 
3768
- 1. **KPIs**: Use ${p}_analytics_dashboard for headline numbers, ${p}_analytics_order_stats and ${p}_analytics_fleet for status breakdowns, and ${p}_analytics_finance for revenue/fuel/invoices.
3769
- 2. **Order Queue**: Use ${p}_orders_list filtered by status=PENDING (and CONFIRMED) to find orders needing assignment; advance them with ${p}_orders_update_status.
3770
- 3. **Tracking Alerts**: Use ${p}_tracking_alerts to find delayed/exception shipments and ${p}_shipments_get to investigate.
3603
+ 1. **KPIs**: Use ${p}_analytics_dashboard for headline numbers, ${p}_analytics_delivery_job_stats and ${p}_analytics_fleet for status breakdowns, and ${p}_analytics_finance for revenue/fuel/invoices.
3604
+ 2. **Job Queue**: Use ${p}_delivery_jobs_list with unassigned=true (or status=PENDING / CONFIRMED) to find jobs needing assignment; advance them with ${p}_delivery_jobs_update_status.
3605
+ 3. **Tracking Alerts**: Use ${p}_tracking_alerts to find DELAYED and AT_RISK shipments and ${p}_shipments_get to investigate.
3771
3606
  4. **Fleet Balance**: Use ${p}_vehicles_list and ${p}_drivers_list to spot MAINTENANCE/OFF_DUTY capacity; update with ${p}_vehicles_update_status / ${p}_drivers_update_status.
3772
- 5. **Inventory**: Use ${p}_inventory_stats and ${p}_inventory_list_items to find low-stock items; record movements with ${p}_inventory_create_transaction.
3607
+ 5. **Inventory**: Use ${p}_inventory_stats and ${p}_inventory_list_items (lowStock=true) to find low-stock items; move stock with ${p}_inventory_transfer_stock and record receipts/issues with ${p}_inventory_create_transaction.
3773
3608
 
3774
3609
  Summarize what needs attention after each step.`
3775
3610
  }
@@ -3806,15 +3641,14 @@ var movethewheelsModule = {
3806
3641
  registerCustomerTools(server, ctx, trackTool);
3807
3642
  registerDriverTools(server, ctx, trackTool);
3808
3643
  registerVehicleTools(server, ctx, trackTool);
3809
- registerProductTools(server, ctx, trackTool);
3810
- registerOrderTools(server, ctx, trackTool);
3644
+ registerCargoTools(server, ctx, trackTool);
3645
+ registerDeliveryJobTools(server, ctx, trackTool);
3811
3646
  registerShipmentTools(server, ctx, trackTool);
3812
3647
  registerTrackingTools(server, ctx, trackTool);
3813
3648
  registerRouteTools(server, ctx, trackTool);
3814
3649
  registerWarehouseTools(server, ctx, trackTool);
3815
3650
  registerInventoryTools(server, ctx, trackTool);
3816
3651
  registerMarketplaceTools(server, ctx, trackTool);
3817
- registerReportTools(server, ctx, trackTool);
3818
3652
  registerAnalyticsTools(server, ctx, trackTool);
3819
3653
  registerMovethewheelsResources(server, ctx, trackResource);
3820
3654
  registerMovethewheelsPrompts(server, ctx, trackPrompt);