@burdenoff/mcp-libs 2026.1030.5 → 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.
- package/dist/modules/movethewheels/index.cjs +428 -611
- package/dist/modules/movethewheels/index.cjs.map +1 -1
- package/dist/modules/movethewheels/index.js +428 -611
- package/dist/modules/movethewheels/index.js.map +1 -1
- package/dist/modules/movethewheels/operations.d.ts +36 -46
- package/dist/modules/movethewheels/tools/{orders.d.ts → cargo.d.ts} +1 -1
- package/dist/modules/movethewheels/tools/{products.d.ts → deliveryJobs.d.ts} +1 -1
- package/dist/modules/movethewheels/tools/shared.d.ts +4 -3
- package/package.json +1 -1
- package/dist/modules/movethewheels/tools/reports.d.ts +0 -3
|
@@ -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
|
|
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
|
|
25
|
-
id
|
|
24
|
+
var DELIVERY_JOB_STATUS_HISTORY_FIELDS = `
|
|
25
|
+
id deliveryJobId status previousStatus notes location createdAt
|
|
26
26
|
`;
|
|
27
|
-
var
|
|
28
|
-
id
|
|
29
|
-
pickupAddress deliveryAddress
|
|
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
|
|
34
|
-
|
|
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,11 +57,11 @@ var WAREHOUSE_FIELDS = `
|
|
|
56
57
|
totalCapacity usedCapacity ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
57
58
|
`;
|
|
58
59
|
var INVENTORY_ITEM_FIELDS = `
|
|
59
|
-
id
|
|
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
|
|
64
|
+
id transactionNumber type cargoItemId warehouseId inventoryItemId quantity
|
|
64
65
|
unitCost referenceType referenceId notes ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
65
66
|
`;
|
|
66
67
|
var MARKETPLACE_AUDIT_FIELDS = `workspaceId createdBy onBehalfOf updatedBy createdAt updatedAt deletedAt`;
|
|
@@ -72,10 +73,6 @@ var SERVICE_PROVIDER_FIELDS = `
|
|
|
72
73
|
id name type description rating contactInfo services serviceAreas isVerified isActive
|
|
73
74
|
offeringsCount ${MARKETPLACE_AUDIT_FIELDS}
|
|
74
75
|
`;
|
|
75
|
-
var REPORT_FIELDS = `
|
|
76
|
-
id name type status description configuration schedule lastGenerated
|
|
77
|
-
${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
78
|
-
`;
|
|
79
76
|
var GET_CUSTOMER = `
|
|
80
77
|
query MovethewheelsGetCustomer($id: ID!) {
|
|
81
78
|
customer(id: $id) { ${CUSTOMER_FIELDS} }
|
|
@@ -171,76 +168,84 @@ var DELETE_VEHICLE = `
|
|
|
171
168
|
deleteVehicle(id: $id)
|
|
172
169
|
}
|
|
173
170
|
`;
|
|
174
|
-
var
|
|
175
|
-
query
|
|
176
|
-
|
|
171
|
+
var GET_CARGO_ITEM = `
|
|
172
|
+
query MovethewheelsGetCargoItem($id: ID!) {
|
|
173
|
+
cargoItem(id: $id) { ${CARGO_ITEM_FIELDS} }
|
|
177
174
|
}
|
|
178
175
|
`;
|
|
179
|
-
var
|
|
180
|
-
query
|
|
181
|
-
|
|
176
|
+
var LIST_CARGO_ITEMS = `
|
|
177
|
+
query MovethewheelsListCargoItems($filter: CargoItemFilterInput, $pagination: PaginationInput) {
|
|
178
|
+
cargoItems(filter: $filter, pagination: $pagination) { ${CARGO_ITEM_FIELDS} }
|
|
182
179
|
}
|
|
183
180
|
`;
|
|
184
|
-
var
|
|
185
|
-
mutation
|
|
186
|
-
|
|
181
|
+
var CREATE_CARGO_ITEM = `
|
|
182
|
+
mutation MovethewheelsCreateCargoItem($input: CreateCargoItemInput!) {
|
|
183
|
+
createCargoItem(input: $input) { ${CARGO_ITEM_FIELDS} }
|
|
187
184
|
}
|
|
188
185
|
`;
|
|
189
|
-
var
|
|
190
|
-
mutation
|
|
191
|
-
|
|
186
|
+
var UPDATE_CARGO_ITEM = `
|
|
187
|
+
mutation MovethewheelsUpdateCargoItem($id: ID!, $input: UpdateCargoItemInput!) {
|
|
188
|
+
updateCargoItem(id: $id, input: $input) { ${CARGO_ITEM_FIELDS} }
|
|
192
189
|
}
|
|
193
190
|
`;
|
|
194
|
-
var
|
|
195
|
-
mutation
|
|
196
|
-
|
|
191
|
+
var DELETE_CARGO_ITEM = `
|
|
192
|
+
mutation MovethewheelsDeleteCargoItem($id: ID!) {
|
|
193
|
+
deleteCargoItem(id: $id)
|
|
197
194
|
}
|
|
198
195
|
`;
|
|
199
|
-
var
|
|
200
|
-
query
|
|
201
|
-
|
|
202
|
-
${
|
|
196
|
+
var GET_DELIVERY_JOB = `
|
|
197
|
+
query MovethewheelsGetDeliveryJob($id: ID!) {
|
|
198
|
+
deliveryJob(id: $id) {
|
|
199
|
+
${DELIVERY_JOB_FIELDS}
|
|
203
200
|
customer { id name email phone }
|
|
204
201
|
driver { id firstName lastName status }
|
|
205
202
|
vehicle { id vehicleNumber type status }
|
|
203
|
+
route { id name status }
|
|
206
204
|
shipment { id shipmentNumber status }
|
|
207
|
-
statusHistory { ${
|
|
205
|
+
statusHistory { ${DELIVERY_JOB_STATUS_HISTORY_FIELDS} }
|
|
208
206
|
}
|
|
209
207
|
}
|
|
210
208
|
`;
|
|
211
|
-
var
|
|
212
|
-
query
|
|
213
|
-
|
|
209
|
+
var LIST_DELIVERY_JOBS = `
|
|
210
|
+
query MovethewheelsListDeliveryJobs(
|
|
211
|
+
$filter: DeliveryJobFilterInput
|
|
212
|
+
$pagination: PaginationInput
|
|
213
|
+
) {
|
|
214
|
+
deliveryJobs(filter: $filter, pagination: $pagination) { ${DELIVERY_JOB_FIELDS} }
|
|
214
215
|
}
|
|
215
216
|
`;
|
|
216
|
-
var
|
|
217
|
-
mutation
|
|
218
|
-
|
|
217
|
+
var CREATE_DELIVERY_JOB = `
|
|
218
|
+
mutation MovethewheelsCreateDeliveryJob($input: CreateDeliveryJobInput!) {
|
|
219
|
+
createDeliveryJob(input: $input) { ${DELIVERY_JOB_FIELDS} }
|
|
219
220
|
}
|
|
220
221
|
`;
|
|
221
|
-
var
|
|
222
|
-
mutation
|
|
223
|
-
|
|
222
|
+
var UPDATE_DELIVERY_JOB = `
|
|
223
|
+
mutation MovethewheelsUpdateDeliveryJob($id: ID!, $input: UpdateDeliveryJobInput!) {
|
|
224
|
+
updateDeliveryJob(id: $id, input: $input) { ${DELIVERY_JOB_FIELDS} }
|
|
224
225
|
}
|
|
225
226
|
`;
|
|
226
|
-
var
|
|
227
|
-
mutation
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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} }
|
|
231
235
|
}
|
|
232
236
|
}
|
|
233
237
|
`;
|
|
234
|
-
var
|
|
235
|
-
mutation
|
|
236
|
-
|
|
238
|
+
var DELETE_DELIVERY_JOB = `
|
|
239
|
+
mutation MovethewheelsDeleteDeliveryJob($id: ID!) {
|
|
240
|
+
deleteDeliveryJob(id: $id)
|
|
237
241
|
}
|
|
238
242
|
`;
|
|
239
243
|
var GET_SHIPMENT = `
|
|
240
244
|
query MovethewheelsGetShipment($id: ID!) {
|
|
241
245
|
shipment(id: $id) {
|
|
242
246
|
${SHIPMENT_FIELDS}
|
|
243
|
-
|
|
247
|
+
deliveryJob { id deliveryJobNumber status }
|
|
248
|
+
serviceProvider { id name type isVerified isActive }
|
|
244
249
|
trackingEvents { ${TRACKING_EVENT_FIELDS} }
|
|
245
250
|
}
|
|
246
251
|
}
|
|
@@ -270,9 +275,11 @@ var DELETE_SHIPMENT = `
|
|
|
270
275
|
deleteShipment(id: $id)
|
|
271
276
|
}
|
|
272
277
|
`;
|
|
273
|
-
var
|
|
274
|
-
query
|
|
275
|
-
|
|
278
|
+
var GET_DELIVERY_JOB_TRACKING = `
|
|
279
|
+
query MovethewheelsDeliveryJobTracking($deliveryJobId: ID!, $pagination: PaginationInput) {
|
|
280
|
+
deliveryJobTracking(deliveryJobId: $deliveryJobId, pagination: $pagination) {
|
|
281
|
+
${TRACKING_EVENT_FIELDS}
|
|
282
|
+
}
|
|
276
283
|
}
|
|
277
284
|
`;
|
|
278
285
|
var GET_SHIPMENT_TRACKING = `
|
|
@@ -367,7 +374,7 @@ var GET_INVENTORY_ITEM = `
|
|
|
367
374
|
query MovethewheelsGetInventoryItem($id: ID!) {
|
|
368
375
|
inventoryItem(id: $id) {
|
|
369
376
|
${INVENTORY_ITEM_FIELDS}
|
|
370
|
-
|
|
377
|
+
cargoItem { id name sku }
|
|
371
378
|
warehouse { id name code }
|
|
372
379
|
location { id locationCode }
|
|
373
380
|
}
|
|
@@ -414,6 +421,14 @@ var ADJUST_INVENTORY_STOCK = `
|
|
|
414
421
|
adjustInventoryStock(input: $input) { ${INVENTORY_ITEM_FIELDS} }
|
|
415
422
|
}
|
|
416
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
|
+
`;
|
|
417
432
|
var DELETE_INVENTORY_ITEM = `
|
|
418
433
|
mutation MovethewheelsDeleteInventoryItem($id: ID!) {
|
|
419
434
|
deleteInventoryItem(id: $id)
|
|
@@ -502,65 +517,6 @@ var ASSIGN_SHIPMENT_SERVICE_PROVIDER = `
|
|
|
502
517
|
}
|
|
503
518
|
}
|
|
504
519
|
`;
|
|
505
|
-
var GET_REPORT = `
|
|
506
|
-
query MovethewheelsGetReport($id: ID!) {
|
|
507
|
-
movethewheelsReport(id: $id) { ${REPORT_FIELDS} }
|
|
508
|
-
}
|
|
509
|
-
`;
|
|
510
|
-
var LIST_REPORTS = `
|
|
511
|
-
query MovethewheelsListReports(
|
|
512
|
-
$filter: MovethewheelsReportFilterInput
|
|
513
|
-
$pagination: PaginationInput
|
|
514
|
-
) {
|
|
515
|
-
movethewheelsReports(filter: $filter, pagination: $pagination) { ${REPORT_FIELDS} }
|
|
516
|
-
}
|
|
517
|
-
`;
|
|
518
|
-
var CREATE_REPORT = `
|
|
519
|
-
mutation MovethewheelsCreateReport($input: CreateMovethewheelsReportInput!) {
|
|
520
|
-
createMovethewheelsReport(input: $input) { ${REPORT_FIELDS} }
|
|
521
|
-
}
|
|
522
|
-
`;
|
|
523
|
-
var UPDATE_REPORT = `
|
|
524
|
-
mutation MovethewheelsUpdateReport($id: ID!, $input: UpdateMovethewheelsReportInput!) {
|
|
525
|
-
updateMovethewheelsReport(id: $id, input: $input) { ${REPORT_FIELDS} }
|
|
526
|
-
}
|
|
527
|
-
`;
|
|
528
|
-
var DELETE_REPORT = `
|
|
529
|
-
mutation MovethewheelsDeleteReport($id: ID!) {
|
|
530
|
-
deleteMovethewheelsReport(id: $id)
|
|
531
|
-
}
|
|
532
|
-
`;
|
|
533
|
-
var GENERATE_REPORT = `
|
|
534
|
-
mutation MovethewheelsGenerateReport($input: GenerateMovethewheelsReportInput!) {
|
|
535
|
-
generateMovethewheelsReport(input: $input) {
|
|
536
|
-
generatedAt
|
|
537
|
-
result
|
|
538
|
-
report { ${REPORT_FIELDS} }
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
`;
|
|
542
|
-
var GET_MODULE_SETTINGS = `
|
|
543
|
-
query MovethewheelsModuleSettings {
|
|
544
|
-
moduleSettings { workspaceId preferences updatedAt }
|
|
545
|
-
}
|
|
546
|
-
`;
|
|
547
|
-
var UPDATE_MODULE_SETTINGS = `
|
|
548
|
-
mutation MovethewheelsUpdateModuleSettings(
|
|
549
|
-
$input: UpdateMovethewheelsModuleSettingsInput!
|
|
550
|
-
) {
|
|
551
|
-
updateModuleSettings(input: $input) { workspaceId preferences updatedAt }
|
|
552
|
-
}
|
|
553
|
-
`;
|
|
554
|
-
var EXPORT_DATA = `
|
|
555
|
-
mutation MovethewheelsExportData($input: MovethewheelsExportDataInput!) {
|
|
556
|
-
exportData(input: $input) { success message payload }
|
|
557
|
-
}
|
|
558
|
-
`;
|
|
559
|
-
var IMPORT_DATA = `
|
|
560
|
-
mutation MovethewheelsImportData($input: MovethewheelsImportDataInput!) {
|
|
561
|
-
importData(input: $input) { success message payload }
|
|
562
|
-
}
|
|
563
|
-
`;
|
|
564
520
|
var GET_ANALYTICS = `
|
|
565
521
|
query MovethewheelsAnalytics {
|
|
566
522
|
analytics {
|
|
@@ -573,19 +529,33 @@ var GET_ANALYTICS = `
|
|
|
573
529
|
var GET_DASHBOARD_METRICS = `
|
|
574
530
|
query MovethewheelsDashboardMetrics {
|
|
575
531
|
dashboardMetrics {
|
|
576
|
-
|
|
532
|
+
totalDeliveryJobs
|
|
577
533
|
activeDeliveries
|
|
578
534
|
activeVehicles
|
|
579
535
|
availableDrivers
|
|
580
536
|
lowStockItems
|
|
581
537
|
totalRevenue
|
|
582
|
-
|
|
538
|
+
onTimeDeliveryRate
|
|
539
|
+
customerSatisfaction
|
|
540
|
+
recentDeliveryJobs { id deliveryJobNumber status priority createdAt }
|
|
583
541
|
}
|
|
584
542
|
}
|
|
585
543
|
`;
|
|
586
|
-
var
|
|
587
|
-
query
|
|
588
|
-
|
|
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
|
+
}
|
|
589
559
|
}
|
|
590
560
|
`;
|
|
591
561
|
var GET_FLEET_STATS = `
|
|
@@ -598,6 +568,7 @@ var GET_FLEET_STATS = `
|
|
|
598
568
|
totalDrivers
|
|
599
569
|
availableDrivers
|
|
600
570
|
onDeliveryDrivers
|
|
571
|
+
avgDriverRating
|
|
601
572
|
}
|
|
602
573
|
}
|
|
603
574
|
`;
|
|
@@ -612,8 +583,8 @@ var GET_FINANCE_METRICS = `
|
|
|
612
583
|
`;
|
|
613
584
|
var DriverStatusEnum = z.enum(["AVAILABLE", "INACTIVE", "OFF_DUTY", "ON_BREAK", "ON_DELIVERY"]).describe("Availability/duty status of a driver");
|
|
614
585
|
var InventoryTransactionTypeEnum = z.enum(["ADJUSTMENT", "ISSUE", "RECEIPT", "RETURN", "TRANSFER"]).describe("Type of inventory ledger movement");
|
|
615
|
-
var
|
|
616
|
-
var
|
|
586
|
+
var DeliveryPriorityEnum = z.enum(["CRITICAL", "HIGH", "LOW", "MEDIUM", "URGENT"]).describe("Dispatch priority of a delivery job");
|
|
587
|
+
var DeliveryJobStatusEnum = z.enum([
|
|
617
588
|
"ASSIGNED",
|
|
618
589
|
"CANCELLED",
|
|
619
590
|
"CONFIRMED",
|
|
@@ -624,8 +595,7 @@ var OrderStatusEnum = z.enum([
|
|
|
624
595
|
"PENDING",
|
|
625
596
|
"PICKED_UP",
|
|
626
597
|
"RETURNED"
|
|
627
|
-
]).describe("
|
|
628
|
-
var OrderTypeEnum = z.enum(["B2B", "B2C", "MARKETPLACE", "SUBSCRIPTION"]).describe("Commercial type of an order");
|
|
598
|
+
]).describe("Lifecycle status of a delivery job");
|
|
629
599
|
var RouteStatusEnum = z.enum(["CANCELLED", "COMPLETED", "IN_PROGRESS", "PLANNED"]).describe("Lifecycle status of a route");
|
|
630
600
|
var ShipmentStatusEnum = z.enum(["DELIVERED", "FAILED", "IN_TRANSIT", "PICKED_UP", "PLANNED", "RETURNED"]).describe("Lifecycle status of a shipment");
|
|
631
601
|
var TrackingEventTypeEnum = z.enum([
|
|
@@ -675,6 +645,8 @@ var ServiceOfferingCategoryEnum = z.enum([
|
|
|
675
645
|
"OTHER"
|
|
676
646
|
]).describe("What a marketplace service offering provides");
|
|
677
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);
|
|
678
650
|
var JsonObject = z.record(z.string(), z.unknown());
|
|
679
651
|
var JsonValue = z.union([JsonObject, z.array(z.unknown())]);
|
|
680
652
|
|
|
@@ -903,7 +875,7 @@ function registerDriverTools(server, ctx, track) {
|
|
|
903
875
|
status: DriverStatusEnum.optional().describe("Initial status (default AVAILABLE)"),
|
|
904
876
|
licenseNumber: z.string().optional().describe("Driving license number"),
|
|
905
877
|
licenseClass: z.string().optional().describe("Driving license class"),
|
|
906
|
-
licenseExpiry:
|
|
878
|
+
licenseExpiry: IsoDateTime.optional().describe("License expiry (ISO 8601 date-time)"),
|
|
907
879
|
certifications: JsonObject.optional().describe("Certifications JSON"),
|
|
908
880
|
currentLocation: JsonObject.optional().describe("Current location JSON ({ lat, lng })"),
|
|
909
881
|
performanceMetrics: JsonObject.optional().describe("Performance metrics JSON"),
|
|
@@ -967,7 +939,9 @@ function registerDriverTools(server, ctx, track) {
|
|
|
967
939
|
status: DriverStatusEnum.optional().describe("Updated status"),
|
|
968
940
|
licenseNumber: z.string().optional().describe("Updated license number"),
|
|
969
941
|
licenseClass: z.string().optional().describe("Updated license class"),
|
|
970
|
-
licenseExpiry:
|
|
942
|
+
licenseExpiry: IsoDateTime.optional().describe(
|
|
943
|
+
"Updated license expiry (ISO 8601 date-time)"
|
|
944
|
+
),
|
|
971
945
|
certifications: JsonObject.optional().describe("Updated certifications JSON"),
|
|
972
946
|
currentLocation: JsonObject.optional().describe("Updated location JSON"),
|
|
973
947
|
performanceMetrics: JsonObject.optional().describe("Updated performance metrics JSON"),
|
|
@@ -1325,23 +1299,23 @@ function registerVehicleTools(server, ctx, track) {
|
|
|
1325
1299
|
}
|
|
1326
1300
|
);
|
|
1327
1301
|
}
|
|
1328
|
-
function
|
|
1302
|
+
function registerCargoTools(server, ctx, track) {
|
|
1329
1303
|
server.registerTool(
|
|
1330
1304
|
track(mcpToolName(ctx.productName, "cargo_get")),
|
|
1331
1305
|
{
|
|
1332
|
-
title: "Get
|
|
1333
|
-
description: "Fetch a single
|
|
1334
|
-
inputSchema: { id: z.string().describe("
|
|
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") }
|
|
1335
1309
|
},
|
|
1336
1310
|
async ({ id }) => {
|
|
1337
1311
|
try {
|
|
1338
|
-
const data = await ctx.gql.workspace.request(
|
|
1339
|
-
if (!data.
|
|
1340
|
-
return jsonResult(data.
|
|
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);
|
|
1341
1315
|
} catch (error) {
|
|
1342
1316
|
ctx.logger.error("movethewheels cargo_get failed", { error: String(error) });
|
|
1343
1317
|
return errorResult(
|
|
1344
|
-
`Failed to get
|
|
1318
|
+
`Failed to get cargo item: ${error instanceof Error ? error.message : String(error)}`
|
|
1345
1319
|
);
|
|
1346
1320
|
}
|
|
1347
1321
|
}
|
|
@@ -1349,8 +1323,8 @@ function registerProductTools(server, ctx, track) {
|
|
|
1349
1323
|
server.registerTool(
|
|
1350
1324
|
track(mcpToolName(ctx.productName, "cargo_list")),
|
|
1351
1325
|
{
|
|
1352
|
-
title: "List
|
|
1353
|
-
description: "List
|
|
1326
|
+
title: "List Cargo Items",
|
|
1327
|
+
description: "List cargo items with optional category/sku/text filters and pagination.",
|
|
1354
1328
|
inputSchema: {
|
|
1355
1329
|
search: z.string().optional().describe("Free-text search across name/description"),
|
|
1356
1330
|
category: z.string().optional().describe("Filter by category"),
|
|
@@ -1365,15 +1339,15 @@ function registerProductTools(server, ctx, track) {
|
|
|
1365
1339
|
if (search !== void 0) filter.search = search;
|
|
1366
1340
|
if (category !== void 0) filter.category = category;
|
|
1367
1341
|
if (sku !== void 0) filter.sku = sku;
|
|
1368
|
-
const data = await ctx.gql.workspace.request(
|
|
1342
|
+
const data = await ctx.gql.workspace.request(LIST_CARGO_ITEMS, {
|
|
1369
1343
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
1370
1344
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
1371
1345
|
});
|
|
1372
|
-
return jsonResult(data.
|
|
1346
|
+
return jsonResult(data.cargoItems);
|
|
1373
1347
|
} catch (error) {
|
|
1374
1348
|
ctx.logger.error("movethewheels cargo_list failed", { error: String(error) });
|
|
1375
1349
|
return errorResult(
|
|
1376
|
-
`Failed to list
|
|
1350
|
+
`Failed to list cargo items: ${error instanceof Error ? error.message : String(error)}`
|
|
1377
1351
|
);
|
|
1378
1352
|
}
|
|
1379
1353
|
}
|
|
@@ -1381,10 +1355,10 @@ function registerProductTools(server, ctx, track) {
|
|
|
1381
1355
|
server.registerTool(
|
|
1382
1356
|
track(mcpToolName(ctx.productName, "cargo_create")),
|
|
1383
1357
|
{
|
|
1384
|
-
title: "Create
|
|
1385
|
-
description: "Create a
|
|
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.",
|
|
1386
1360
|
inputSchema: {
|
|
1387
|
-
name: z.string().min(1).describe("
|
|
1361
|
+
name: z.string().min(1).describe("Cargo item name"),
|
|
1388
1362
|
sku: z.string().min(1).describe("Stock-keeping unit (unique)"),
|
|
1389
1363
|
description: z.string().optional().describe("Description"),
|
|
1390
1364
|
category: z.string().optional().describe("Category"),
|
|
@@ -1423,12 +1397,12 @@ function registerProductTools(server, ctx, track) {
|
|
|
1423
1397
|
if (temperatureControlled !== void 0) {
|
|
1424
1398
|
input.temperatureControlled = temperatureControlled;
|
|
1425
1399
|
}
|
|
1426
|
-
const data = await ctx.gql.workspace.request(
|
|
1427
|
-
return jsonResult(data.
|
|
1400
|
+
const data = await ctx.gql.workspace.request(CREATE_CARGO_ITEM, { input });
|
|
1401
|
+
return jsonResult(data.createCargoItem);
|
|
1428
1402
|
} catch (error) {
|
|
1429
1403
|
ctx.logger.error("movethewheels cargo_create failed", { error: String(error) });
|
|
1430
1404
|
return errorResult(
|
|
1431
|
-
`Failed to create
|
|
1405
|
+
`Failed to create cargo item: ${error instanceof Error ? error.message : String(error)}`
|
|
1432
1406
|
);
|
|
1433
1407
|
}
|
|
1434
1408
|
}
|
|
@@ -1436,10 +1410,10 @@ function registerProductTools(server, ctx, track) {
|
|
|
1436
1410
|
server.registerTool(
|
|
1437
1411
|
track(mcpToolName(ctx.productName, "cargo_update")),
|
|
1438
1412
|
{
|
|
1439
|
-
title: "Update
|
|
1440
|
-
description: "Update a
|
|
1413
|
+
title: "Update Cargo Item",
|
|
1414
|
+
description: "Update a cargo item. At least one mutable field must be provided.",
|
|
1441
1415
|
inputSchema: {
|
|
1442
|
-
id: z.string().describe("
|
|
1416
|
+
id: z.string().describe("Cargo item ID"),
|
|
1443
1417
|
name: z.string().optional().describe("Updated name"),
|
|
1444
1418
|
sku: z.string().optional().describe("Updated SKU"),
|
|
1445
1419
|
description: z.string().optional().describe("Updated description"),
|
|
@@ -1485,12 +1459,12 @@ function registerProductTools(server, ctx, track) {
|
|
|
1485
1459
|
if (Object.keys(input).length === 0) {
|
|
1486
1460
|
return errorResult("No updates specified \u2014 provide at least one mutable field.");
|
|
1487
1461
|
}
|
|
1488
|
-
const data = await ctx.gql.workspace.request(
|
|
1489
|
-
return jsonResult(data.
|
|
1462
|
+
const data = await ctx.gql.workspace.request(UPDATE_CARGO_ITEM, { id, input });
|
|
1463
|
+
return jsonResult(data.updateCargoItem);
|
|
1490
1464
|
} catch (error) {
|
|
1491
1465
|
ctx.logger.error("movethewheels cargo_update failed", { error: String(error) });
|
|
1492
1466
|
return errorResult(
|
|
1493
|
-
`Failed to update
|
|
1467
|
+
`Failed to update cargo item: ${error instanceof Error ? error.message : String(error)}`
|
|
1494
1468
|
);
|
|
1495
1469
|
}
|
|
1496
1470
|
}
|
|
@@ -1498,62 +1472,63 @@ function registerProductTools(server, ctx, track) {
|
|
|
1498
1472
|
server.registerTool(
|
|
1499
1473
|
track(mcpToolName(ctx.productName, "cargo_delete")),
|
|
1500
1474
|
{
|
|
1501
|
-
title: "Delete
|
|
1502
|
-
description: "Soft-delete a
|
|
1503
|
-
inputSchema: { id: z.string().describe("
|
|
1475
|
+
title: "Delete Cargo Item",
|
|
1476
|
+
description: "Soft-delete a cargo item by ID.",
|
|
1477
|
+
inputSchema: { id: z.string().describe("Cargo item ID") }
|
|
1504
1478
|
},
|
|
1505
1479
|
async ({ id }) => {
|
|
1506
1480
|
try {
|
|
1507
1481
|
const data = await ctx.gql.workspace.request(
|
|
1508
|
-
|
|
1482
|
+
DELETE_CARGO_ITEM,
|
|
1509
1483
|
{ id }
|
|
1510
1484
|
);
|
|
1511
|
-
return jsonResult({ deleted: data.
|
|
1485
|
+
return jsonResult({ deleted: data.deleteCargoItem, id });
|
|
1512
1486
|
} catch (error) {
|
|
1513
1487
|
ctx.logger.error("movethewheels cargo_delete failed", { error: String(error) });
|
|
1514
1488
|
return errorResult(
|
|
1515
|
-
`Failed to delete
|
|
1489
|
+
`Failed to delete cargo item: ${error instanceof Error ? error.message : String(error)}`
|
|
1516
1490
|
);
|
|
1517
1491
|
}
|
|
1518
1492
|
}
|
|
1519
1493
|
);
|
|
1520
1494
|
}
|
|
1521
|
-
|
|
1495
|
+
var errorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
1496
|
+
function registerDeliveryJobTools(server, ctx, track) {
|
|
1522
1497
|
server.registerTool(
|
|
1523
|
-
track(mcpToolName(ctx.productName, "
|
|
1498
|
+
track(mcpToolName(ctx.productName, "delivery_jobs_get")),
|
|
1524
1499
|
{
|
|
1525
|
-
title: "Get
|
|
1526
|
-
description: "Fetch a single delivery
|
|
1527
|
-
inputSchema: { id: z.string().describe("
|
|
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") }
|
|
1528
1503
|
},
|
|
1529
1504
|
async ({ id }) => {
|
|
1530
1505
|
try {
|
|
1531
|
-
const data = await ctx.gql.workspace.request(
|
|
1532
|
-
if (!data.
|
|
1533
|
-
return jsonResult(data.
|
|
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);
|
|
1534
1509
|
} catch (error) {
|
|
1535
|
-
ctx.logger.error("movethewheels
|
|
1536
|
-
return errorResult(
|
|
1537
|
-
`Failed to get order: ${error instanceof Error ? error.message : String(error)}`
|
|
1538
|
-
);
|
|
1510
|
+
ctx.logger.error("movethewheels delivery_jobs_get failed", { error: String(error) });
|
|
1511
|
+
return errorResult(`Failed to get delivery job: ${errorMessage(error)}`);
|
|
1539
1512
|
}
|
|
1540
1513
|
}
|
|
1541
1514
|
);
|
|
1542
1515
|
server.registerTool(
|
|
1543
|
-
track(mcpToolName(ctx.productName, "
|
|
1516
|
+
track(mcpToolName(ctx.productName, "delivery_jobs_list")),
|
|
1544
1517
|
{
|
|
1545
|
-
title: "List
|
|
1546
|
-
description: "List delivery
|
|
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.",
|
|
1547
1520
|
inputSchema: {
|
|
1548
|
-
search: z.string().optional().describe("Free-text search across
|
|
1521
|
+
search: z.string().optional().describe("Free-text search across deliveryJobNumber"),
|
|
1549
1522
|
customerId: z.string().optional().describe("Filter by customer ID"),
|
|
1550
1523
|
driverId: z.string().optional().describe("Filter by driver ID"),
|
|
1551
1524
|
vehicleId: z.string().optional().describe("Filter by vehicle ID"),
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
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)")
|
|
1557
1532
|
}
|
|
1558
1533
|
},
|
|
1559
1534
|
async ({
|
|
@@ -1561,9 +1536,11 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1561
1536
|
customerId,
|
|
1562
1537
|
driverId,
|
|
1563
1538
|
vehicleId,
|
|
1564
|
-
|
|
1539
|
+
routeId,
|
|
1540
|
+
storeOrderId,
|
|
1565
1541
|
priority,
|
|
1566
1542
|
status,
|
|
1543
|
+
unassigned,
|
|
1567
1544
|
limit,
|
|
1568
1545
|
offset
|
|
1569
1546
|
}) => {
|
|
@@ -1573,55 +1550,61 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1573
1550
|
if (customerId !== void 0) filter.customerId = customerId;
|
|
1574
1551
|
if (driverId !== void 0) filter.driverId = driverId;
|
|
1575
1552
|
if (vehicleId !== void 0) filter.vehicleId = vehicleId;
|
|
1576
|
-
if (
|
|
1553
|
+
if (routeId !== void 0) filter.routeId = routeId;
|
|
1554
|
+
if (storeOrderId !== void 0) filter.storeOrderId = storeOrderId;
|
|
1577
1555
|
if (priority !== void 0) filter.priority = priority;
|
|
1578
1556
|
if (status !== void 0) filter.status = status;
|
|
1579
|
-
|
|
1557
|
+
if (unassigned !== void 0) filter.unassigned = unassigned;
|
|
1558
|
+
const data = await ctx.gql.workspace.request(LIST_DELIVERY_JOBS, {
|
|
1580
1559
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
1581
1560
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
1582
1561
|
});
|
|
1583
|
-
return jsonResult(data.
|
|
1562
|
+
return jsonResult(data.deliveryJobs);
|
|
1584
1563
|
} catch (error) {
|
|
1585
|
-
ctx.logger.error("movethewheels
|
|
1586
|
-
return errorResult(
|
|
1587
|
-
`Failed to list orders: ${error instanceof Error ? error.message : String(error)}`
|
|
1588
|
-
);
|
|
1564
|
+
ctx.logger.error("movethewheels delivery_jobs_list failed", { error: String(error) });
|
|
1565
|
+
return errorResult(`Failed to list delivery jobs: ${errorMessage(error)}`);
|
|
1589
1566
|
}
|
|
1590
1567
|
}
|
|
1591
1568
|
);
|
|
1592
1569
|
server.registerTool(
|
|
1593
|
-
track(mcpToolName(ctx.productName, "
|
|
1570
|
+
track(mcpToolName(ctx.productName, "delivery_jobs_create")),
|
|
1594
1571
|
{
|
|
1595
|
-
title: "Create
|
|
1596
|
-
description: "Create a delivery
|
|
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.",
|
|
1597
1574
|
inputSchema: {
|
|
1598
|
-
customerId: z.string().min(1).describe("
|
|
1599
|
-
|
|
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)"),
|
|
1600
1577
|
pickupAddress: JsonObject.describe("Pickup address JSON"),
|
|
1601
1578
|
deliveryAddress: JsonObject.describe("Delivery address JSON"),
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
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)"),
|
|
1606
1584
|
driverId: z.string().optional().describe("Assigned driver ID"),
|
|
1607
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"),
|
|
1608
1588
|
pricing: JsonObject.optional().describe("Pricing breakdown JSON"),
|
|
1609
|
-
scheduledDelivery:
|
|
1589
|
+
scheduledDelivery: IsoDateTime.optional().describe(
|
|
1590
|
+
"Scheduled delivery (ISO 8601 date-time)"
|
|
1591
|
+
),
|
|
1610
1592
|
specialInstructions: z.string().optional().describe("Special handling instructions"),
|
|
1611
1593
|
trackingNumber: z.string().optional().describe("Tracking number")
|
|
1612
1594
|
}
|
|
1613
1595
|
},
|
|
1614
1596
|
async ({
|
|
1615
1597
|
customerId,
|
|
1616
|
-
|
|
1598
|
+
deliveryJobNumber,
|
|
1617
1599
|
pickupAddress,
|
|
1618
1600
|
deliveryAddress,
|
|
1619
|
-
|
|
1620
|
-
orderType,
|
|
1601
|
+
cargoItems,
|
|
1621
1602
|
priority,
|
|
1622
1603
|
status,
|
|
1623
1604
|
driverId,
|
|
1624
1605
|
vehicleId,
|
|
1606
|
+
routeId,
|
|
1607
|
+
storeOrderId,
|
|
1625
1608
|
pricing,
|
|
1626
1609
|
scheduledDelivery,
|
|
1627
1610
|
specialInstructions,
|
|
@@ -1630,48 +1613,49 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1630
1613
|
try {
|
|
1631
1614
|
const input = {
|
|
1632
1615
|
customerId,
|
|
1633
|
-
|
|
1616
|
+
deliveryJobNumber,
|
|
1634
1617
|
pickupAddress,
|
|
1635
1618
|
deliveryAddress,
|
|
1636
|
-
|
|
1619
|
+
cargoItems
|
|
1637
1620
|
};
|
|
1638
|
-
if (orderType !== void 0) input.orderType = orderType;
|
|
1639
1621
|
if (priority !== void 0) input.priority = priority;
|
|
1640
1622
|
if (status !== void 0) input.status = status;
|
|
1641
1623
|
if (driverId !== void 0) input.driverId = driverId;
|
|
1642
1624
|
if (vehicleId !== void 0) input.vehicleId = vehicleId;
|
|
1625
|
+
if (routeId !== void 0) input.routeId = routeId;
|
|
1626
|
+
if (storeOrderId !== void 0) input.storeOrderId = storeOrderId;
|
|
1643
1627
|
if (pricing !== void 0) input.pricing = pricing;
|
|
1644
1628
|
if (scheduledDelivery !== void 0) input.scheduledDelivery = scheduledDelivery;
|
|
1645
1629
|
if (specialInstructions !== void 0) input.specialInstructions = specialInstructions;
|
|
1646
1630
|
if (trackingNumber !== void 0) input.trackingNumber = trackingNumber;
|
|
1647
|
-
const data = await ctx.gql.workspace.request(
|
|
1648
|
-
return jsonResult(data.
|
|
1631
|
+
const data = await ctx.gql.workspace.request(CREATE_DELIVERY_JOB, { input });
|
|
1632
|
+
return jsonResult(data.createDeliveryJob);
|
|
1649
1633
|
} catch (error) {
|
|
1650
|
-
ctx.logger.error("movethewheels
|
|
1651
|
-
return errorResult(
|
|
1652
|
-
`Failed to create order: ${error instanceof Error ? error.message : String(error)}`
|
|
1653
|
-
);
|
|
1634
|
+
ctx.logger.error("movethewheels delivery_jobs_create failed", { error: String(error) });
|
|
1635
|
+
return errorResult(`Failed to create delivery job: ${errorMessage(error)}`);
|
|
1654
1636
|
}
|
|
1655
1637
|
}
|
|
1656
1638
|
);
|
|
1657
1639
|
server.registerTool(
|
|
1658
|
-
track(mcpToolName(ctx.productName, "
|
|
1640
|
+
track(mcpToolName(ctx.productName, "delivery_jobs_update")),
|
|
1659
1641
|
{
|
|
1660
|
-
title: "Update
|
|
1661
|
-
description: "Update a delivery
|
|
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.",
|
|
1662
1644
|
inputSchema: {
|
|
1663
|
-
id: z.string().describe("
|
|
1645
|
+
id: z.string().describe("Delivery job ID"),
|
|
1664
1646
|
customerId: z.string().optional().describe("Updated customer ID"),
|
|
1665
1647
|
driverId: z.string().optional().describe("Updated driver ID"),
|
|
1666
1648
|
vehicleId: z.string().optional().describe("Updated vehicle ID"),
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
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"),
|
|
1670
1652
|
pickupAddress: JsonObject.optional().describe("Updated pickup address JSON"),
|
|
1671
1653
|
deliveryAddress: JsonObject.optional().describe("Updated delivery address JSON"),
|
|
1672
|
-
|
|
1654
|
+
cargoItems: JsonValue.optional().describe("Updated cargo JSON"),
|
|
1673
1655
|
pricing: JsonObject.optional().describe("Updated pricing JSON"),
|
|
1674
|
-
scheduledDelivery:
|
|
1656
|
+
scheduledDelivery: IsoDateTime.optional().describe(
|
|
1657
|
+
"Updated scheduled delivery (ISO 8601 date-time)"
|
|
1658
|
+
),
|
|
1675
1659
|
specialInstructions: z.string().optional().describe("Updated special instructions"),
|
|
1676
1660
|
trackingNumber: z.string().optional().describe("Updated tracking number")
|
|
1677
1661
|
}
|
|
@@ -1681,12 +1665,12 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1681
1665
|
customerId,
|
|
1682
1666
|
driverId,
|
|
1683
1667
|
vehicleId,
|
|
1684
|
-
|
|
1668
|
+
routeId,
|
|
1669
|
+
storeOrderId,
|
|
1685
1670
|
priority,
|
|
1686
|
-
status,
|
|
1687
1671
|
pickupAddress,
|
|
1688
1672
|
deliveryAddress,
|
|
1689
|
-
|
|
1673
|
+
cargoItems,
|
|
1690
1674
|
pricing,
|
|
1691
1675
|
scheduledDelivery,
|
|
1692
1676
|
specialInstructions,
|
|
@@ -1697,12 +1681,12 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1697
1681
|
if (customerId !== void 0) input.customerId = customerId;
|
|
1698
1682
|
if (driverId !== void 0) input.driverId = driverId;
|
|
1699
1683
|
if (vehicleId !== void 0) input.vehicleId = vehicleId;
|
|
1700
|
-
if (
|
|
1684
|
+
if (routeId !== void 0) input.routeId = routeId;
|
|
1685
|
+
if (storeOrderId !== void 0) input.storeOrderId = storeOrderId;
|
|
1701
1686
|
if (priority !== void 0) input.priority = priority;
|
|
1702
|
-
if (status !== void 0) input.status = status;
|
|
1703
1687
|
if (pickupAddress !== void 0) input.pickupAddress = pickupAddress;
|
|
1704
1688
|
if (deliveryAddress !== void 0) input.deliveryAddress = deliveryAddress;
|
|
1705
|
-
if (
|
|
1689
|
+
if (cargoItems !== void 0) input.cargoItems = cargoItems;
|
|
1706
1690
|
if (pricing !== void 0) input.pricing = pricing;
|
|
1707
1691
|
if (scheduledDelivery !== void 0) input.scheduledDelivery = scheduledDelivery;
|
|
1708
1692
|
if (specialInstructions !== void 0) input.specialInstructions = specialInstructions;
|
|
@@ -1710,26 +1694,24 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1710
1694
|
if (Object.keys(input).length === 0) {
|
|
1711
1695
|
return errorResult("No updates specified \u2014 provide at least one mutable field.");
|
|
1712
1696
|
}
|
|
1713
|
-
const data = await ctx.gql.workspace.request(
|
|
1714
|
-
return jsonResult(data.
|
|
1697
|
+
const data = await ctx.gql.workspace.request(UPDATE_DELIVERY_JOB, { id, input });
|
|
1698
|
+
return jsonResult(data.updateDeliveryJob);
|
|
1715
1699
|
} catch (error) {
|
|
1716
|
-
ctx.logger.error("movethewheels
|
|
1717
|
-
return errorResult(
|
|
1718
|
-
`Failed to update order: ${error instanceof Error ? error.message : String(error)}`
|
|
1719
|
-
);
|
|
1700
|
+
ctx.logger.error("movethewheels delivery_jobs_update failed", { error: String(error) });
|
|
1701
|
+
return errorResult(`Failed to update delivery job: ${errorMessage(error)}`);
|
|
1720
1702
|
}
|
|
1721
1703
|
}
|
|
1722
1704
|
);
|
|
1723
1705
|
server.registerTool(
|
|
1724
|
-
track(mcpToolName(ctx.productName, "
|
|
1706
|
+
track(mcpToolName(ctx.productName, "delivery_jobs_update_status")),
|
|
1725
1707
|
{
|
|
1726
|
-
title: "Update
|
|
1727
|
-
description: "Advance
|
|
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.",
|
|
1728
1710
|
inputSchema: {
|
|
1729
|
-
id: z.string().describe("
|
|
1730
|
-
status:
|
|
1711
|
+
id: z.string().describe("Delivery job ID"),
|
|
1712
|
+
status: DeliveryJobStatusEnum.describe("New delivery job status"),
|
|
1731
1713
|
notes: z.string().optional().describe("Status-change notes"),
|
|
1732
|
-
location: JsonObject.optional().describe("Location JSON at time of
|
|
1714
|
+
location: JsonObject.optional().describe("Location JSON at the time of the change")
|
|
1733
1715
|
}
|
|
1734
1716
|
},
|
|
1735
1717
|
async ({ id, status, notes, location }) => {
|
|
@@ -1737,35 +1719,33 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1737
1719
|
const input = { status };
|
|
1738
1720
|
if (notes !== void 0) input.notes = notes;
|
|
1739
1721
|
if (location !== void 0) input.location = location;
|
|
1740
|
-
const data = await ctx.gql.workspace.request(
|
|
1741
|
-
return jsonResult(data.
|
|
1722
|
+
const data = await ctx.gql.workspace.request(UPDATE_DELIVERY_JOB_STATUS, { id, input });
|
|
1723
|
+
return jsonResult(data.updateDeliveryJobStatus);
|
|
1742
1724
|
} catch (error) {
|
|
1743
|
-
ctx.logger.error("movethewheels
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
);
|
|
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)}`);
|
|
1747
1729
|
}
|
|
1748
1730
|
}
|
|
1749
1731
|
);
|
|
1750
1732
|
server.registerTool(
|
|
1751
|
-
track(mcpToolName(ctx.productName, "
|
|
1733
|
+
track(mcpToolName(ctx.productName, "delivery_jobs_delete")),
|
|
1752
1734
|
{
|
|
1753
|
-
title: "Delete
|
|
1754
|
-
description: "Soft-delete a delivery
|
|
1755
|
-
inputSchema: { id: z.string().describe("
|
|
1735
|
+
title: "Delete Delivery Job",
|
|
1736
|
+
description: "Soft-delete a delivery job by ID.",
|
|
1737
|
+
inputSchema: { id: z.string().describe("Delivery job ID") }
|
|
1756
1738
|
},
|
|
1757
1739
|
async ({ id }) => {
|
|
1758
1740
|
try {
|
|
1759
1741
|
const data = await ctx.gql.workspace.request(
|
|
1760
|
-
|
|
1742
|
+
DELETE_DELIVERY_JOB,
|
|
1761
1743
|
{ id }
|
|
1762
1744
|
);
|
|
1763
|
-
return jsonResult({ deleted: data.
|
|
1745
|
+
return jsonResult({ deleted: data.deleteDeliveryJob, id });
|
|
1764
1746
|
} catch (error) {
|
|
1765
|
-
ctx.logger.error("movethewheels
|
|
1766
|
-
return errorResult(
|
|
1767
|
-
`Failed to delete order: ${error instanceof Error ? error.message : String(error)}`
|
|
1768
|
-
);
|
|
1747
|
+
ctx.logger.error("movethewheels delivery_jobs_delete failed", { error: String(error) });
|
|
1748
|
+
return errorResult(`Failed to delete delivery job: ${errorMessage(error)}`);
|
|
1769
1749
|
}
|
|
1770
1750
|
}
|
|
1771
1751
|
);
|
|
@@ -1775,7 +1755,7 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1775
1755
|
track(mcpToolName(ctx.productName, "shipments_get")),
|
|
1776
1756
|
{
|
|
1777
1757
|
title: "Get Shipment",
|
|
1778
|
-
description: "Fetch a single shipment by ID, including its
|
|
1758
|
+
description: "Fetch a single shipment by ID, including its delivery job, marketplace carrier and tracking events.",
|
|
1779
1759
|
inputSchema: { id: z.string().describe("Shipment ID") }
|
|
1780
1760
|
},
|
|
1781
1761
|
async ({ id }) => {
|
|
@@ -1795,24 +1775,38 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1795
1775
|
track(mcpToolName(ctx.productName, "shipments_list")),
|
|
1796
1776
|
{
|
|
1797
1777
|
title: "List Shipments",
|
|
1798
|
-
description: "List shipments with optional
|
|
1778
|
+
description: "List shipments with optional delivery-job/customer/carrier/driver/vehicle/status/text filters and pagination.",
|
|
1799
1779
|
inputSchema: {
|
|
1800
1780
|
search: z.string().optional().describe("Free-text search across shipmentNumber"),
|
|
1801
|
-
|
|
1781
|
+
deliveryJobId: z.string().optional().describe("Filter by delivery job ID"),
|
|
1802
1782
|
customerId: z.string().optional().describe("Filter by customer ID"),
|
|
1803
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"),
|
|
1804
1786
|
status: ShipmentStatusEnum.optional().describe("Filter by shipment status"),
|
|
1805
1787
|
limit: z.number().int().optional().describe("Page size (default 50)"),
|
|
1806
1788
|
offset: z.number().int().optional().describe("Pagination offset (default 0)")
|
|
1807
1789
|
}
|
|
1808
1790
|
},
|
|
1809
|
-
async ({
|
|
1791
|
+
async ({
|
|
1792
|
+
search,
|
|
1793
|
+
deliveryJobId,
|
|
1794
|
+
customerId,
|
|
1795
|
+
carrierId,
|
|
1796
|
+
driverId,
|
|
1797
|
+
vehicleId,
|
|
1798
|
+
status,
|
|
1799
|
+
limit,
|
|
1800
|
+
offset
|
|
1801
|
+
}) => {
|
|
1810
1802
|
try {
|
|
1811
1803
|
const filter = {};
|
|
1812
1804
|
if (search !== void 0) filter.search = search;
|
|
1813
|
-
if (
|
|
1805
|
+
if (deliveryJobId !== void 0) filter.deliveryJobId = deliveryJobId;
|
|
1814
1806
|
if (customerId !== void 0) filter.customerId = customerId;
|
|
1815
1807
|
if (carrierId !== void 0) filter.carrierId = carrierId;
|
|
1808
|
+
if (driverId !== void 0) filter.driverId = driverId;
|
|
1809
|
+
if (vehicleId !== void 0) filter.vehicleId = vehicleId;
|
|
1816
1810
|
if (status !== void 0) filter.status = status;
|
|
1817
1811
|
const data = await ctx.gql.workspace.request(LIST_SHIPMENTS, {
|
|
1818
1812
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
@@ -1857,27 +1851,31 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1857
1851
|
track(mcpToolName(ctx.productName, "shipments_create")),
|
|
1858
1852
|
{
|
|
1859
1853
|
title: "Create Shipment",
|
|
1860
|
-
description: "Create a shipment
|
|
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.",
|
|
1861
1855
|
inputSchema: {
|
|
1862
|
-
orderId: z.string().min(1).describe("Source order ID"),
|
|
1863
1856
|
shipmentNumber: z.string().min(1).describe("Human-readable shipment number (unique)"),
|
|
1864
1857
|
origin: JsonObject.describe("Origin address JSON"),
|
|
1865
1858
|
destination: JsonObject.describe("Destination address JSON"),
|
|
1866
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"),
|
|
1867
1862
|
customerId: z.string().optional().describe("Customer ID"),
|
|
1868
1863
|
carrierId: z.string().optional().describe("Carrier ID"),
|
|
1869
1864
|
trackingNumber: z.string().optional().describe("Carrier tracking number"),
|
|
1870
1865
|
cargoDetails: JsonObject.optional().describe("Cargo details JSON"),
|
|
1871
|
-
estimatedDelivery:
|
|
1872
|
-
|
|
1866
|
+
estimatedDelivery: IsoDateTime.optional().describe(
|
|
1867
|
+
"Estimated delivery (ISO 8601 date-time)"
|
|
1868
|
+
),
|
|
1869
|
+
actualDelivery: IsoDateTime.optional().describe("Actual delivery (ISO 8601 date-time)")
|
|
1873
1870
|
}
|
|
1874
1871
|
},
|
|
1875
1872
|
async ({
|
|
1876
|
-
orderId,
|
|
1877
1873
|
shipmentNumber,
|
|
1878
1874
|
origin,
|
|
1879
1875
|
destination,
|
|
1880
1876
|
status,
|
|
1877
|
+
deliveryJobId,
|
|
1878
|
+
storeOrderId,
|
|
1881
1879
|
customerId,
|
|
1882
1880
|
carrierId,
|
|
1883
1881
|
trackingNumber,
|
|
@@ -1886,8 +1884,10 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1886
1884
|
actualDelivery
|
|
1887
1885
|
}) => {
|
|
1888
1886
|
try {
|
|
1889
|
-
const input = {
|
|
1887
|
+
const input = { shipmentNumber, origin, destination };
|
|
1890
1888
|
if (status !== void 0) input.status = status;
|
|
1889
|
+
if (deliveryJobId !== void 0) input.deliveryJobId = deliveryJobId;
|
|
1890
|
+
if (storeOrderId !== void 0) input.storeOrderId = storeOrderId;
|
|
1891
1891
|
if (customerId !== void 0) input.customerId = customerId;
|
|
1892
1892
|
if (carrierId !== void 0) input.carrierId = carrierId;
|
|
1893
1893
|
if (trackingNumber !== void 0) input.trackingNumber = trackingNumber;
|
|
@@ -1912,19 +1912,31 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1912
1912
|
inputSchema: {
|
|
1913
1913
|
id: z.string().describe("Shipment ID"),
|
|
1914
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"),
|
|
1915
1920
|
customerId: z.string().optional().describe("Updated customer ID"),
|
|
1916
1921
|
carrierId: z.string().optional().describe("Updated carrier ID"),
|
|
1917
1922
|
origin: JsonObject.optional().describe("Updated origin JSON"),
|
|
1918
1923
|
destination: JsonObject.optional().describe("Updated destination JSON"),
|
|
1919
1924
|
trackingNumber: z.string().optional().describe("Updated tracking number"),
|
|
1920
1925
|
cargoDetails: JsonObject.optional().describe("Updated cargo details JSON"),
|
|
1921
|
-
estimatedDelivery:
|
|
1922
|
-
|
|
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
|
+
)
|
|
1923
1932
|
}
|
|
1924
1933
|
},
|
|
1925
1934
|
async ({
|
|
1926
1935
|
id,
|
|
1927
1936
|
status,
|
|
1937
|
+
statusReason,
|
|
1938
|
+
expectedStatusRevision,
|
|
1939
|
+
deliveryJobId,
|
|
1928
1940
|
customerId,
|
|
1929
1941
|
carrierId,
|
|
1930
1942
|
origin,
|
|
@@ -1937,6 +1949,11 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1937
1949
|
try {
|
|
1938
1950
|
const input = {};
|
|
1939
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;
|
|
1940
1957
|
if (customerId !== void 0) input.customerId = customerId;
|
|
1941
1958
|
if (carrierId !== void 0) input.carrierId = carrierId;
|
|
1942
1959
|
if (origin !== void 0) input.origin = origin;
|
|
@@ -1983,27 +2000,29 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1983
2000
|
}
|
|
1984
2001
|
function registerTrackingTools(server, ctx, track) {
|
|
1985
2002
|
server.registerTool(
|
|
1986
|
-
track(mcpToolName(ctx.productName, "
|
|
2003
|
+
track(mcpToolName(ctx.productName, "tracking_delivery_job_events")),
|
|
1987
2004
|
{
|
|
1988
|
-
title: "
|
|
1989
|
-
description: "List tracking events for
|
|
2005
|
+
title: "Delivery Job Tracking Timeline",
|
|
2006
|
+
description: "List tracking events for a delivery job (across its shipments), most recent first.",
|
|
1990
2007
|
inputSchema: {
|
|
1991
|
-
|
|
2008
|
+
deliveryJobId: z.string().describe("Delivery job ID"),
|
|
1992
2009
|
limit: z.number().int().optional().describe("Page size (default 50)"),
|
|
1993
2010
|
offset: z.number().int().optional().describe("Pagination offset (default 0)")
|
|
1994
2011
|
}
|
|
1995
2012
|
},
|
|
1996
|
-
async ({
|
|
2013
|
+
async ({ deliveryJobId, limit, offset }) => {
|
|
1997
2014
|
try {
|
|
1998
|
-
const data = await ctx.gql.workspace.request(
|
|
1999
|
-
|
|
2015
|
+
const data = await ctx.gql.workspace.request(GET_DELIVERY_JOB_TRACKING, {
|
|
2016
|
+
deliveryJobId,
|
|
2000
2017
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
2001
2018
|
});
|
|
2002
|
-
return jsonResult(data.
|
|
2019
|
+
return jsonResult(data.deliveryJobTracking);
|
|
2003
2020
|
} catch (error) {
|
|
2004
|
-
ctx.logger.error("movethewheels
|
|
2021
|
+
ctx.logger.error("movethewheels tracking_delivery_job_events failed", {
|
|
2022
|
+
error: String(error)
|
|
2023
|
+
});
|
|
2005
2024
|
return errorResult(
|
|
2006
|
-
`Failed to get
|
|
2025
|
+
`Failed to get delivery job tracking: ${error instanceof Error ? error.message : String(error)}`
|
|
2007
2026
|
);
|
|
2008
2027
|
}
|
|
2009
2028
|
}
|
|
@@ -2038,7 +2057,7 @@ function registerTrackingTools(server, ctx, track) {
|
|
|
2038
2057
|
track(mcpToolName(ctx.productName, "tracking_alerts")),
|
|
2039
2058
|
{
|
|
2040
2059
|
title: "Tracking Alerts",
|
|
2041
|
-
description: "List
|
|
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).",
|
|
2042
2061
|
inputSchema: {
|
|
2043
2062
|
limit: z.number().int().optional().describe("Page size (default 50)"),
|
|
2044
2063
|
offset: z.number().int().optional().describe("Pagination offset (default 0)")
|
|
@@ -2068,7 +2087,7 @@ function registerTrackingTools(server, ctx, track) {
|
|
|
2068
2087
|
eventType: TrackingEventTypeEnum.describe("Type of tracking event"),
|
|
2069
2088
|
details: z.string().optional().describe("Free-text event details"),
|
|
2070
2089
|
location: JsonObject.optional().describe("Location JSON ({ lat, lng, address })"),
|
|
2071
|
-
timestamp:
|
|
2090
|
+
timestamp: IsoDateTime.optional().describe("Event timestamp (ISO 8601; defaults to now)")
|
|
2072
2091
|
}
|
|
2073
2092
|
},
|
|
2074
2093
|
async ({ shipmentId, eventType, details, location, timestamp }) => {
|
|
@@ -2582,7 +2601,7 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2582
2601
|
track(mcpToolName(ctx.productName, "inventory_get_item")),
|
|
2583
2602
|
{
|
|
2584
2603
|
title: "Get Inventory Item",
|
|
2585
|
-
description: "Fetch a single inventory item by ID, including its
|
|
2604
|
+
description: "Fetch a single inventory item by ID, including its cargo item, warehouse, and location.",
|
|
2586
2605
|
inputSchema: { id: z.string().describe("Inventory item ID") }
|
|
2587
2606
|
},
|
|
2588
2607
|
async ({ id }) => {
|
|
@@ -2602,23 +2621,25 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2602
2621
|
track(mcpToolName(ctx.productName, "inventory_list_items")),
|
|
2603
2622
|
{
|
|
2604
2623
|
title: "List Inventory Items",
|
|
2605
|
-
description: "List inventory items with optional
|
|
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.",
|
|
2606
2625
|
inputSchema: {
|
|
2607
2626
|
search: z.string().optional().describe("Free-text search"),
|
|
2608
|
-
|
|
2627
|
+
cargoItemId: z.string().optional().describe("Filter by cargo item ID"),
|
|
2609
2628
|
warehouseId: z.string().optional().describe("Filter by warehouse ID"),
|
|
2610
2629
|
locationId: z.string().optional().describe("Filter by location ID"),
|
|
2630
|
+
lowStock: z.boolean().optional().describe("Only items at or below their reorder point"),
|
|
2611
2631
|
limit: z.number().int().optional().describe("Page size (default 50)"),
|
|
2612
2632
|
offset: z.number().int().optional().describe("Pagination offset (default 0)")
|
|
2613
2633
|
}
|
|
2614
2634
|
},
|
|
2615
|
-
async ({ search,
|
|
2635
|
+
async ({ search, cargoItemId, warehouseId, locationId, lowStock, limit, offset }) => {
|
|
2616
2636
|
try {
|
|
2617
2637
|
const filter = {};
|
|
2618
2638
|
if (search !== void 0) filter.search = search;
|
|
2619
|
-
if (
|
|
2639
|
+
if (cargoItemId !== void 0) filter.cargoItemId = cargoItemId;
|
|
2620
2640
|
if (warehouseId !== void 0) filter.warehouseId = warehouseId;
|
|
2621
2641
|
if (locationId !== void 0) filter.locationId = locationId;
|
|
2642
|
+
if (lowStock !== void 0) filter.lowStock = lowStock;
|
|
2622
2643
|
const data = await ctx.gql.workspace.request(LIST_INVENTORY_ITEMS, {
|
|
2623
2644
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
2624
2645
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
@@ -2655,23 +2676,25 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2655
2676
|
track(mcpToolName(ctx.productName, "inventory_list_transactions")),
|
|
2656
2677
|
{
|
|
2657
2678
|
title: "List Inventory Transactions",
|
|
2658
|
-
description: "List inventory ledger transactions (receipts/issues/transfers/adjustments/returns) with optional
|
|
2679
|
+
description: "List inventory ledger transactions (receipts/issues/transfers/adjustments/returns) with optional cargo-item/warehouse/location/inventory-item/text filters.",
|
|
2659
2680
|
inputSchema: {
|
|
2660
2681
|
search: z.string().optional().describe("Free-text search"),
|
|
2661
|
-
|
|
2682
|
+
cargoItemId: z.string().optional().describe("Filter by cargo item ID"),
|
|
2662
2683
|
warehouseId: z.string().optional().describe("Filter by warehouse ID"),
|
|
2663
2684
|
locationId: z.string().optional().describe("Filter by location ID"),
|
|
2685
|
+
inventoryItemId: z.string().optional().describe("Filter by inventory item ID"),
|
|
2664
2686
|
limit: z.number().int().optional().describe("Page size (default 50)"),
|
|
2665
2687
|
offset: z.number().int().optional().describe("Pagination offset (default 0)")
|
|
2666
2688
|
}
|
|
2667
2689
|
},
|
|
2668
|
-
async ({ search,
|
|
2690
|
+
async ({ search, cargoItemId, warehouseId, locationId, inventoryItemId, limit, offset }) => {
|
|
2669
2691
|
try {
|
|
2670
2692
|
const filter = {};
|
|
2671
2693
|
if (search !== void 0) filter.search = search;
|
|
2672
|
-
if (
|
|
2694
|
+
if (cargoItemId !== void 0) filter.cargoItemId = cargoItemId;
|
|
2673
2695
|
if (warehouseId !== void 0) filter.warehouseId = warehouseId;
|
|
2674
2696
|
if (locationId !== void 0) filter.locationId = locationId;
|
|
2697
|
+
if (inventoryItemId !== void 0) filter.inventoryItemId = inventoryItemId;
|
|
2675
2698
|
const data = await ctx.gql.workspace.request(LIST_INVENTORY_TRANSACTIONS, {
|
|
2676
2699
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
2677
2700
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
@@ -2691,22 +2714,22 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2691
2714
|
track(mcpToolName(ctx.productName, "inventory_create_item")),
|
|
2692
2715
|
{
|
|
2693
2716
|
title: "Create Inventory Item",
|
|
2694
|
-
description: "Create an inventory item for a
|
|
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.",
|
|
2695
2718
|
inputSchema: {
|
|
2696
|
-
|
|
2719
|
+
cargoItemId: z.string().min(1).describe("Cargo item ID"),
|
|
2697
2720
|
warehouseId: z.string().min(1).describe("Warehouse ID"),
|
|
2698
2721
|
locationId: z.string().optional().describe("Storage location ID"),
|
|
2699
|
-
onHand:
|
|
2700
|
-
available:
|
|
2701
|
-
allocated:
|
|
2702
|
-
damaged:
|
|
2703
|
-
reorderPoint:
|
|
2704
|
-
safetyStock:
|
|
2705
|
-
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")
|
|
2706
2729
|
}
|
|
2707
2730
|
},
|
|
2708
2731
|
async ({
|
|
2709
|
-
|
|
2732
|
+
cargoItemId,
|
|
2710
2733
|
warehouseId,
|
|
2711
2734
|
locationId,
|
|
2712
2735
|
onHand,
|
|
@@ -2718,7 +2741,7 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2718
2741
|
unitCost
|
|
2719
2742
|
}) => {
|
|
2720
2743
|
try {
|
|
2721
|
-
const input = {
|
|
2744
|
+
const input = { cargoItemId, warehouseId };
|
|
2722
2745
|
if (locationId !== void 0) input.locationId = locationId;
|
|
2723
2746
|
if (onHand !== void 0) input.onHand = onHand;
|
|
2724
2747
|
if (available !== void 0) input.available = available;
|
|
@@ -2727,6 +2750,17 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2727
2750
|
if (reorderPoint !== void 0) input.reorderPoint = reorderPoint;
|
|
2728
2751
|
if (safetyStock !== void 0) input.safetyStock = safetyStock;
|
|
2729
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
|
+
}
|
|
2730
2764
|
const data = await ctx.gql.workspace.request(CREATE_INVENTORY_ITEM, { input });
|
|
2731
2765
|
return jsonResult(data.createInventoryItem);
|
|
2732
2766
|
} catch (error) {
|
|
@@ -2741,17 +2775,17 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2741
2775
|
track(mcpToolName(ctx.productName, "inventory_update_item")),
|
|
2742
2776
|
{
|
|
2743
2777
|
title: "Update Inventory Item",
|
|
2744
|
-
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.",
|
|
2745
2779
|
inputSchema: {
|
|
2746
2780
|
id: z.string().describe("Inventory item ID"),
|
|
2747
2781
|
locationId: z.string().optional().describe("Updated location ID"),
|
|
2748
|
-
onHand:
|
|
2749
|
-
available:
|
|
2750
|
-
allocated:
|
|
2751
|
-
damaged:
|
|
2752
|
-
reorderPoint:
|
|
2753
|
-
safetyStock:
|
|
2754
|
-
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")
|
|
2755
2789
|
}
|
|
2756
2790
|
},
|
|
2757
2791
|
async ({
|
|
@@ -2792,13 +2826,13 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2792
2826
|
track(mcpToolName(ctx.productName, "inventory_adjust_stock")),
|
|
2793
2827
|
{
|
|
2794
2828
|
title: "Adjust Inventory Stock",
|
|
2795
|
-
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.",
|
|
2796
2830
|
inputSchema: {
|
|
2797
2831
|
id: z.string().describe("Inventory item ID"),
|
|
2798
|
-
onHand:
|
|
2799
|
-
available:
|
|
2800
|
-
allocated:
|
|
2801
|
-
damaged:
|
|
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")
|
|
2802
2836
|
}
|
|
2803
2837
|
},
|
|
2804
2838
|
async ({ id, onHand, available, allocated, damaged }) => {
|
|
@@ -2823,20 +2857,50 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2823
2857
|
}
|
|
2824
2858
|
}
|
|
2825
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
|
+
);
|
|
2826
2890
|
server.registerTool(
|
|
2827
2891
|
track(mcpToolName(ctx.productName, "inventory_create_transaction")),
|
|
2828
2892
|
{
|
|
2829
2893
|
title: "Create Inventory Transaction",
|
|
2830
|
-
description: "Record an inventory ledger transaction (RECEIPT/ISSUE/TRANSFER/ADJUSTMENT/RETURN). `transactionNumber`, `type`, `
|
|
2894
|
+
description: "Record an inventory ledger transaction (RECEIPT/ISSUE/TRANSFER/ADJUSTMENT/RETURN). `transactionNumber`, `type`, `cargoItemId`, `warehouseId`, and `quantity` are required.",
|
|
2831
2895
|
inputSchema: {
|
|
2832
2896
|
transactionNumber: z.string().min(1).describe("Transaction number (unique)"),
|
|
2833
2897
|
type: InventoryTransactionTypeEnum.describe("Transaction type"),
|
|
2834
|
-
|
|
2898
|
+
cargoItemId: z.string().min(1).describe("Cargo item ID"),
|
|
2835
2899
|
warehouseId: z.string().min(1).describe("Warehouse ID"),
|
|
2836
2900
|
quantity: z.number().int().describe("Quantity moved (sign per transaction semantics)"),
|
|
2837
2901
|
inventoryItemId: z.string().optional().describe("Affected inventory item ID"),
|
|
2838
|
-
unitCost: z.number().optional().describe("Unit cost"),
|
|
2839
|
-
referenceType: z.string().optional().describe('Reference type, e.g. "
|
|
2902
|
+
unitCost: z.number().nonnegative().optional().describe("Unit cost"),
|
|
2903
|
+
referenceType: z.string().optional().describe('Reference type, e.g. "delivery_job", "shipment"'),
|
|
2840
2904
|
referenceId: z.string().optional().describe("Reference ID"),
|
|
2841
2905
|
notes: z.string().optional().describe("Notes")
|
|
2842
2906
|
}
|
|
@@ -2844,7 +2908,7 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2844
2908
|
async ({
|
|
2845
2909
|
transactionNumber,
|
|
2846
2910
|
type,
|
|
2847
|
-
|
|
2911
|
+
cargoItemId,
|
|
2848
2912
|
warehouseId,
|
|
2849
2913
|
quantity,
|
|
2850
2914
|
inventoryItemId,
|
|
@@ -2857,7 +2921,7 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2857
2921
|
const input = {
|
|
2858
2922
|
transactionNumber,
|
|
2859
2923
|
type,
|
|
2860
|
-
|
|
2924
|
+
cargoItemId,
|
|
2861
2925
|
warehouseId,
|
|
2862
2926
|
quantity
|
|
2863
2927
|
};
|
|
@@ -3200,260 +3264,6 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3200
3264
|
}
|
|
3201
3265
|
);
|
|
3202
3266
|
}
|
|
3203
|
-
function registerReportTools(server, ctx, track) {
|
|
3204
|
-
server.registerTool(
|
|
3205
|
-
track(mcpToolName(ctx.productName, "reports_get")),
|
|
3206
|
-
{
|
|
3207
|
-
title: "Get Report",
|
|
3208
|
-
description: "Fetch a single report definition by ID.",
|
|
3209
|
-
inputSchema: { id: z.string().describe("Report ID") }
|
|
3210
|
-
},
|
|
3211
|
-
async ({ id }) => {
|
|
3212
|
-
try {
|
|
3213
|
-
const data = await ctx.gql.workspace.request(GET_REPORT, { id });
|
|
3214
|
-
if (!data.movethewheelsReport) return errorResult(`Report ${id} not found`);
|
|
3215
|
-
return jsonResult(data.movethewheelsReport);
|
|
3216
|
-
} catch (error) {
|
|
3217
|
-
ctx.logger.error("movethewheels reports_get failed", { error: String(error) });
|
|
3218
|
-
return errorResult(
|
|
3219
|
-
`Failed to get report: ${error instanceof Error ? error.message : String(error)}`
|
|
3220
|
-
);
|
|
3221
|
-
}
|
|
3222
|
-
}
|
|
3223
|
-
);
|
|
3224
|
-
server.registerTool(
|
|
3225
|
-
track(mcpToolName(ctx.productName, "reports_list")),
|
|
3226
|
-
{
|
|
3227
|
-
title: "List Reports",
|
|
3228
|
-
description: "List report definitions with optional type/status/text filters and pagination.",
|
|
3229
|
-
inputSchema: {
|
|
3230
|
-
search: z.string().optional().describe("Free-text search across name"),
|
|
3231
|
-
type: z.string().optional().describe("Filter by report type"),
|
|
3232
|
-
status: z.string().optional().describe('Filter by status, e.g. "DRAFT", "ACTIVE"'),
|
|
3233
|
-
limit: z.number().int().optional().describe("Page size (default 50)"),
|
|
3234
|
-
offset: z.number().int().optional().describe("Pagination offset (default 0)")
|
|
3235
|
-
}
|
|
3236
|
-
},
|
|
3237
|
-
async ({ search, type, status, limit, offset }) => {
|
|
3238
|
-
try {
|
|
3239
|
-
const filter = {};
|
|
3240
|
-
if (search !== void 0) filter.search = search;
|
|
3241
|
-
if (type !== void 0) filter.type = type;
|
|
3242
|
-
if (status !== void 0) filter.status = status;
|
|
3243
|
-
const data = await ctx.gql.workspace.request(LIST_REPORTS, {
|
|
3244
|
-
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
3245
|
-
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
3246
|
-
});
|
|
3247
|
-
return jsonResult(data.movethewheelsReports);
|
|
3248
|
-
} catch (error) {
|
|
3249
|
-
ctx.logger.error("movethewheels reports_list failed", { error: String(error) });
|
|
3250
|
-
return errorResult(
|
|
3251
|
-
`Failed to list reports: ${error instanceof Error ? error.message : String(error)}`
|
|
3252
|
-
);
|
|
3253
|
-
}
|
|
3254
|
-
}
|
|
3255
|
-
);
|
|
3256
|
-
server.registerTool(
|
|
3257
|
-
track(mcpToolName(ctx.productName, "reports_create")),
|
|
3258
|
-
{
|
|
3259
|
-
title: "Create Report",
|
|
3260
|
-
description: 'Create a report definition. `name` and `type` are required; `status` defaults to "DRAFT".',
|
|
3261
|
-
inputSchema: {
|
|
3262
|
-
name: z.string().min(1).describe("Report name"),
|
|
3263
|
-
type: z.string().min(1).describe("Report type"),
|
|
3264
|
-
status: z.string().optional().describe('Status (default "DRAFT")'),
|
|
3265
|
-
description: z.string().optional().describe("Description"),
|
|
3266
|
-
configuration: JsonObject.optional().describe("Report configuration JSON"),
|
|
3267
|
-
schedule: z.string().optional().describe("Schedule (e.g. cron string)")
|
|
3268
|
-
}
|
|
3269
|
-
},
|
|
3270
|
-
async ({ name, type, status, description, configuration, schedule }) => {
|
|
3271
|
-
try {
|
|
3272
|
-
const input = { name, type };
|
|
3273
|
-
if (status !== void 0) input.status = status;
|
|
3274
|
-
if (description !== void 0) input.description = description;
|
|
3275
|
-
if (configuration !== void 0) input.configuration = configuration;
|
|
3276
|
-
if (schedule !== void 0) input.schedule = schedule;
|
|
3277
|
-
const data = await ctx.gql.workspace.request(CREATE_REPORT, { input });
|
|
3278
|
-
return jsonResult(data.createMovethewheelsReport);
|
|
3279
|
-
} catch (error) {
|
|
3280
|
-
ctx.logger.error("movethewheels reports_create failed", { error: String(error) });
|
|
3281
|
-
return errorResult(
|
|
3282
|
-
`Failed to create report: ${error instanceof Error ? error.message : String(error)}`
|
|
3283
|
-
);
|
|
3284
|
-
}
|
|
3285
|
-
}
|
|
3286
|
-
);
|
|
3287
|
-
server.registerTool(
|
|
3288
|
-
track(mcpToolName(ctx.productName, "reports_update")),
|
|
3289
|
-
{
|
|
3290
|
-
title: "Update Report",
|
|
3291
|
-
description: "Update a report definition. At least one mutable field must be provided.",
|
|
3292
|
-
inputSchema: {
|
|
3293
|
-
id: z.string().describe("Report ID"),
|
|
3294
|
-
name: z.string().optional().describe("Updated name"),
|
|
3295
|
-
type: z.string().optional().describe("Updated type"),
|
|
3296
|
-
status: z.string().optional().describe("Updated status"),
|
|
3297
|
-
description: z.string().optional().describe("Updated description"),
|
|
3298
|
-
configuration: JsonObject.optional().describe("Updated configuration JSON"),
|
|
3299
|
-
schedule: z.string().optional().describe("Updated schedule")
|
|
3300
|
-
}
|
|
3301
|
-
},
|
|
3302
|
-
async ({ id, name, type, status, description, configuration, schedule }) => {
|
|
3303
|
-
try {
|
|
3304
|
-
const input = {};
|
|
3305
|
-
if (name !== void 0) input.name = name;
|
|
3306
|
-
if (type !== void 0) input.type = type;
|
|
3307
|
-
if (status !== void 0) input.status = status;
|
|
3308
|
-
if (description !== void 0) input.description = description;
|
|
3309
|
-
if (configuration !== void 0) input.configuration = configuration;
|
|
3310
|
-
if (schedule !== void 0) input.schedule = schedule;
|
|
3311
|
-
if (Object.keys(input).length === 0) {
|
|
3312
|
-
return errorResult("No updates specified \u2014 provide at least one mutable field.");
|
|
3313
|
-
}
|
|
3314
|
-
const data = await ctx.gql.workspace.request(UPDATE_REPORT, { id, input });
|
|
3315
|
-
return jsonResult(data.updateMovethewheelsReport);
|
|
3316
|
-
} catch (error) {
|
|
3317
|
-
ctx.logger.error("movethewheels reports_update failed", { error: String(error) });
|
|
3318
|
-
return errorResult(
|
|
3319
|
-
`Failed to update report: ${error instanceof Error ? error.message : String(error)}`
|
|
3320
|
-
);
|
|
3321
|
-
}
|
|
3322
|
-
}
|
|
3323
|
-
);
|
|
3324
|
-
server.registerTool(
|
|
3325
|
-
track(mcpToolName(ctx.productName, "reports_generate")),
|
|
3326
|
-
{
|
|
3327
|
-
title: "Generate Report",
|
|
3328
|
-
description: "Run a report definition and return the generated result payload.",
|
|
3329
|
-
inputSchema: {
|
|
3330
|
-
reportId: z.string().describe("Report ID to generate"),
|
|
3331
|
-
parameters: JsonObject.optional().describe("Runtime parameters JSON")
|
|
3332
|
-
}
|
|
3333
|
-
},
|
|
3334
|
-
async ({ reportId, parameters }) => {
|
|
3335
|
-
try {
|
|
3336
|
-
const input = { reportId };
|
|
3337
|
-
if (parameters !== void 0) input.parameters = parameters;
|
|
3338
|
-
const data = await ctx.gql.workspace.request(GENERATE_REPORT, { input });
|
|
3339
|
-
return jsonResult(data.generateMovethewheelsReport);
|
|
3340
|
-
} catch (error) {
|
|
3341
|
-
ctx.logger.error("movethewheels reports_generate failed", { error: String(error) });
|
|
3342
|
-
return errorResult(
|
|
3343
|
-
`Failed to generate report: ${error instanceof Error ? error.message : String(error)}`
|
|
3344
|
-
);
|
|
3345
|
-
}
|
|
3346
|
-
}
|
|
3347
|
-
);
|
|
3348
|
-
server.registerTool(
|
|
3349
|
-
track(mcpToolName(ctx.productName, "reports_delete")),
|
|
3350
|
-
{
|
|
3351
|
-
title: "Delete Report",
|
|
3352
|
-
description: "Soft-delete a report definition by ID.",
|
|
3353
|
-
inputSchema: { id: z.string().describe("Report ID") }
|
|
3354
|
-
},
|
|
3355
|
-
async ({ id }) => {
|
|
3356
|
-
try {
|
|
3357
|
-
const data = await ctx.gql.workspace.request(
|
|
3358
|
-
DELETE_REPORT,
|
|
3359
|
-
{ id }
|
|
3360
|
-
);
|
|
3361
|
-
return jsonResult({ deleted: data.deleteMovethewheelsReport, id });
|
|
3362
|
-
} catch (error) {
|
|
3363
|
-
ctx.logger.error("movethewheels reports_delete failed", { error: String(error) });
|
|
3364
|
-
return errorResult(
|
|
3365
|
-
`Failed to delete report: ${error instanceof Error ? error.message : String(error)}`
|
|
3366
|
-
);
|
|
3367
|
-
}
|
|
3368
|
-
}
|
|
3369
|
-
);
|
|
3370
|
-
server.registerTool(
|
|
3371
|
-
track(mcpToolName(ctx.productName, "settings_get")),
|
|
3372
|
-
{
|
|
3373
|
-
title: "Get Module Settings",
|
|
3374
|
-
description: "Fetch the Movethewheels module settings (preferences) for the bound workspace.",
|
|
3375
|
-
inputSchema: {}
|
|
3376
|
-
},
|
|
3377
|
-
async () => {
|
|
3378
|
-
try {
|
|
3379
|
-
const data = await ctx.gql.workspace.request(GET_MODULE_SETTINGS, {});
|
|
3380
|
-
return jsonResult(data.moduleSettings);
|
|
3381
|
-
} catch (error) {
|
|
3382
|
-
ctx.logger.error("movethewheels settings_get failed", { error: String(error) });
|
|
3383
|
-
return errorResult(
|
|
3384
|
-
`Failed to get module settings: ${error instanceof Error ? error.message : String(error)}`
|
|
3385
|
-
);
|
|
3386
|
-
}
|
|
3387
|
-
}
|
|
3388
|
-
);
|
|
3389
|
-
server.registerTool(
|
|
3390
|
-
track(mcpToolName(ctx.productName, "settings_update")),
|
|
3391
|
-
{
|
|
3392
|
-
title: "Update Module Settings",
|
|
3393
|
-
description: "Replace the Movethewheels module preferences JSON for the bound workspace.",
|
|
3394
|
-
inputSchema: {
|
|
3395
|
-
preferences: JsonObject.describe("Module preferences JSON (full replacement)")
|
|
3396
|
-
}
|
|
3397
|
-
},
|
|
3398
|
-
async ({ preferences }) => {
|
|
3399
|
-
try {
|
|
3400
|
-
const data = await ctx.gql.workspace.request(UPDATE_MODULE_SETTINGS, { input: { preferences } });
|
|
3401
|
-
return jsonResult(data.updateModuleSettings);
|
|
3402
|
-
} catch (error) {
|
|
3403
|
-
ctx.logger.error("movethewheels settings_update failed", { error: String(error) });
|
|
3404
|
-
return errorResult(
|
|
3405
|
-
`Failed to update module settings: ${error instanceof Error ? error.message : String(error)}`
|
|
3406
|
-
);
|
|
3407
|
-
}
|
|
3408
|
-
}
|
|
3409
|
-
);
|
|
3410
|
-
server.registerTool(
|
|
3411
|
-
track(mcpToolName(ctx.productName, "data_export")),
|
|
3412
|
-
{
|
|
3413
|
-
title: "Export Data",
|
|
3414
|
-
description: 'Export a Movethewheels resource (e.g. "orders", "shipments", "inventory") as a payload. `format` defaults to "json".',
|
|
3415
|
-
inputSchema: {
|
|
3416
|
-
resource: z.string().min(1).describe('Resource to export, e.g. "orders"'),
|
|
3417
|
-
format: z.string().optional().describe('Export format (default "json")')
|
|
3418
|
-
}
|
|
3419
|
-
},
|
|
3420
|
-
async ({ resource, format }) => {
|
|
3421
|
-
try {
|
|
3422
|
-
const input = { resource };
|
|
3423
|
-
if (format !== void 0) input.format = format;
|
|
3424
|
-
const data = await ctx.gql.workspace.request(EXPORT_DATA, { input });
|
|
3425
|
-
return jsonResult(data.exportData);
|
|
3426
|
-
} catch (error) {
|
|
3427
|
-
ctx.logger.error("movethewheels data_export failed", { error: String(error) });
|
|
3428
|
-
return errorResult(
|
|
3429
|
-
`Failed to export data: ${error instanceof Error ? error.message : String(error)}`
|
|
3430
|
-
);
|
|
3431
|
-
}
|
|
3432
|
-
}
|
|
3433
|
-
);
|
|
3434
|
-
server.registerTool(
|
|
3435
|
-
track(mcpToolName(ctx.productName, "data_import")),
|
|
3436
|
-
{
|
|
3437
|
-
title: "Import Data",
|
|
3438
|
-
description: 'Import a payload into a Movethewheels resource (e.g. "orders", "customers"). `resource` and `payload` are required.',
|
|
3439
|
-
inputSchema: {
|
|
3440
|
-
resource: z.string().min(1).describe('Resource to import into, e.g. "customers"'),
|
|
3441
|
-
payload: JsonObject.describe("Payload JSON to import")
|
|
3442
|
-
}
|
|
3443
|
-
},
|
|
3444
|
-
async ({ resource, payload }) => {
|
|
3445
|
-
try {
|
|
3446
|
-
const data = await ctx.gql.workspace.request(IMPORT_DATA, { input: { resource, payload } });
|
|
3447
|
-
return jsonResult(data.importData);
|
|
3448
|
-
} catch (error) {
|
|
3449
|
-
ctx.logger.error("movethewheels data_import failed", { error: String(error) });
|
|
3450
|
-
return errorResult(
|
|
3451
|
-
`Failed to import data: ${error instanceof Error ? error.message : String(error)}`
|
|
3452
|
-
);
|
|
3453
|
-
}
|
|
3454
|
-
}
|
|
3455
|
-
);
|
|
3456
|
-
}
|
|
3457
3267
|
|
|
3458
3268
|
// src/modules/movethewheels/tools/analytics.ts
|
|
3459
3269
|
function registerAnalyticsTools(server, ctx, track) {
|
|
@@ -3461,7 +3271,7 @@ function registerAnalyticsTools(server, ctx, track) {
|
|
|
3461
3271
|
track(mcpToolName(ctx.productName, "analytics_series")),
|
|
3462
3272
|
{
|
|
3463
3273
|
title: "Analytics Time Series",
|
|
3464
|
-
description: "Time-series trends for
|
|
3274
|
+
description: "Time-series trends for delivery jobs (orderTrend), deliveries, and revenue.",
|
|
3465
3275
|
inputSchema: {}
|
|
3466
3276
|
},
|
|
3467
3277
|
async () => {
|
|
@@ -3480,7 +3290,7 @@ function registerAnalyticsTools(server, ctx, track) {
|
|
|
3480
3290
|
track(mcpToolName(ctx.productName, "analytics_dashboard")),
|
|
3481
3291
|
{
|
|
3482
3292
|
title: "Dashboard Metrics",
|
|
3483
|
-
description: "Headline operations KPIs: total
|
|
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.",
|
|
3484
3294
|
inputSchema: {}
|
|
3485
3295
|
},
|
|
3486
3296
|
async () => {
|
|
@@ -3496,20 +3306,22 @@ function registerAnalyticsTools(server, ctx, track) {
|
|
|
3496
3306
|
}
|
|
3497
3307
|
);
|
|
3498
3308
|
server.registerTool(
|
|
3499
|
-
track(mcpToolName(ctx.productName, "
|
|
3309
|
+
track(mcpToolName(ctx.productName, "analytics_delivery_job_stats")),
|
|
3500
3310
|
{
|
|
3501
|
-
title: "
|
|
3502
|
-
description: "
|
|
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.",
|
|
3503
3313
|
inputSchema: {}
|
|
3504
3314
|
},
|
|
3505
3315
|
async () => {
|
|
3506
3316
|
try {
|
|
3507
|
-
const data = await ctx.gql.workspace.request(
|
|
3508
|
-
return jsonResult(data.
|
|
3317
|
+
const data = await ctx.gql.workspace.request(GET_DELIVERY_JOB_STATS, {});
|
|
3318
|
+
return jsonResult(data.deliveryJobStats);
|
|
3509
3319
|
} catch (error) {
|
|
3510
|
-
ctx.logger.error("movethewheels
|
|
3320
|
+
ctx.logger.error("movethewheels analytics_delivery_job_stats failed", {
|
|
3321
|
+
error: String(error)
|
|
3322
|
+
});
|
|
3511
3323
|
return errorResult(
|
|
3512
|
-
`Failed to get
|
|
3324
|
+
`Failed to get delivery job stats: ${error instanceof Error ? error.message : String(error)}`
|
|
3513
3325
|
);
|
|
3514
3326
|
}
|
|
3515
3327
|
}
|
|
@@ -3578,32 +3390,38 @@ Logistics / fleet / warehouse / last-mile-delivery operations platform.
|
|
|
3578
3390
|
- Customer \u2014 shipper/consignee (B2B/B2C)
|
|
3579
3391
|
- Driver \u2014 fleet driver (status, license, telemetry)
|
|
3580
3392
|
- Vehicle \u2014 fleet vehicle (type, status, capacity, location)
|
|
3581
|
-
-
|
|
3582
|
-
|
|
3583
|
-
-
|
|
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
|
|
3584
3400
|
- Route \u2014 planned/optimized delivery route
|
|
3585
3401
|
- Warehouse (+WarehouseLocation) \u2014 facilities + storage locations
|
|
3586
3402
|
- InventoryItem (+InventoryTransaction) \u2014 stock at a warehouse + ledger
|
|
3587
3403
|
- ServiceProvider (+ServiceOffering) \u2014 3PL marketplace providers + offerings
|
|
3588
|
-
- MovethewheelsReport \u2014 report definitions
|
|
3589
3404
|
|
|
3590
3405
|
## Enums
|
|
3591
3406
|
- DriverStatus: AVAILABLE, INACTIVE, OFF_DUTY, ON_BREAK, ON_DELIVERY
|
|
3592
3407
|
- VehicleStatus: ACTIVE, DECOMMISSIONED, INACTIVE, IN_TRANSIT, MAINTENANCE
|
|
3593
3408
|
- VehicleType: BICYCLE, DRONE, FLATBED, MOTORCYCLE, REFRIGERATED, SEMI_TRAILER, TRUCK, VAN
|
|
3594
|
-
-
|
|
3595
|
-
-
|
|
3596
|
-
- 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
|
|
3597
3411
|
- ShipmentStatus: PLANNED, PICKED_UP, IN_TRANSIT, DELIVERED, FAILED, RETURNED
|
|
3598
3412
|
- TrackingEventType: CREATED, PICKED_UP, DEPARTED, ARRIVED, IN_TRANSIT, OUT_FOR_DELIVERY, DELIVERED, FAILED, RETURNED
|
|
3599
3413
|
- RouteStatus: PLANNED, IN_PROGRESS, COMPLETED, CANCELLED
|
|
3600
3414
|
- WarehouseType: COLD_STORAGE, CROSS_DOCK, DISTRIBUTION, FULFILLMENT, RETAIL
|
|
3601
3415
|
- InventoryTransactionType: RECEIPT, ISSUE, TRANSFER, ADJUSTMENT, RETURN
|
|
3602
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
|
+
|
|
3603
3421
|
## Tool groups
|
|
3604
|
-
customers, drivers, vehicles,
|
|
3605
|
-
warehouses, inventory, marketplace (service providers + offerings),
|
|
3606
|
-
|
|
3422
|
+
customers, drivers, vehicles, cargo, delivery_jobs, shipments, tracking,
|
|
3423
|
+
routes, warehouses, inventory, marketplace (service providers + offerings),
|
|
3424
|
+
analytics.
|
|
3607
3425
|
All run against the WORKSPACE gateway (workspace-scoped). The subgraph has no
|
|
3608
3426
|
@public health field, so there is no health tool.
|
|
3609
3427
|
`;
|
|
@@ -3617,7 +3435,7 @@ All run against the WORKSPACE gateway (workspace-scoped). The subgraph has no
|
|
|
3617
3435
|
dashboardUri,
|
|
3618
3436
|
{
|
|
3619
3437
|
title: "Movethewheels Dashboard Metrics",
|
|
3620
|
-
description: "Live headline operations KPIs (
|
|
3438
|
+
description: "Live headline operations KPIs (delivery jobs, active deliveries, vehicles, drivers, low-stock, revenue, on-time rate).",
|
|
3621
3439
|
mimeType: "application/json"
|
|
3622
3440
|
},
|
|
3623
3441
|
async () => {
|
|
@@ -3735,28 +3553,28 @@ function registerMovethewheelsPrompts(server, ctx, track) {
|
|
|
3735
3553
|
fulfilmentName,
|
|
3736
3554
|
{
|
|
3737
3555
|
title: "Delivery Fulfilment",
|
|
3738
|
-
description: "Guide for fulfilling a 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.",
|
|
3739
3557
|
argsSchema: {
|
|
3740
|
-
customerId: z.string().optional().describe("Customer
|
|
3741
|
-
|
|
3558
|
+
customerId: z.string().optional().describe("Customer the delivery is for"),
|
|
3559
|
+
deliveryJobId: z.string().optional().describe("Existing delivery job ID to fulfil")
|
|
3742
3560
|
}
|
|
3743
3561
|
},
|
|
3744
|
-
({ customerId,
|
|
3745
|
-
ctx.logger.debug(`Prompt ${fulfilmentName} called`, { customerId,
|
|
3746
|
-
const
|
|
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).`;
|
|
3747
3565
|
return {
|
|
3748
3566
|
messages: [
|
|
3749
3567
|
{
|
|
3750
3568
|
role: "user",
|
|
3751
3569
|
content: {
|
|
3752
3570
|
type: "text",
|
|
3753
|
-
text: `Help me fulfil a Movethewheels delivery
|
|
3571
|
+
text: `Help me fulfil a Movethewheels delivery job. ${jobNote}
|
|
3754
3572
|
|
|
3755
|
-
1. **
|
|
3756
|
-
2. **Assign Capacity**: Use ${p}_drivers_list (status=AVAILABLE) and ${p}_vehicles_list (status=ACTIVE), then ${p}_drivers_assign_vehicle and ${p}
|
|
3757
|
-
3. **Shipment**: Use ${p}_shipments_create with the
|
|
3758
|
-
4. **Track**: As the shipment moves, use ${p}_tracking_add_event (PICKED_UP \u2192 IN_TRANSIT \u2192 OUT_FOR_DELIVERY \u2192 DELIVERED) and mirror
|
|
3759
|
-
5. **Verify**: Use ${p}
|
|
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.
|
|
3760
3578
|
|
|
3761
3579
|
Show results at each step and confirm before marking DELIVERED.`
|
|
3762
3580
|
}
|
|
@@ -3769,7 +3587,7 @@ Show results at each step and confirm before marking DELIVERED.`
|
|
|
3769
3587
|
fleetName,
|
|
3770
3588
|
{
|
|
3771
3589
|
title: "Fleet & Warehouse Operations",
|
|
3772
|
-
description: "Daily operations workflow: review KPIs, triage the
|
|
3590
|
+
description: "Daily operations workflow: review KPIs, triage the delivery-job queue and tracking alerts, balance fleet status, and watch low inventory.",
|
|
3773
3591
|
argsSchema: {}
|
|
3774
3592
|
},
|
|
3775
3593
|
() => {
|
|
@@ -3782,11 +3600,11 @@ Show results at each step and confirm before marking DELIVERED.`
|
|
|
3782
3600
|
type: "text",
|
|
3783
3601
|
text: `Run daily Movethewheels operations.
|
|
3784
3602
|
|
|
3785
|
-
1. **KPIs**: Use ${p}_analytics_dashboard for headline numbers, ${p}
|
|
3786
|
-
2. **
|
|
3787
|
-
3. **Tracking Alerts**: Use ${p}_tracking_alerts to find
|
|
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.
|
|
3788
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.
|
|
3789
|
-
5. **Inventory**: Use ${p}_inventory_stats and ${p}_inventory_list_items to find low-stock items; record
|
|
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.
|
|
3790
3608
|
|
|
3791
3609
|
Summarize what needs attention after each step.`
|
|
3792
3610
|
}
|
|
@@ -3823,15 +3641,14 @@ var movethewheelsModule = {
|
|
|
3823
3641
|
registerCustomerTools(server, ctx, trackTool);
|
|
3824
3642
|
registerDriverTools(server, ctx, trackTool);
|
|
3825
3643
|
registerVehicleTools(server, ctx, trackTool);
|
|
3826
|
-
|
|
3827
|
-
|
|
3644
|
+
registerCargoTools(server, ctx, trackTool);
|
|
3645
|
+
registerDeliveryJobTools(server, ctx, trackTool);
|
|
3828
3646
|
registerShipmentTools(server, ctx, trackTool);
|
|
3829
3647
|
registerTrackingTools(server, ctx, trackTool);
|
|
3830
3648
|
registerRouteTools(server, ctx, trackTool);
|
|
3831
3649
|
registerWarehouseTools(server, ctx, trackTool);
|
|
3832
3650
|
registerInventoryTools(server, ctx, trackTool);
|
|
3833
3651
|
registerMarketplaceTools(server, ctx, trackTool);
|
|
3834
|
-
registerReportTools(server, ctx, trackTool);
|
|
3835
3652
|
registerAnalyticsTools(server, ctx, trackTool);
|
|
3836
3653
|
registerMovethewheelsResources(server, ctx, trackResource);
|
|
3837
3654
|
registerMovethewheelsPrompts(server, ctx, trackPrompt);
|