@burdenoff/mcp-libs 2026.1030.4 → 2026.1031.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/movethewheels/index.cjs +579 -745
- package/dist/modules/movethewheels/index.cjs.map +1 -1
- package/dist/modules/movethewheels/index.js +579 -745
- package/dist/modules/movethewheels/index.js.map +1 -1
- package/dist/modules/movethewheels/operations.d.ts +48 -56
- 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 +7 -3
- package/package.json +1 -1
- package/dist/modules/movethewheels/tools/reports.d.ts +0 -3
|
@@ -79,21 +79,22 @@ var VEHICLE_FIELDS = `
|
|
|
79
79
|
id vehicleNumber type status make model year licensePlate capacity
|
|
80
80
|
currentLocation fuelLevel mileage ownershipType ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
81
81
|
`;
|
|
82
|
-
var
|
|
82
|
+
var CARGO_ITEM_FIELDS = `
|
|
83
83
|
id name sku description category brand weight value dimensions fragile
|
|
84
84
|
hazardous temperatureControlled ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
85
85
|
`;
|
|
86
|
-
var
|
|
87
|
-
id
|
|
86
|
+
var DELIVERY_JOB_STATUS_HISTORY_FIELDS = `
|
|
87
|
+
id deliveryJobId status previousStatus notes location createdAt
|
|
88
88
|
`;
|
|
89
|
-
var
|
|
90
|
-
id
|
|
91
|
-
pickupAddress deliveryAddress
|
|
92
|
-
specialInstructions ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
89
|
+
var DELIVERY_JOB_FIELDS = `
|
|
90
|
+
id deliveryJobNumber customerId driverId vehicleId routeId storeOrderId status
|
|
91
|
+
priority pickupAddress deliveryAddress cargoItems pricing trackingNumber
|
|
92
|
+
scheduledDelivery specialInstructions ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
93
93
|
`;
|
|
94
94
|
var SHIPMENT_FIELDS = `
|
|
95
|
-
id shipmentNumber
|
|
96
|
-
|
|
95
|
+
id shipmentNumber deliveryJobId storeOrderId customerId carrierId origin
|
|
96
|
+
destination status statusRevision primaryMode isMultiModal trackingNumber
|
|
97
|
+
cargoDetails estimatedDelivery actualDelivery totalFreightCost freightCurrency
|
|
97
98
|
${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
98
99
|
`;
|
|
99
100
|
var TRACKING_EVENT_FIELDS = `
|
|
@@ -102,7 +103,7 @@ var TRACKING_EVENT_FIELDS = `
|
|
|
102
103
|
${CONTEXT_FIELDS}
|
|
103
104
|
`;
|
|
104
105
|
var TRACKING_ALERT_FIELDS = `
|
|
105
|
-
shipmentId shipmentNumber alertType message
|
|
106
|
+
shipmentId shipmentNumber alertType message predictedDelivery riskScore signals
|
|
106
107
|
`;
|
|
107
108
|
var ROUTE_FIELDS = `
|
|
108
109
|
id name status shipmentId driverId vehicleId waypoints estimatedDistance
|
|
@@ -118,24 +119,21 @@ var WAREHOUSE_FIELDS = `
|
|
|
118
119
|
totalCapacity usedCapacity ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
119
120
|
`;
|
|
120
121
|
var INVENTORY_ITEM_FIELDS = `
|
|
121
|
-
id
|
|
122
|
+
id cargoItemId warehouseId locationId onHand available allocated damaged
|
|
122
123
|
reorderPoint safetyStock unitCost ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
123
124
|
`;
|
|
124
125
|
var INVENTORY_TRANSACTION_FIELDS = `
|
|
125
|
-
id transactionNumber type
|
|
126
|
+
id transactionNumber type cargoItemId warehouseId inventoryItemId quantity
|
|
126
127
|
unitCost referenceType referenceId notes ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
127
128
|
`;
|
|
129
|
+
var MARKETPLACE_AUDIT_FIELDS = `workspaceId createdBy onBehalfOf updatedBy createdAt updatedAt deletedAt`;
|
|
128
130
|
var SERVICE_OFFERING_FIELDS = `
|
|
129
|
-
id name
|
|
130
|
-
|
|
131
|
+
id providerId name description category price currency pricingUnit transitDays
|
|
132
|
+
availability isActive ${MARKETPLACE_AUDIT_FIELDS}
|
|
131
133
|
`;
|
|
132
134
|
var SERVICE_PROVIDER_FIELDS = `
|
|
133
|
-
id name type description
|
|
134
|
-
|
|
135
|
-
`;
|
|
136
|
-
var REPORT_FIELDS = `
|
|
137
|
-
id name type status description configuration schedule lastGenerated
|
|
138
|
-
${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
135
|
+
id name type description rating contactInfo services serviceAreas isVerified isActive
|
|
136
|
+
offeringsCount ${MARKETPLACE_AUDIT_FIELDS}
|
|
139
137
|
`;
|
|
140
138
|
var GET_CUSTOMER = `
|
|
141
139
|
query MovethewheelsGetCustomer($id: ID!) {
|
|
@@ -232,76 +230,84 @@ var DELETE_VEHICLE = `
|
|
|
232
230
|
deleteVehicle(id: $id)
|
|
233
231
|
}
|
|
234
232
|
`;
|
|
235
|
-
var
|
|
236
|
-
query
|
|
237
|
-
|
|
233
|
+
var GET_CARGO_ITEM = `
|
|
234
|
+
query MovethewheelsGetCargoItem($id: ID!) {
|
|
235
|
+
cargoItem(id: $id) { ${CARGO_ITEM_FIELDS} }
|
|
238
236
|
}
|
|
239
237
|
`;
|
|
240
|
-
var
|
|
241
|
-
query
|
|
242
|
-
|
|
238
|
+
var LIST_CARGO_ITEMS = `
|
|
239
|
+
query MovethewheelsListCargoItems($filter: CargoItemFilterInput, $pagination: PaginationInput) {
|
|
240
|
+
cargoItems(filter: $filter, pagination: $pagination) { ${CARGO_ITEM_FIELDS} }
|
|
243
241
|
}
|
|
244
242
|
`;
|
|
245
|
-
var
|
|
246
|
-
mutation
|
|
247
|
-
|
|
243
|
+
var CREATE_CARGO_ITEM = `
|
|
244
|
+
mutation MovethewheelsCreateCargoItem($input: CreateCargoItemInput!) {
|
|
245
|
+
createCargoItem(input: $input) { ${CARGO_ITEM_FIELDS} }
|
|
248
246
|
}
|
|
249
247
|
`;
|
|
250
|
-
var
|
|
251
|
-
mutation
|
|
252
|
-
|
|
248
|
+
var UPDATE_CARGO_ITEM = `
|
|
249
|
+
mutation MovethewheelsUpdateCargoItem($id: ID!, $input: UpdateCargoItemInput!) {
|
|
250
|
+
updateCargoItem(id: $id, input: $input) { ${CARGO_ITEM_FIELDS} }
|
|
253
251
|
}
|
|
254
252
|
`;
|
|
255
|
-
var
|
|
256
|
-
mutation
|
|
257
|
-
|
|
253
|
+
var DELETE_CARGO_ITEM = `
|
|
254
|
+
mutation MovethewheelsDeleteCargoItem($id: ID!) {
|
|
255
|
+
deleteCargoItem(id: $id)
|
|
258
256
|
}
|
|
259
257
|
`;
|
|
260
|
-
var
|
|
261
|
-
query
|
|
262
|
-
|
|
263
|
-
${
|
|
258
|
+
var GET_DELIVERY_JOB = `
|
|
259
|
+
query MovethewheelsGetDeliveryJob($id: ID!) {
|
|
260
|
+
deliveryJob(id: $id) {
|
|
261
|
+
${DELIVERY_JOB_FIELDS}
|
|
264
262
|
customer { id name email phone }
|
|
265
263
|
driver { id firstName lastName status }
|
|
266
264
|
vehicle { id vehicleNumber type status }
|
|
265
|
+
route { id name status }
|
|
267
266
|
shipment { id shipmentNumber status }
|
|
268
|
-
statusHistory { ${
|
|
267
|
+
statusHistory { ${DELIVERY_JOB_STATUS_HISTORY_FIELDS} }
|
|
269
268
|
}
|
|
270
269
|
}
|
|
271
270
|
`;
|
|
272
|
-
var
|
|
273
|
-
query
|
|
274
|
-
|
|
271
|
+
var LIST_DELIVERY_JOBS = `
|
|
272
|
+
query MovethewheelsListDeliveryJobs(
|
|
273
|
+
$filter: DeliveryJobFilterInput
|
|
274
|
+
$pagination: PaginationInput
|
|
275
|
+
) {
|
|
276
|
+
deliveryJobs(filter: $filter, pagination: $pagination) { ${DELIVERY_JOB_FIELDS} }
|
|
275
277
|
}
|
|
276
278
|
`;
|
|
277
|
-
var
|
|
278
|
-
mutation
|
|
279
|
-
|
|
279
|
+
var CREATE_DELIVERY_JOB = `
|
|
280
|
+
mutation MovethewheelsCreateDeliveryJob($input: CreateDeliveryJobInput!) {
|
|
281
|
+
createDeliveryJob(input: $input) { ${DELIVERY_JOB_FIELDS} }
|
|
280
282
|
}
|
|
281
283
|
`;
|
|
282
|
-
var
|
|
283
|
-
mutation
|
|
284
|
-
|
|
284
|
+
var UPDATE_DELIVERY_JOB = `
|
|
285
|
+
mutation MovethewheelsUpdateDeliveryJob($id: ID!, $input: UpdateDeliveryJobInput!) {
|
|
286
|
+
updateDeliveryJob(id: $id, input: $input) { ${DELIVERY_JOB_FIELDS} }
|
|
285
287
|
}
|
|
286
288
|
`;
|
|
287
|
-
var
|
|
288
|
-
mutation
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
289
|
+
var UPDATE_DELIVERY_JOB_STATUS = `
|
|
290
|
+
mutation MovethewheelsUpdateDeliveryJobStatus(
|
|
291
|
+
$id: ID!
|
|
292
|
+
$input: UpdateDeliveryJobStatusInput!
|
|
293
|
+
) {
|
|
294
|
+
updateDeliveryJobStatus(id: $id, input: $input) {
|
|
295
|
+
${DELIVERY_JOB_FIELDS}
|
|
296
|
+
statusHistory { ${DELIVERY_JOB_STATUS_HISTORY_FIELDS} }
|
|
292
297
|
}
|
|
293
298
|
}
|
|
294
299
|
`;
|
|
295
|
-
var
|
|
296
|
-
mutation
|
|
297
|
-
|
|
300
|
+
var DELETE_DELIVERY_JOB = `
|
|
301
|
+
mutation MovethewheelsDeleteDeliveryJob($id: ID!) {
|
|
302
|
+
deleteDeliveryJob(id: $id)
|
|
298
303
|
}
|
|
299
304
|
`;
|
|
300
305
|
var GET_SHIPMENT = `
|
|
301
306
|
query MovethewheelsGetShipment($id: ID!) {
|
|
302
307
|
shipment(id: $id) {
|
|
303
308
|
${SHIPMENT_FIELDS}
|
|
304
|
-
|
|
309
|
+
deliveryJob { id deliveryJobNumber status }
|
|
310
|
+
serviceProvider { id name type isVerified isActive }
|
|
305
311
|
trackingEvents { ${TRACKING_EVENT_FIELDS} }
|
|
306
312
|
}
|
|
307
313
|
}
|
|
@@ -331,9 +337,11 @@ var DELETE_SHIPMENT = `
|
|
|
331
337
|
deleteShipment(id: $id)
|
|
332
338
|
}
|
|
333
339
|
`;
|
|
334
|
-
var
|
|
335
|
-
query
|
|
336
|
-
|
|
340
|
+
var GET_DELIVERY_JOB_TRACKING = `
|
|
341
|
+
query MovethewheelsDeliveryJobTracking($deliveryJobId: ID!, $pagination: PaginationInput) {
|
|
342
|
+
deliveryJobTracking(deliveryJobId: $deliveryJobId, pagination: $pagination) {
|
|
343
|
+
${TRACKING_EVENT_FIELDS}
|
|
344
|
+
}
|
|
337
345
|
}
|
|
338
346
|
`;
|
|
339
347
|
var GET_SHIPMENT_TRACKING = `
|
|
@@ -428,7 +436,7 @@ var GET_INVENTORY_ITEM = `
|
|
|
428
436
|
query MovethewheelsGetInventoryItem($id: ID!) {
|
|
429
437
|
inventoryItem(id: $id) {
|
|
430
438
|
${INVENTORY_ITEM_FIELDS}
|
|
431
|
-
|
|
439
|
+
cargoItem { id name sku }
|
|
432
440
|
warehouse { id name code }
|
|
433
441
|
location { id locationCode }
|
|
434
442
|
}
|
|
@@ -475,6 +483,14 @@ var ADJUST_INVENTORY_STOCK = `
|
|
|
475
483
|
adjustInventoryStock(input: $input) { ${INVENTORY_ITEM_FIELDS} }
|
|
476
484
|
}
|
|
477
485
|
`;
|
|
486
|
+
var TRANSFER_INVENTORY_STOCK = `
|
|
487
|
+
mutation MovethewheelsTransferInventoryStock($input: TransferInventoryStockInput!) {
|
|
488
|
+
transferInventoryStock(input: $input) {
|
|
489
|
+
source { ${INVENTORY_ITEM_FIELDS} }
|
|
490
|
+
destination { ${INVENTORY_ITEM_FIELDS} }
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
`;
|
|
478
494
|
var DELETE_INVENTORY_ITEM = `
|
|
479
495
|
mutation MovethewheelsDeleteInventoryItem($id: ID!) {
|
|
480
496
|
deleteInventoryItem(id: $id)
|
|
@@ -495,19 +511,19 @@ var GET_SERVICE_PROVIDER = `
|
|
|
495
511
|
`;
|
|
496
512
|
var LIST_SERVICE_PROVIDERS = `
|
|
497
513
|
query MovethewheelsListServiceProviders(
|
|
498
|
-
$filter:
|
|
514
|
+
$filter: MtwServiceProviderFilterInput
|
|
499
515
|
$pagination: PaginationInput
|
|
500
516
|
) {
|
|
501
517
|
serviceProviders(filter: $filter, pagination: $pagination) { ${SERVICE_PROVIDER_FIELDS} }
|
|
502
518
|
}
|
|
503
519
|
`;
|
|
504
520
|
var CREATE_SERVICE_PROVIDER = `
|
|
505
|
-
mutation MovethewheelsCreateServiceProvider($input:
|
|
521
|
+
mutation MovethewheelsCreateServiceProvider($input: MtwCreateServiceProviderInput!) {
|
|
506
522
|
createServiceProvider(input: $input) { ${SERVICE_PROVIDER_FIELDS} }
|
|
507
523
|
}
|
|
508
524
|
`;
|
|
509
525
|
var UPDATE_SERVICE_PROVIDER = `
|
|
510
|
-
mutation MovethewheelsUpdateServiceProvider($id: ID!, $input:
|
|
526
|
+
mutation MovethewheelsUpdateServiceProvider($id: ID!, $input: MtwUpdateServiceProviderInput!) {
|
|
511
527
|
updateServiceProvider(id: $id, input: $input) { ${SERVICE_PROVIDER_FIELDS} }
|
|
512
528
|
}
|
|
513
529
|
`;
|
|
@@ -520,25 +536,28 @@ var GET_SERVICE_OFFERING = `
|
|
|
520
536
|
query MovethewheelsGetServiceOffering($id: ID!) {
|
|
521
537
|
serviceOffering(id: $id) {
|
|
522
538
|
${SERVICE_OFFERING_FIELDS}
|
|
523
|
-
provider { id name type }
|
|
539
|
+
provider { id name type isVerified isActive }
|
|
524
540
|
}
|
|
525
541
|
}
|
|
526
542
|
`;
|
|
527
543
|
var LIST_SERVICE_OFFERINGS = `
|
|
528
544
|
query MovethewheelsListServiceOfferings(
|
|
529
|
-
$filter:
|
|
545
|
+
$filter: MtwServiceOfferingFilterInput
|
|
530
546
|
$pagination: PaginationInput
|
|
531
547
|
) {
|
|
532
|
-
serviceOfferings(filter: $filter, pagination: $pagination) {
|
|
548
|
+
serviceOfferings(filter: $filter, pagination: $pagination) {
|
|
549
|
+
${SERVICE_OFFERING_FIELDS}
|
|
550
|
+
provider { id name type isVerified }
|
|
551
|
+
}
|
|
533
552
|
}
|
|
534
553
|
`;
|
|
535
554
|
var CREATE_SERVICE_OFFERING = `
|
|
536
|
-
mutation MovethewheelsCreateServiceOffering($input:
|
|
555
|
+
mutation MovethewheelsCreateServiceOffering($input: MtwCreateServiceOfferingInput!) {
|
|
537
556
|
createServiceOffering(input: $input) { ${SERVICE_OFFERING_FIELDS} }
|
|
538
557
|
}
|
|
539
558
|
`;
|
|
540
559
|
var UPDATE_SERVICE_OFFERING = `
|
|
541
|
-
mutation MovethewheelsUpdateServiceOffering($id: ID!, $input:
|
|
560
|
+
mutation MovethewheelsUpdateServiceOffering($id: ID!, $input: MtwUpdateServiceOfferingInput!) {
|
|
542
561
|
updateServiceOffering(id: $id, input: $input) { ${SERVICE_OFFERING_FIELDS} }
|
|
543
562
|
}
|
|
544
563
|
`;
|
|
@@ -547,65 +566,19 @@ var DELETE_SERVICE_OFFERING = `
|
|
|
547
566
|
deleteServiceOffering(id: $id)
|
|
548
567
|
}
|
|
549
568
|
`;
|
|
550
|
-
var
|
|
551
|
-
query
|
|
552
|
-
|
|
553
|
-
}
|
|
554
|
-
`;
|
|
555
|
-
var LIST_REPORTS = `
|
|
556
|
-
query MovethewheelsListReports(
|
|
557
|
-
$filter: MovethewheelsReportFilterInput
|
|
558
|
-
$pagination: PaginationInput
|
|
559
|
-
) {
|
|
560
|
-
movethewheelsReports(filter: $filter, pagination: $pagination) { ${REPORT_FIELDS} }
|
|
561
|
-
}
|
|
562
|
-
`;
|
|
563
|
-
var CREATE_REPORT = `
|
|
564
|
-
mutation MovethewheelsCreateReport($input: CreateMovethewheelsReportInput!) {
|
|
565
|
-
createMovethewheelsReport(input: $input) { ${REPORT_FIELDS} }
|
|
569
|
+
var MARKETPLACE_STATS = `
|
|
570
|
+
query MovethewheelsMarketplaceStats {
|
|
571
|
+
marketplaceStats { providers verifiedProviders activeProviders offerings avgRating }
|
|
566
572
|
}
|
|
567
573
|
`;
|
|
568
|
-
var
|
|
569
|
-
mutation
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
var DELETE_REPORT = `
|
|
574
|
-
mutation MovethewheelsDeleteReport($id: ID!) {
|
|
575
|
-
deleteMovethewheelsReport(id: $id)
|
|
576
|
-
}
|
|
577
|
-
`;
|
|
578
|
-
var GENERATE_REPORT = `
|
|
579
|
-
mutation MovethewheelsGenerateReport($input: GenerateMovethewheelsReportInput!) {
|
|
580
|
-
generateMovethewheelsReport(input: $input) {
|
|
581
|
-
generatedAt
|
|
582
|
-
result
|
|
583
|
-
report { ${REPORT_FIELDS} }
|
|
574
|
+
var ASSIGN_SHIPMENT_SERVICE_PROVIDER = `
|
|
575
|
+
mutation MovethewheelsAssignShipmentServiceProvider($shipmentId: ID!, $providerId: ID) {
|
|
576
|
+
assignShipmentServiceProvider(shipmentId: $shipmentId, providerId: $providerId) {
|
|
577
|
+
id shipmentNumber status carrierId
|
|
578
|
+
serviceProvider { id name type isVerified isActive deletedAt }
|
|
584
579
|
}
|
|
585
580
|
}
|
|
586
581
|
`;
|
|
587
|
-
var GET_MODULE_SETTINGS = `
|
|
588
|
-
query MovethewheelsModuleSettings {
|
|
589
|
-
moduleSettings { workspaceId preferences updatedAt }
|
|
590
|
-
}
|
|
591
|
-
`;
|
|
592
|
-
var UPDATE_MODULE_SETTINGS = `
|
|
593
|
-
mutation MovethewheelsUpdateModuleSettings(
|
|
594
|
-
$input: UpdateMovethewheelsModuleSettingsInput!
|
|
595
|
-
) {
|
|
596
|
-
updateModuleSettings(input: $input) { workspaceId preferences updatedAt }
|
|
597
|
-
}
|
|
598
|
-
`;
|
|
599
|
-
var EXPORT_DATA = `
|
|
600
|
-
mutation MovethewheelsExportData($input: MovethewheelsExportDataInput!) {
|
|
601
|
-
exportData(input: $input) { success message payload }
|
|
602
|
-
}
|
|
603
|
-
`;
|
|
604
|
-
var IMPORT_DATA = `
|
|
605
|
-
mutation MovethewheelsImportData($input: MovethewheelsImportDataInput!) {
|
|
606
|
-
importData(input: $input) { success message payload }
|
|
607
|
-
}
|
|
608
|
-
`;
|
|
609
582
|
var GET_ANALYTICS = `
|
|
610
583
|
query MovethewheelsAnalytics {
|
|
611
584
|
analytics {
|
|
@@ -618,19 +591,33 @@ var GET_ANALYTICS = `
|
|
|
618
591
|
var GET_DASHBOARD_METRICS = `
|
|
619
592
|
query MovethewheelsDashboardMetrics {
|
|
620
593
|
dashboardMetrics {
|
|
621
|
-
|
|
594
|
+
totalDeliveryJobs
|
|
622
595
|
activeDeliveries
|
|
623
596
|
activeVehicles
|
|
624
597
|
availableDrivers
|
|
625
598
|
lowStockItems
|
|
626
599
|
totalRevenue
|
|
627
|
-
|
|
600
|
+
onTimeDeliveryRate
|
|
601
|
+
customerSatisfaction
|
|
602
|
+
recentDeliveryJobs { id deliveryJobNumber status priority createdAt }
|
|
628
603
|
}
|
|
629
604
|
}
|
|
630
605
|
`;
|
|
631
|
-
var
|
|
632
|
-
query
|
|
633
|
-
|
|
606
|
+
var GET_DELIVERY_JOB_STATS = `
|
|
607
|
+
query MovethewheelsDeliveryJobStats {
|
|
608
|
+
deliveryJobStats {
|
|
609
|
+
total
|
|
610
|
+
pending
|
|
611
|
+
confirmed
|
|
612
|
+
assigned
|
|
613
|
+
pickedUp
|
|
614
|
+
inTransit
|
|
615
|
+
outForDelivery
|
|
616
|
+
delivered
|
|
617
|
+
cancelled
|
|
618
|
+
failed
|
|
619
|
+
returned
|
|
620
|
+
}
|
|
634
621
|
}
|
|
635
622
|
`;
|
|
636
623
|
var GET_FLEET_STATS = `
|
|
@@ -643,6 +630,7 @@ var GET_FLEET_STATS = `
|
|
|
643
630
|
totalDrivers
|
|
644
631
|
availableDrivers
|
|
645
632
|
onDeliveryDrivers
|
|
633
|
+
avgDriverRating
|
|
646
634
|
}
|
|
647
635
|
}
|
|
648
636
|
`;
|
|
@@ -657,8 +645,8 @@ var GET_FINANCE_METRICS = `
|
|
|
657
645
|
`;
|
|
658
646
|
var DriverStatusEnum = zod.z.enum(["AVAILABLE", "INACTIVE", "OFF_DUTY", "ON_BREAK", "ON_DELIVERY"]).describe("Availability/duty status of a driver");
|
|
659
647
|
var InventoryTransactionTypeEnum = zod.z.enum(["ADJUSTMENT", "ISSUE", "RECEIPT", "RETURN", "TRANSFER"]).describe("Type of inventory ledger movement");
|
|
660
|
-
var
|
|
661
|
-
var
|
|
648
|
+
var DeliveryPriorityEnum = zod.z.enum(["CRITICAL", "HIGH", "LOW", "MEDIUM", "URGENT"]).describe("Dispatch priority of a delivery job");
|
|
649
|
+
var DeliveryJobStatusEnum = zod.z.enum([
|
|
662
650
|
"ASSIGNED",
|
|
663
651
|
"CANCELLED",
|
|
664
652
|
"CONFIRMED",
|
|
@@ -669,8 +657,7 @@ var OrderStatusEnum = zod.z.enum([
|
|
|
669
657
|
"PENDING",
|
|
670
658
|
"PICKED_UP",
|
|
671
659
|
"RETURNED"
|
|
672
|
-
]).describe("
|
|
673
|
-
var OrderTypeEnum = zod.z.enum(["B2B", "B2C", "MARKETPLACE", "SUBSCRIPTION"]).describe("Commercial type of an order");
|
|
660
|
+
]).describe("Lifecycle status of a delivery job");
|
|
674
661
|
var RouteStatusEnum = zod.z.enum(["CANCELLED", "COMPLETED", "IN_PROGRESS", "PLANNED"]).describe("Lifecycle status of a route");
|
|
675
662
|
var ShipmentStatusEnum = zod.z.enum(["DELIVERED", "FAILED", "IN_TRANSIT", "PICKED_UP", "PLANNED", "RETURNED"]).describe("Lifecycle status of a shipment");
|
|
676
663
|
var TrackingEventTypeEnum = zod.z.enum([
|
|
@@ -696,6 +683,32 @@ var VehicleTypeEnum = zod.z.enum([
|
|
|
696
683
|
"VAN"
|
|
697
684
|
]).describe("Class of vehicle in the fleet");
|
|
698
685
|
var WarehouseTypeEnum = zod.z.enum(["COLD_STORAGE", "CROSS_DOCK", "DISTRIBUTION", "FULFILLMENT", "RETAIL"]).describe("Type of warehouse facility");
|
|
686
|
+
var ServiceProviderTypeEnum = zod.z.enum([
|
|
687
|
+
"CARRIER",
|
|
688
|
+
"FREIGHT_FORWARDER",
|
|
689
|
+
"THIRD_PARTY_LOGISTICS",
|
|
690
|
+
"WAREHOUSE",
|
|
691
|
+
"CUSTOMS_BROKER",
|
|
692
|
+
"LAST_MILE",
|
|
693
|
+
"COURIER",
|
|
694
|
+
"OTHER"
|
|
695
|
+
]).describe("Kind of marketplace service provider");
|
|
696
|
+
var ServiceOfferingCategoryEnum = zod.z.enum([
|
|
697
|
+
"FULL_TRUCKLOAD",
|
|
698
|
+
"LESS_THAN_TRUCKLOAD",
|
|
699
|
+
"LAST_MILE",
|
|
700
|
+
"EXPRESS",
|
|
701
|
+
"OCEAN_FREIGHT",
|
|
702
|
+
"AIR_FREIGHT",
|
|
703
|
+
"RAIL_FREIGHT",
|
|
704
|
+
"WAREHOUSING",
|
|
705
|
+
"CUSTOMS_CLEARANCE",
|
|
706
|
+
"COLD_CHAIN",
|
|
707
|
+
"OTHER"
|
|
708
|
+
]).describe("What a marketplace service offering provides");
|
|
709
|
+
var ServiceAvailabilityEnum = zod.z.enum(["AVAILABLE", "LIMITED", "UNAVAILABLE"]).describe("Whether the provider currently has capacity for an offering");
|
|
710
|
+
var IsoDateTime = zod.z.string().datetime({ offset: true }).describe("ISO 8601 date-time, e.g. 2026-10-31T09:30:00Z");
|
|
711
|
+
var StockQuantity = zod.z.number().int().min(0).max(2147483647);
|
|
699
712
|
var JsonObject = zod.z.record(zod.z.string(), zod.z.unknown());
|
|
700
713
|
var JsonValue = zod.z.union([JsonObject, zod.z.array(zod.z.unknown())]);
|
|
701
714
|
|
|
@@ -924,7 +937,7 @@ function registerDriverTools(server, ctx, track) {
|
|
|
924
937
|
status: DriverStatusEnum.optional().describe("Initial status (default AVAILABLE)"),
|
|
925
938
|
licenseNumber: zod.z.string().optional().describe("Driving license number"),
|
|
926
939
|
licenseClass: zod.z.string().optional().describe("Driving license class"),
|
|
927
|
-
licenseExpiry:
|
|
940
|
+
licenseExpiry: IsoDateTime.optional().describe("License expiry (ISO 8601 date-time)"),
|
|
928
941
|
certifications: JsonObject.optional().describe("Certifications JSON"),
|
|
929
942
|
currentLocation: JsonObject.optional().describe("Current location JSON ({ lat, lng })"),
|
|
930
943
|
performanceMetrics: JsonObject.optional().describe("Performance metrics JSON"),
|
|
@@ -988,7 +1001,9 @@ function registerDriverTools(server, ctx, track) {
|
|
|
988
1001
|
status: DriverStatusEnum.optional().describe("Updated status"),
|
|
989
1002
|
licenseNumber: zod.z.string().optional().describe("Updated license number"),
|
|
990
1003
|
licenseClass: zod.z.string().optional().describe("Updated license class"),
|
|
991
|
-
licenseExpiry:
|
|
1004
|
+
licenseExpiry: IsoDateTime.optional().describe(
|
|
1005
|
+
"Updated license expiry (ISO 8601 date-time)"
|
|
1006
|
+
),
|
|
992
1007
|
certifications: JsonObject.optional().describe("Updated certifications JSON"),
|
|
993
1008
|
currentLocation: JsonObject.optional().describe("Updated location JSON"),
|
|
994
1009
|
performanceMetrics: JsonObject.optional().describe("Updated performance metrics JSON"),
|
|
@@ -1346,23 +1361,23 @@ function registerVehicleTools(server, ctx, track) {
|
|
|
1346
1361
|
}
|
|
1347
1362
|
);
|
|
1348
1363
|
}
|
|
1349
|
-
function
|
|
1364
|
+
function registerCargoTools(server, ctx, track) {
|
|
1350
1365
|
server.registerTool(
|
|
1351
1366
|
track(mcpToolName(ctx.productName, "cargo_get")),
|
|
1352
1367
|
{
|
|
1353
|
-
title: "Get
|
|
1354
|
-
description: "Fetch a single
|
|
1355
|
-
inputSchema: { id: zod.z.string().describe("
|
|
1368
|
+
title: "Get Cargo Item",
|
|
1369
|
+
description: "Fetch a single cargo item (cargo SKU) by ID.",
|
|
1370
|
+
inputSchema: { id: zod.z.string().describe("Cargo item ID") }
|
|
1356
1371
|
},
|
|
1357
1372
|
async ({ id }) => {
|
|
1358
1373
|
try {
|
|
1359
|
-
const data = await ctx.gql.workspace.request(
|
|
1360
|
-
if (!data.
|
|
1361
|
-
return jsonResult(data.
|
|
1374
|
+
const data = await ctx.gql.workspace.request(GET_CARGO_ITEM, { id });
|
|
1375
|
+
if (!data.cargoItem) return errorResult(`Cargo item ${id} not found`);
|
|
1376
|
+
return jsonResult(data.cargoItem);
|
|
1362
1377
|
} catch (error) {
|
|
1363
1378
|
ctx.logger.error("movethewheels cargo_get failed", { error: String(error) });
|
|
1364
1379
|
return errorResult(
|
|
1365
|
-
`Failed to get
|
|
1380
|
+
`Failed to get cargo item: ${error instanceof Error ? error.message : String(error)}`
|
|
1366
1381
|
);
|
|
1367
1382
|
}
|
|
1368
1383
|
}
|
|
@@ -1370,8 +1385,8 @@ function registerProductTools(server, ctx, track) {
|
|
|
1370
1385
|
server.registerTool(
|
|
1371
1386
|
track(mcpToolName(ctx.productName, "cargo_list")),
|
|
1372
1387
|
{
|
|
1373
|
-
title: "List
|
|
1374
|
-
description: "List
|
|
1388
|
+
title: "List Cargo Items",
|
|
1389
|
+
description: "List cargo items with optional category/sku/text filters and pagination.",
|
|
1375
1390
|
inputSchema: {
|
|
1376
1391
|
search: zod.z.string().optional().describe("Free-text search across name/description"),
|
|
1377
1392
|
category: zod.z.string().optional().describe("Filter by category"),
|
|
@@ -1386,15 +1401,15 @@ function registerProductTools(server, ctx, track) {
|
|
|
1386
1401
|
if (search !== void 0) filter.search = search;
|
|
1387
1402
|
if (category !== void 0) filter.category = category;
|
|
1388
1403
|
if (sku !== void 0) filter.sku = sku;
|
|
1389
|
-
const data = await ctx.gql.workspace.request(
|
|
1404
|
+
const data = await ctx.gql.workspace.request(LIST_CARGO_ITEMS, {
|
|
1390
1405
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
1391
1406
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
1392
1407
|
});
|
|
1393
|
-
return jsonResult(data.
|
|
1408
|
+
return jsonResult(data.cargoItems);
|
|
1394
1409
|
} catch (error) {
|
|
1395
1410
|
ctx.logger.error("movethewheels cargo_list failed", { error: String(error) });
|
|
1396
1411
|
return errorResult(
|
|
1397
|
-
`Failed to list
|
|
1412
|
+
`Failed to list cargo items: ${error instanceof Error ? error.message : String(error)}`
|
|
1398
1413
|
);
|
|
1399
1414
|
}
|
|
1400
1415
|
}
|
|
@@ -1402,10 +1417,10 @@ function registerProductTools(server, ctx, track) {
|
|
|
1402
1417
|
server.registerTool(
|
|
1403
1418
|
track(mcpToolName(ctx.productName, "cargo_create")),
|
|
1404
1419
|
{
|
|
1405
|
-
title: "Create
|
|
1406
|
-
description: "Create a
|
|
1420
|
+
title: "Create Cargo Item",
|
|
1421
|
+
description: "Create a cargo item (cargo SKU). `name` and `sku` are required; `sku` must be unique in the workspace.",
|
|
1407
1422
|
inputSchema: {
|
|
1408
|
-
name: zod.z.string().min(1).describe("
|
|
1423
|
+
name: zod.z.string().min(1).describe("Cargo item name"),
|
|
1409
1424
|
sku: zod.z.string().min(1).describe("Stock-keeping unit (unique)"),
|
|
1410
1425
|
description: zod.z.string().optional().describe("Description"),
|
|
1411
1426
|
category: zod.z.string().optional().describe("Category"),
|
|
@@ -1444,12 +1459,12 @@ function registerProductTools(server, ctx, track) {
|
|
|
1444
1459
|
if (temperatureControlled !== void 0) {
|
|
1445
1460
|
input.temperatureControlled = temperatureControlled;
|
|
1446
1461
|
}
|
|
1447
|
-
const data = await ctx.gql.workspace.request(
|
|
1448
|
-
return jsonResult(data.
|
|
1462
|
+
const data = await ctx.gql.workspace.request(CREATE_CARGO_ITEM, { input });
|
|
1463
|
+
return jsonResult(data.createCargoItem);
|
|
1449
1464
|
} catch (error) {
|
|
1450
1465
|
ctx.logger.error("movethewheels cargo_create failed", { error: String(error) });
|
|
1451
1466
|
return errorResult(
|
|
1452
|
-
`Failed to create
|
|
1467
|
+
`Failed to create cargo item: ${error instanceof Error ? error.message : String(error)}`
|
|
1453
1468
|
);
|
|
1454
1469
|
}
|
|
1455
1470
|
}
|
|
@@ -1457,10 +1472,10 @@ function registerProductTools(server, ctx, track) {
|
|
|
1457
1472
|
server.registerTool(
|
|
1458
1473
|
track(mcpToolName(ctx.productName, "cargo_update")),
|
|
1459
1474
|
{
|
|
1460
|
-
title: "Update
|
|
1461
|
-
description: "Update a
|
|
1475
|
+
title: "Update Cargo Item",
|
|
1476
|
+
description: "Update a cargo item. At least one mutable field must be provided.",
|
|
1462
1477
|
inputSchema: {
|
|
1463
|
-
id: zod.z.string().describe("
|
|
1478
|
+
id: zod.z.string().describe("Cargo item ID"),
|
|
1464
1479
|
name: zod.z.string().optional().describe("Updated name"),
|
|
1465
1480
|
sku: zod.z.string().optional().describe("Updated SKU"),
|
|
1466
1481
|
description: zod.z.string().optional().describe("Updated description"),
|
|
@@ -1506,12 +1521,12 @@ function registerProductTools(server, ctx, track) {
|
|
|
1506
1521
|
if (Object.keys(input).length === 0) {
|
|
1507
1522
|
return errorResult("No updates specified \u2014 provide at least one mutable field.");
|
|
1508
1523
|
}
|
|
1509
|
-
const data = await ctx.gql.workspace.request(
|
|
1510
|
-
return jsonResult(data.
|
|
1524
|
+
const data = await ctx.gql.workspace.request(UPDATE_CARGO_ITEM, { id, input });
|
|
1525
|
+
return jsonResult(data.updateCargoItem);
|
|
1511
1526
|
} catch (error) {
|
|
1512
1527
|
ctx.logger.error("movethewheels cargo_update failed", { error: String(error) });
|
|
1513
1528
|
return errorResult(
|
|
1514
|
-
`Failed to update
|
|
1529
|
+
`Failed to update cargo item: ${error instanceof Error ? error.message : String(error)}`
|
|
1515
1530
|
);
|
|
1516
1531
|
}
|
|
1517
1532
|
}
|
|
@@ -1519,62 +1534,63 @@ function registerProductTools(server, ctx, track) {
|
|
|
1519
1534
|
server.registerTool(
|
|
1520
1535
|
track(mcpToolName(ctx.productName, "cargo_delete")),
|
|
1521
1536
|
{
|
|
1522
|
-
title: "Delete
|
|
1523
|
-
description: "Soft-delete a
|
|
1524
|
-
inputSchema: { id: zod.z.string().describe("
|
|
1537
|
+
title: "Delete Cargo Item",
|
|
1538
|
+
description: "Soft-delete a cargo item by ID.",
|
|
1539
|
+
inputSchema: { id: zod.z.string().describe("Cargo item ID") }
|
|
1525
1540
|
},
|
|
1526
1541
|
async ({ id }) => {
|
|
1527
1542
|
try {
|
|
1528
1543
|
const data = await ctx.gql.workspace.request(
|
|
1529
|
-
|
|
1544
|
+
DELETE_CARGO_ITEM,
|
|
1530
1545
|
{ id }
|
|
1531
1546
|
);
|
|
1532
|
-
return jsonResult({ deleted: data.
|
|
1547
|
+
return jsonResult({ deleted: data.deleteCargoItem, id });
|
|
1533
1548
|
} catch (error) {
|
|
1534
1549
|
ctx.logger.error("movethewheels cargo_delete failed", { error: String(error) });
|
|
1535
1550
|
return errorResult(
|
|
1536
|
-
`Failed to delete
|
|
1551
|
+
`Failed to delete cargo item: ${error instanceof Error ? error.message : String(error)}`
|
|
1537
1552
|
);
|
|
1538
1553
|
}
|
|
1539
1554
|
}
|
|
1540
1555
|
);
|
|
1541
1556
|
}
|
|
1542
|
-
|
|
1557
|
+
var errorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
1558
|
+
function registerDeliveryJobTools(server, ctx, track) {
|
|
1543
1559
|
server.registerTool(
|
|
1544
|
-
track(mcpToolName(ctx.productName, "
|
|
1560
|
+
track(mcpToolName(ctx.productName, "delivery_jobs_get")),
|
|
1545
1561
|
{
|
|
1546
|
-
title: "Get
|
|
1547
|
-
description: "Fetch a single delivery
|
|
1548
|
-
inputSchema: { id: zod.z.string().describe("
|
|
1562
|
+
title: "Get Delivery Job",
|
|
1563
|
+
description: "Fetch a single delivery job by ID, including its customer, driver, vehicle, route and shipment links and its status history.",
|
|
1564
|
+
inputSchema: { id: zod.z.string().describe("Delivery job ID") }
|
|
1549
1565
|
},
|
|
1550
1566
|
async ({ id }) => {
|
|
1551
1567
|
try {
|
|
1552
|
-
const data = await ctx.gql.workspace.request(
|
|
1553
|
-
if (!data.
|
|
1554
|
-
return jsonResult(data.
|
|
1568
|
+
const data = await ctx.gql.workspace.request(GET_DELIVERY_JOB, { id });
|
|
1569
|
+
if (!data.deliveryJob) return errorResult(`Delivery job ${id} not found`);
|
|
1570
|
+
return jsonResult(data.deliveryJob);
|
|
1555
1571
|
} catch (error) {
|
|
1556
|
-
ctx.logger.error("movethewheels
|
|
1557
|
-
return errorResult(
|
|
1558
|
-
`Failed to get order: ${error instanceof Error ? error.message : String(error)}`
|
|
1559
|
-
);
|
|
1572
|
+
ctx.logger.error("movethewheels delivery_jobs_get failed", { error: String(error) });
|
|
1573
|
+
return errorResult(`Failed to get delivery job: ${errorMessage(error)}`);
|
|
1560
1574
|
}
|
|
1561
1575
|
}
|
|
1562
1576
|
);
|
|
1563
1577
|
server.registerTool(
|
|
1564
|
-
track(mcpToolName(ctx.productName, "
|
|
1578
|
+
track(mcpToolName(ctx.productName, "delivery_jobs_list")),
|
|
1565
1579
|
{
|
|
1566
|
-
title: "List
|
|
1567
|
-
description: "List delivery
|
|
1580
|
+
title: "List Delivery Jobs",
|
|
1581
|
+
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.",
|
|
1568
1582
|
inputSchema: {
|
|
1569
|
-
search: zod.z.string().optional().describe("Free-text search across
|
|
1583
|
+
search: zod.z.string().optional().describe("Free-text search across deliveryJobNumber"),
|
|
1570
1584
|
customerId: zod.z.string().optional().describe("Filter by customer ID"),
|
|
1571
1585
|
driverId: zod.z.string().optional().describe("Filter by driver ID"),
|
|
1572
1586
|
vehicleId: zod.z.string().optional().describe("Filter by vehicle ID"),
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1587
|
+
routeId: zod.z.string().optional().describe("Filter by route ID"),
|
|
1588
|
+
storeOrderId: zod.z.string().optional().describe("Filter by global-store order ID"),
|
|
1589
|
+
priority: DeliveryPriorityEnum.optional().describe("Filter by priority"),
|
|
1590
|
+
status: DeliveryJobStatusEnum.optional().describe("Filter by status"),
|
|
1591
|
+
unassigned: zod.z.boolean().optional().describe("Only jobs with no driver assigned"),
|
|
1592
|
+
limit: zod.z.number().int().min(1).max(100).optional().describe("Page size (default 50)"),
|
|
1593
|
+
offset: zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
|
|
1578
1594
|
}
|
|
1579
1595
|
},
|
|
1580
1596
|
async ({
|
|
@@ -1582,9 +1598,11 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1582
1598
|
customerId,
|
|
1583
1599
|
driverId,
|
|
1584
1600
|
vehicleId,
|
|
1585
|
-
|
|
1601
|
+
routeId,
|
|
1602
|
+
storeOrderId,
|
|
1586
1603
|
priority,
|
|
1587
1604
|
status,
|
|
1605
|
+
unassigned,
|
|
1588
1606
|
limit,
|
|
1589
1607
|
offset
|
|
1590
1608
|
}) => {
|
|
@@ -1594,55 +1612,61 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1594
1612
|
if (customerId !== void 0) filter.customerId = customerId;
|
|
1595
1613
|
if (driverId !== void 0) filter.driverId = driverId;
|
|
1596
1614
|
if (vehicleId !== void 0) filter.vehicleId = vehicleId;
|
|
1597
|
-
if (
|
|
1615
|
+
if (routeId !== void 0) filter.routeId = routeId;
|
|
1616
|
+
if (storeOrderId !== void 0) filter.storeOrderId = storeOrderId;
|
|
1598
1617
|
if (priority !== void 0) filter.priority = priority;
|
|
1599
1618
|
if (status !== void 0) filter.status = status;
|
|
1600
|
-
|
|
1619
|
+
if (unassigned !== void 0) filter.unassigned = unassigned;
|
|
1620
|
+
const data = await ctx.gql.workspace.request(LIST_DELIVERY_JOBS, {
|
|
1601
1621
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
1602
1622
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
1603
1623
|
});
|
|
1604
|
-
return jsonResult(data.
|
|
1624
|
+
return jsonResult(data.deliveryJobs);
|
|
1605
1625
|
} catch (error) {
|
|
1606
|
-
ctx.logger.error("movethewheels
|
|
1607
|
-
return errorResult(
|
|
1608
|
-
`Failed to list orders: ${error instanceof Error ? error.message : String(error)}`
|
|
1609
|
-
);
|
|
1626
|
+
ctx.logger.error("movethewheels delivery_jobs_list failed", { error: String(error) });
|
|
1627
|
+
return errorResult(`Failed to list delivery jobs: ${errorMessage(error)}`);
|
|
1610
1628
|
}
|
|
1611
1629
|
}
|
|
1612
1630
|
);
|
|
1613
1631
|
server.registerTool(
|
|
1614
|
-
track(mcpToolName(ctx.productName, "
|
|
1632
|
+
track(mcpToolName(ctx.productName, "delivery_jobs_create")),
|
|
1615
1633
|
{
|
|
1616
|
-
title: "Create
|
|
1617
|
-
description: "Create a delivery
|
|
1634
|
+
title: "Create Delivery Job",
|
|
1635
|
+
description: "Create a delivery job. `customerId`, `deliveryJobNumber`, `pickupAddress`, `deliveryAddress` and `cargoItems` are required. `priority` defaults to MEDIUM and `status` to PENDING.",
|
|
1618
1636
|
inputSchema: {
|
|
1619
|
-
customerId: zod.z.string().min(1).describe("
|
|
1620
|
-
|
|
1637
|
+
customerId: zod.z.string().min(1).describe("Customer the job is delivered for"),
|
|
1638
|
+
deliveryJobNumber: zod.z.string().min(1).describe("Human-readable delivery job number (unique in the workspace)"),
|
|
1621
1639
|
pickupAddress: JsonObject.describe("Pickup address JSON"),
|
|
1622
1640
|
deliveryAddress: JsonObject.describe("Delivery address JSON"),
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1641
|
+
cargoItems: JsonValue.describe(
|
|
1642
|
+
"Cargo carried by the job (JSON, usually an array of { cargoItemId or sku, quantity })"
|
|
1643
|
+
),
|
|
1644
|
+
priority: DeliveryPriorityEnum.optional().describe("Priority (default MEDIUM)"),
|
|
1645
|
+
status: DeliveryJobStatusEnum.optional().describe("Initial status (default PENDING)"),
|
|
1627
1646
|
driverId: zod.z.string().optional().describe("Assigned driver ID"),
|
|
1628
1647
|
vehicleId: zod.z.string().optional().describe("Assigned vehicle ID"),
|
|
1648
|
+
routeId: zod.z.string().optional().describe("Route the job runs on"),
|
|
1649
|
+
storeOrderId: zod.z.string().optional().describe("Global-store order this job fulfils, when it came from checkout"),
|
|
1629
1650
|
pricing: JsonObject.optional().describe("Pricing breakdown JSON"),
|
|
1630
|
-
scheduledDelivery:
|
|
1651
|
+
scheduledDelivery: IsoDateTime.optional().describe(
|
|
1652
|
+
"Scheduled delivery (ISO 8601 date-time)"
|
|
1653
|
+
),
|
|
1631
1654
|
specialInstructions: zod.z.string().optional().describe("Special handling instructions"),
|
|
1632
1655
|
trackingNumber: zod.z.string().optional().describe("Tracking number")
|
|
1633
1656
|
}
|
|
1634
1657
|
},
|
|
1635
1658
|
async ({
|
|
1636
1659
|
customerId,
|
|
1637
|
-
|
|
1660
|
+
deliveryJobNumber,
|
|
1638
1661
|
pickupAddress,
|
|
1639
1662
|
deliveryAddress,
|
|
1640
|
-
|
|
1641
|
-
orderType,
|
|
1663
|
+
cargoItems,
|
|
1642
1664
|
priority,
|
|
1643
1665
|
status,
|
|
1644
1666
|
driverId,
|
|
1645
1667
|
vehicleId,
|
|
1668
|
+
routeId,
|
|
1669
|
+
storeOrderId,
|
|
1646
1670
|
pricing,
|
|
1647
1671
|
scheduledDelivery,
|
|
1648
1672
|
specialInstructions,
|
|
@@ -1651,48 +1675,49 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1651
1675
|
try {
|
|
1652
1676
|
const input = {
|
|
1653
1677
|
customerId,
|
|
1654
|
-
|
|
1678
|
+
deliveryJobNumber,
|
|
1655
1679
|
pickupAddress,
|
|
1656
1680
|
deliveryAddress,
|
|
1657
|
-
|
|
1681
|
+
cargoItems
|
|
1658
1682
|
};
|
|
1659
|
-
if (orderType !== void 0) input.orderType = orderType;
|
|
1660
1683
|
if (priority !== void 0) input.priority = priority;
|
|
1661
1684
|
if (status !== void 0) input.status = status;
|
|
1662
1685
|
if (driverId !== void 0) input.driverId = driverId;
|
|
1663
1686
|
if (vehicleId !== void 0) input.vehicleId = vehicleId;
|
|
1687
|
+
if (routeId !== void 0) input.routeId = routeId;
|
|
1688
|
+
if (storeOrderId !== void 0) input.storeOrderId = storeOrderId;
|
|
1664
1689
|
if (pricing !== void 0) input.pricing = pricing;
|
|
1665
1690
|
if (scheduledDelivery !== void 0) input.scheduledDelivery = scheduledDelivery;
|
|
1666
1691
|
if (specialInstructions !== void 0) input.specialInstructions = specialInstructions;
|
|
1667
1692
|
if (trackingNumber !== void 0) input.trackingNumber = trackingNumber;
|
|
1668
|
-
const data = await ctx.gql.workspace.request(
|
|
1669
|
-
return jsonResult(data.
|
|
1693
|
+
const data = await ctx.gql.workspace.request(CREATE_DELIVERY_JOB, { input });
|
|
1694
|
+
return jsonResult(data.createDeliveryJob);
|
|
1670
1695
|
} catch (error) {
|
|
1671
|
-
ctx.logger.error("movethewheels
|
|
1672
|
-
return errorResult(
|
|
1673
|
-
`Failed to create order: ${error instanceof Error ? error.message : String(error)}`
|
|
1674
|
-
);
|
|
1696
|
+
ctx.logger.error("movethewheels delivery_jobs_create failed", { error: String(error) });
|
|
1697
|
+
return errorResult(`Failed to create delivery job: ${errorMessage(error)}`);
|
|
1675
1698
|
}
|
|
1676
1699
|
}
|
|
1677
1700
|
);
|
|
1678
1701
|
server.registerTool(
|
|
1679
|
-
track(mcpToolName(ctx.productName, "
|
|
1702
|
+
track(mcpToolName(ctx.productName, "delivery_jobs_update")),
|
|
1680
1703
|
{
|
|
1681
|
-
title: "Update
|
|
1682
|
-
description: "Update a delivery
|
|
1704
|
+
title: "Update Delivery Job",
|
|
1705
|
+
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.",
|
|
1683
1706
|
inputSchema: {
|
|
1684
|
-
id: zod.z.string().describe("
|
|
1707
|
+
id: zod.z.string().describe("Delivery job ID"),
|
|
1685
1708
|
customerId: zod.z.string().optional().describe("Updated customer ID"),
|
|
1686
1709
|
driverId: zod.z.string().optional().describe("Updated driver ID"),
|
|
1687
1710
|
vehicleId: zod.z.string().optional().describe("Updated vehicle ID"),
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1711
|
+
routeId: zod.z.string().optional().describe("Updated route ID"),
|
|
1712
|
+
storeOrderId: zod.z.string().optional().describe("Updated global-store order ID"),
|
|
1713
|
+
priority: DeliveryPriorityEnum.optional().describe("Updated priority"),
|
|
1691
1714
|
pickupAddress: JsonObject.optional().describe("Updated pickup address JSON"),
|
|
1692
1715
|
deliveryAddress: JsonObject.optional().describe("Updated delivery address JSON"),
|
|
1693
|
-
|
|
1716
|
+
cargoItems: JsonValue.optional().describe("Updated cargo JSON"),
|
|
1694
1717
|
pricing: JsonObject.optional().describe("Updated pricing JSON"),
|
|
1695
|
-
scheduledDelivery:
|
|
1718
|
+
scheduledDelivery: IsoDateTime.optional().describe(
|
|
1719
|
+
"Updated scheduled delivery (ISO 8601 date-time)"
|
|
1720
|
+
),
|
|
1696
1721
|
specialInstructions: zod.z.string().optional().describe("Updated special instructions"),
|
|
1697
1722
|
trackingNumber: zod.z.string().optional().describe("Updated tracking number")
|
|
1698
1723
|
}
|
|
@@ -1702,12 +1727,12 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1702
1727
|
customerId,
|
|
1703
1728
|
driverId,
|
|
1704
1729
|
vehicleId,
|
|
1705
|
-
|
|
1730
|
+
routeId,
|
|
1731
|
+
storeOrderId,
|
|
1706
1732
|
priority,
|
|
1707
|
-
status,
|
|
1708
1733
|
pickupAddress,
|
|
1709
1734
|
deliveryAddress,
|
|
1710
|
-
|
|
1735
|
+
cargoItems,
|
|
1711
1736
|
pricing,
|
|
1712
1737
|
scheduledDelivery,
|
|
1713
1738
|
specialInstructions,
|
|
@@ -1718,12 +1743,12 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1718
1743
|
if (customerId !== void 0) input.customerId = customerId;
|
|
1719
1744
|
if (driverId !== void 0) input.driverId = driverId;
|
|
1720
1745
|
if (vehicleId !== void 0) input.vehicleId = vehicleId;
|
|
1721
|
-
if (
|
|
1746
|
+
if (routeId !== void 0) input.routeId = routeId;
|
|
1747
|
+
if (storeOrderId !== void 0) input.storeOrderId = storeOrderId;
|
|
1722
1748
|
if (priority !== void 0) input.priority = priority;
|
|
1723
|
-
if (status !== void 0) input.status = status;
|
|
1724
1749
|
if (pickupAddress !== void 0) input.pickupAddress = pickupAddress;
|
|
1725
1750
|
if (deliveryAddress !== void 0) input.deliveryAddress = deliveryAddress;
|
|
1726
|
-
if (
|
|
1751
|
+
if (cargoItems !== void 0) input.cargoItems = cargoItems;
|
|
1727
1752
|
if (pricing !== void 0) input.pricing = pricing;
|
|
1728
1753
|
if (scheduledDelivery !== void 0) input.scheduledDelivery = scheduledDelivery;
|
|
1729
1754
|
if (specialInstructions !== void 0) input.specialInstructions = specialInstructions;
|
|
@@ -1731,26 +1756,24 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1731
1756
|
if (Object.keys(input).length === 0) {
|
|
1732
1757
|
return errorResult("No updates specified \u2014 provide at least one mutable field.");
|
|
1733
1758
|
}
|
|
1734
|
-
const data = await ctx.gql.workspace.request(
|
|
1735
|
-
return jsonResult(data.
|
|
1759
|
+
const data = await ctx.gql.workspace.request(UPDATE_DELIVERY_JOB, { id, input });
|
|
1760
|
+
return jsonResult(data.updateDeliveryJob);
|
|
1736
1761
|
} catch (error) {
|
|
1737
|
-
ctx.logger.error("movethewheels
|
|
1738
|
-
return errorResult(
|
|
1739
|
-
`Failed to update order: ${error instanceof Error ? error.message : String(error)}`
|
|
1740
|
-
);
|
|
1762
|
+
ctx.logger.error("movethewheels delivery_jobs_update failed", { error: String(error) });
|
|
1763
|
+
return errorResult(`Failed to update delivery job: ${errorMessage(error)}`);
|
|
1741
1764
|
}
|
|
1742
1765
|
}
|
|
1743
1766
|
);
|
|
1744
1767
|
server.registerTool(
|
|
1745
|
-
track(mcpToolName(ctx.productName, "
|
|
1768
|
+
track(mcpToolName(ctx.productName, "delivery_jobs_update_status")),
|
|
1746
1769
|
{
|
|
1747
|
-
title: "Update
|
|
1748
|
-
description: "Advance
|
|
1770
|
+
title: "Update Delivery Job Status",
|
|
1771
|
+
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.",
|
|
1749
1772
|
inputSchema: {
|
|
1750
|
-
id: zod.z.string().describe("
|
|
1751
|
-
status:
|
|
1773
|
+
id: zod.z.string().describe("Delivery job ID"),
|
|
1774
|
+
status: DeliveryJobStatusEnum.describe("New delivery job status"),
|
|
1752
1775
|
notes: zod.z.string().optional().describe("Status-change notes"),
|
|
1753
|
-
location: JsonObject.optional().describe("Location JSON at time of
|
|
1776
|
+
location: JsonObject.optional().describe("Location JSON at the time of the change")
|
|
1754
1777
|
}
|
|
1755
1778
|
},
|
|
1756
1779
|
async ({ id, status, notes, location }) => {
|
|
@@ -1758,35 +1781,33 @@ function registerOrderTools(server, ctx, track) {
|
|
|
1758
1781
|
const input = { status };
|
|
1759
1782
|
if (notes !== void 0) input.notes = notes;
|
|
1760
1783
|
if (location !== void 0) input.location = location;
|
|
1761
|
-
const data = await ctx.gql.workspace.request(
|
|
1762
|
-
return jsonResult(data.
|
|
1784
|
+
const data = await ctx.gql.workspace.request(UPDATE_DELIVERY_JOB_STATUS, { id, input });
|
|
1785
|
+
return jsonResult(data.updateDeliveryJobStatus);
|
|
1763
1786
|
} catch (error) {
|
|
1764
|
-
ctx.logger.error("movethewheels
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
);
|
|
1787
|
+
ctx.logger.error("movethewheels delivery_jobs_update_status failed", {
|
|
1788
|
+
error: String(error)
|
|
1789
|
+
});
|
|
1790
|
+
return errorResult(`Failed to update delivery job status: ${errorMessage(error)}`);
|
|
1768
1791
|
}
|
|
1769
1792
|
}
|
|
1770
1793
|
);
|
|
1771
1794
|
server.registerTool(
|
|
1772
|
-
track(mcpToolName(ctx.productName, "
|
|
1795
|
+
track(mcpToolName(ctx.productName, "delivery_jobs_delete")),
|
|
1773
1796
|
{
|
|
1774
|
-
title: "Delete
|
|
1775
|
-
description: "Soft-delete a delivery
|
|
1776
|
-
inputSchema: { id: zod.z.string().describe("
|
|
1797
|
+
title: "Delete Delivery Job",
|
|
1798
|
+
description: "Soft-delete a delivery job by ID.",
|
|
1799
|
+
inputSchema: { id: zod.z.string().describe("Delivery job ID") }
|
|
1777
1800
|
},
|
|
1778
1801
|
async ({ id }) => {
|
|
1779
1802
|
try {
|
|
1780
1803
|
const data = await ctx.gql.workspace.request(
|
|
1781
|
-
|
|
1804
|
+
DELETE_DELIVERY_JOB,
|
|
1782
1805
|
{ id }
|
|
1783
1806
|
);
|
|
1784
|
-
return jsonResult({ deleted: data.
|
|
1807
|
+
return jsonResult({ deleted: data.deleteDeliveryJob, id });
|
|
1785
1808
|
} catch (error) {
|
|
1786
|
-
ctx.logger.error("movethewheels
|
|
1787
|
-
return errorResult(
|
|
1788
|
-
`Failed to delete order: ${error instanceof Error ? error.message : String(error)}`
|
|
1789
|
-
);
|
|
1809
|
+
ctx.logger.error("movethewheels delivery_jobs_delete failed", { error: String(error) });
|
|
1810
|
+
return errorResult(`Failed to delete delivery job: ${errorMessage(error)}`);
|
|
1790
1811
|
}
|
|
1791
1812
|
}
|
|
1792
1813
|
);
|
|
@@ -1796,7 +1817,7 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1796
1817
|
track(mcpToolName(ctx.productName, "shipments_get")),
|
|
1797
1818
|
{
|
|
1798
1819
|
title: "Get Shipment",
|
|
1799
|
-
description: "Fetch a single shipment by ID, including its
|
|
1820
|
+
description: "Fetch a single shipment by ID, including its delivery job, marketplace carrier and tracking events.",
|
|
1800
1821
|
inputSchema: { id: zod.z.string().describe("Shipment ID") }
|
|
1801
1822
|
},
|
|
1802
1823
|
async ({ id }) => {
|
|
@@ -1816,24 +1837,38 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1816
1837
|
track(mcpToolName(ctx.productName, "shipments_list")),
|
|
1817
1838
|
{
|
|
1818
1839
|
title: "List Shipments",
|
|
1819
|
-
description: "List shipments with optional
|
|
1840
|
+
description: "List shipments with optional delivery-job/customer/carrier/driver/vehicle/status/text filters and pagination.",
|
|
1820
1841
|
inputSchema: {
|
|
1821
1842
|
search: zod.z.string().optional().describe("Free-text search across shipmentNumber"),
|
|
1822
|
-
|
|
1843
|
+
deliveryJobId: zod.z.string().optional().describe("Filter by delivery job ID"),
|
|
1823
1844
|
customerId: zod.z.string().optional().describe("Filter by customer ID"),
|
|
1824
1845
|
carrierId: zod.z.string().optional().describe("Filter by carrier ID"),
|
|
1846
|
+
driverId: zod.z.string().optional().describe("Filter by assigned driver ID"),
|
|
1847
|
+
vehicleId: zod.z.string().optional().describe("Filter by assigned vehicle ID"),
|
|
1825
1848
|
status: ShipmentStatusEnum.optional().describe("Filter by shipment status"),
|
|
1826
1849
|
limit: zod.z.number().int().optional().describe("Page size (default 50)"),
|
|
1827
1850
|
offset: zod.z.number().int().optional().describe("Pagination offset (default 0)")
|
|
1828
1851
|
}
|
|
1829
1852
|
},
|
|
1830
|
-
async ({
|
|
1853
|
+
async ({
|
|
1854
|
+
search,
|
|
1855
|
+
deliveryJobId,
|
|
1856
|
+
customerId,
|
|
1857
|
+
carrierId,
|
|
1858
|
+
driverId,
|
|
1859
|
+
vehicleId,
|
|
1860
|
+
status,
|
|
1861
|
+
limit,
|
|
1862
|
+
offset
|
|
1863
|
+
}) => {
|
|
1831
1864
|
try {
|
|
1832
1865
|
const filter = {};
|
|
1833
1866
|
if (search !== void 0) filter.search = search;
|
|
1834
|
-
if (
|
|
1867
|
+
if (deliveryJobId !== void 0) filter.deliveryJobId = deliveryJobId;
|
|
1835
1868
|
if (customerId !== void 0) filter.customerId = customerId;
|
|
1836
1869
|
if (carrierId !== void 0) filter.carrierId = carrierId;
|
|
1870
|
+
if (driverId !== void 0) filter.driverId = driverId;
|
|
1871
|
+
if (vehicleId !== void 0) filter.vehicleId = vehicleId;
|
|
1837
1872
|
if (status !== void 0) filter.status = status;
|
|
1838
1873
|
const data = await ctx.gql.workspace.request(LIST_SHIPMENTS, {
|
|
1839
1874
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
@@ -1878,27 +1913,31 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1878
1913
|
track(mcpToolName(ctx.productName, "shipments_create")),
|
|
1879
1914
|
{
|
|
1880
1915
|
title: "Create Shipment",
|
|
1881
|
-
description: "Create a shipment
|
|
1916
|
+
description: "Create a shipment. `shipmentNumber`, `origin`, and `destination` are required; link it to the delivery job it carries with `deliveryJobId`. `status` defaults to PLANNED.",
|
|
1882
1917
|
inputSchema: {
|
|
1883
|
-
orderId: zod.z.string().min(1).describe("Source order ID"),
|
|
1884
1918
|
shipmentNumber: zod.z.string().min(1).describe("Human-readable shipment number (unique)"),
|
|
1885
1919
|
origin: JsonObject.describe("Origin address JSON"),
|
|
1886
1920
|
destination: JsonObject.describe("Destination address JSON"),
|
|
1887
1921
|
status: ShipmentStatusEnum.optional().describe("Initial status (default PLANNED)"),
|
|
1922
|
+
deliveryJobId: zod.z.string().optional().describe("Delivery job this shipment carries"),
|
|
1923
|
+
storeOrderId: zod.z.string().optional().describe("Global-store order this shipment fulfils"),
|
|
1888
1924
|
customerId: zod.z.string().optional().describe("Customer ID"),
|
|
1889
1925
|
carrierId: zod.z.string().optional().describe("Carrier ID"),
|
|
1890
1926
|
trackingNumber: zod.z.string().optional().describe("Carrier tracking number"),
|
|
1891
1927
|
cargoDetails: JsonObject.optional().describe("Cargo details JSON"),
|
|
1892
|
-
estimatedDelivery:
|
|
1893
|
-
|
|
1928
|
+
estimatedDelivery: IsoDateTime.optional().describe(
|
|
1929
|
+
"Estimated delivery (ISO 8601 date-time)"
|
|
1930
|
+
),
|
|
1931
|
+
actualDelivery: IsoDateTime.optional().describe("Actual delivery (ISO 8601 date-time)")
|
|
1894
1932
|
}
|
|
1895
1933
|
},
|
|
1896
1934
|
async ({
|
|
1897
|
-
orderId,
|
|
1898
1935
|
shipmentNumber,
|
|
1899
1936
|
origin,
|
|
1900
1937
|
destination,
|
|
1901
1938
|
status,
|
|
1939
|
+
deliveryJobId,
|
|
1940
|
+
storeOrderId,
|
|
1902
1941
|
customerId,
|
|
1903
1942
|
carrierId,
|
|
1904
1943
|
trackingNumber,
|
|
@@ -1907,8 +1946,10 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1907
1946
|
actualDelivery
|
|
1908
1947
|
}) => {
|
|
1909
1948
|
try {
|
|
1910
|
-
const input = {
|
|
1949
|
+
const input = { shipmentNumber, origin, destination };
|
|
1911
1950
|
if (status !== void 0) input.status = status;
|
|
1951
|
+
if (deliveryJobId !== void 0) input.deliveryJobId = deliveryJobId;
|
|
1952
|
+
if (storeOrderId !== void 0) input.storeOrderId = storeOrderId;
|
|
1912
1953
|
if (customerId !== void 0) input.customerId = customerId;
|
|
1913
1954
|
if (carrierId !== void 0) input.carrierId = carrierId;
|
|
1914
1955
|
if (trackingNumber !== void 0) input.trackingNumber = trackingNumber;
|
|
@@ -1933,19 +1974,31 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1933
1974
|
inputSchema: {
|
|
1934
1975
|
id: zod.z.string().describe("Shipment ID"),
|
|
1935
1976
|
status: ShipmentStatusEnum.optional().describe("Updated status"),
|
|
1977
|
+
statusReason: zod.z.string().optional().describe("Why the status changed (kept with the status decision)"),
|
|
1978
|
+
expectedStatusRevision: zod.z.number().int().min(0).optional().describe(
|
|
1979
|
+
"statusRevision you last read; the update is refused if the shipment changed since"
|
|
1980
|
+
),
|
|
1981
|
+
deliveryJobId: zod.z.string().optional().describe("Updated delivery job ID"),
|
|
1936
1982
|
customerId: zod.z.string().optional().describe("Updated customer ID"),
|
|
1937
1983
|
carrierId: zod.z.string().optional().describe("Updated carrier ID"),
|
|
1938
1984
|
origin: JsonObject.optional().describe("Updated origin JSON"),
|
|
1939
1985
|
destination: JsonObject.optional().describe("Updated destination JSON"),
|
|
1940
1986
|
trackingNumber: zod.z.string().optional().describe("Updated tracking number"),
|
|
1941
1987
|
cargoDetails: JsonObject.optional().describe("Updated cargo details JSON"),
|
|
1942
|
-
estimatedDelivery:
|
|
1943
|
-
|
|
1988
|
+
estimatedDelivery: IsoDateTime.optional().describe(
|
|
1989
|
+
"Updated estimated delivery (ISO 8601 date-time)"
|
|
1990
|
+
),
|
|
1991
|
+
actualDelivery: IsoDateTime.optional().describe(
|
|
1992
|
+
"Updated actual delivery (ISO 8601 date-time)"
|
|
1993
|
+
)
|
|
1944
1994
|
}
|
|
1945
1995
|
},
|
|
1946
1996
|
async ({
|
|
1947
1997
|
id,
|
|
1948
1998
|
status,
|
|
1999
|
+
statusReason,
|
|
2000
|
+
expectedStatusRevision,
|
|
2001
|
+
deliveryJobId,
|
|
1949
2002
|
customerId,
|
|
1950
2003
|
carrierId,
|
|
1951
2004
|
origin,
|
|
@@ -1958,6 +2011,11 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
1958
2011
|
try {
|
|
1959
2012
|
const input = {};
|
|
1960
2013
|
if (status !== void 0) input.status = status;
|
|
2014
|
+
if (statusReason !== void 0) input.statusReason = statusReason;
|
|
2015
|
+
if (expectedStatusRevision !== void 0) {
|
|
2016
|
+
input.expectedStatusRevision = expectedStatusRevision;
|
|
2017
|
+
}
|
|
2018
|
+
if (deliveryJobId !== void 0) input.deliveryJobId = deliveryJobId;
|
|
1961
2019
|
if (customerId !== void 0) input.customerId = customerId;
|
|
1962
2020
|
if (carrierId !== void 0) input.carrierId = carrierId;
|
|
1963
2021
|
if (origin !== void 0) input.origin = origin;
|
|
@@ -2004,27 +2062,29 @@ function registerShipmentTools(server, ctx, track) {
|
|
|
2004
2062
|
}
|
|
2005
2063
|
function registerTrackingTools(server, ctx, track) {
|
|
2006
2064
|
server.registerTool(
|
|
2007
|
-
track(mcpToolName(ctx.productName, "
|
|
2065
|
+
track(mcpToolName(ctx.productName, "tracking_delivery_job_events")),
|
|
2008
2066
|
{
|
|
2009
|
-
title: "
|
|
2010
|
-
description: "List tracking events for
|
|
2067
|
+
title: "Delivery Job Tracking Timeline",
|
|
2068
|
+
description: "List tracking events for a delivery job (across its shipments), most recent first.",
|
|
2011
2069
|
inputSchema: {
|
|
2012
|
-
|
|
2070
|
+
deliveryJobId: zod.z.string().describe("Delivery job ID"),
|
|
2013
2071
|
limit: zod.z.number().int().optional().describe("Page size (default 50)"),
|
|
2014
2072
|
offset: zod.z.number().int().optional().describe("Pagination offset (default 0)")
|
|
2015
2073
|
}
|
|
2016
2074
|
},
|
|
2017
|
-
async ({
|
|
2075
|
+
async ({ deliveryJobId, limit, offset }) => {
|
|
2018
2076
|
try {
|
|
2019
|
-
const data = await ctx.gql.workspace.request(
|
|
2020
|
-
|
|
2077
|
+
const data = await ctx.gql.workspace.request(GET_DELIVERY_JOB_TRACKING, {
|
|
2078
|
+
deliveryJobId,
|
|
2021
2079
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
2022
2080
|
});
|
|
2023
|
-
return jsonResult(data.
|
|
2081
|
+
return jsonResult(data.deliveryJobTracking);
|
|
2024
2082
|
} catch (error) {
|
|
2025
|
-
ctx.logger.error("movethewheels
|
|
2083
|
+
ctx.logger.error("movethewheels tracking_delivery_job_events failed", {
|
|
2084
|
+
error: String(error)
|
|
2085
|
+
});
|
|
2026
2086
|
return errorResult(
|
|
2027
|
-
`Failed to get
|
|
2087
|
+
`Failed to get delivery job tracking: ${error instanceof Error ? error.message : String(error)}`
|
|
2028
2088
|
);
|
|
2029
2089
|
}
|
|
2030
2090
|
}
|
|
@@ -2059,7 +2119,7 @@ function registerTrackingTools(server, ctx, track) {
|
|
|
2059
2119
|
track(mcpToolName(ctx.productName, "tracking_alerts")),
|
|
2060
2120
|
{
|
|
2061
2121
|
title: "Tracking Alerts",
|
|
2062
|
-
description: "List
|
|
2122
|
+
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).",
|
|
2063
2123
|
inputSchema: {
|
|
2064
2124
|
limit: zod.z.number().int().optional().describe("Page size (default 50)"),
|
|
2065
2125
|
offset: zod.z.number().int().optional().describe("Pagination offset (default 0)")
|
|
@@ -2089,7 +2149,7 @@ function registerTrackingTools(server, ctx, track) {
|
|
|
2089
2149
|
eventType: TrackingEventTypeEnum.describe("Type of tracking event"),
|
|
2090
2150
|
details: zod.z.string().optional().describe("Free-text event details"),
|
|
2091
2151
|
location: JsonObject.optional().describe("Location JSON ({ lat, lng, address })"),
|
|
2092
|
-
timestamp:
|
|
2152
|
+
timestamp: IsoDateTime.optional().describe("Event timestamp (ISO 8601; defaults to now)")
|
|
2093
2153
|
}
|
|
2094
2154
|
},
|
|
2095
2155
|
async ({ shipmentId, eventType, details, location, timestamp }) => {
|
|
@@ -2603,7 +2663,7 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2603
2663
|
track(mcpToolName(ctx.productName, "inventory_get_item")),
|
|
2604
2664
|
{
|
|
2605
2665
|
title: "Get Inventory Item",
|
|
2606
|
-
description: "Fetch a single inventory item by ID, including its
|
|
2666
|
+
description: "Fetch a single inventory item by ID, including its cargo item, warehouse, and location.",
|
|
2607
2667
|
inputSchema: { id: zod.z.string().describe("Inventory item ID") }
|
|
2608
2668
|
},
|
|
2609
2669
|
async ({ id }) => {
|
|
@@ -2623,23 +2683,25 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2623
2683
|
track(mcpToolName(ctx.productName, "inventory_list_items")),
|
|
2624
2684
|
{
|
|
2625
2685
|
title: "List Inventory Items",
|
|
2626
|
-
description: "List inventory items with optional
|
|
2686
|
+
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.",
|
|
2627
2687
|
inputSchema: {
|
|
2628
2688
|
search: zod.z.string().optional().describe("Free-text search"),
|
|
2629
|
-
|
|
2689
|
+
cargoItemId: zod.z.string().optional().describe("Filter by cargo item ID"),
|
|
2630
2690
|
warehouseId: zod.z.string().optional().describe("Filter by warehouse ID"),
|
|
2631
2691
|
locationId: zod.z.string().optional().describe("Filter by location ID"),
|
|
2692
|
+
lowStock: zod.z.boolean().optional().describe("Only items at or below their reorder point"),
|
|
2632
2693
|
limit: zod.z.number().int().optional().describe("Page size (default 50)"),
|
|
2633
2694
|
offset: zod.z.number().int().optional().describe("Pagination offset (default 0)")
|
|
2634
2695
|
}
|
|
2635
2696
|
},
|
|
2636
|
-
async ({ search,
|
|
2697
|
+
async ({ search, cargoItemId, warehouseId, locationId, lowStock, limit, offset }) => {
|
|
2637
2698
|
try {
|
|
2638
2699
|
const filter = {};
|
|
2639
2700
|
if (search !== void 0) filter.search = search;
|
|
2640
|
-
if (
|
|
2701
|
+
if (cargoItemId !== void 0) filter.cargoItemId = cargoItemId;
|
|
2641
2702
|
if (warehouseId !== void 0) filter.warehouseId = warehouseId;
|
|
2642
2703
|
if (locationId !== void 0) filter.locationId = locationId;
|
|
2704
|
+
if (lowStock !== void 0) filter.lowStock = lowStock;
|
|
2643
2705
|
const data = await ctx.gql.workspace.request(LIST_INVENTORY_ITEMS, {
|
|
2644
2706
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
2645
2707
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
@@ -2676,23 +2738,25 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2676
2738
|
track(mcpToolName(ctx.productName, "inventory_list_transactions")),
|
|
2677
2739
|
{
|
|
2678
2740
|
title: "List Inventory Transactions",
|
|
2679
|
-
description: "List inventory ledger transactions (receipts/issues/transfers/adjustments/returns) with optional
|
|
2741
|
+
description: "List inventory ledger transactions (receipts/issues/transfers/adjustments/returns) with optional cargo-item/warehouse/location/inventory-item/text filters.",
|
|
2680
2742
|
inputSchema: {
|
|
2681
2743
|
search: zod.z.string().optional().describe("Free-text search"),
|
|
2682
|
-
|
|
2744
|
+
cargoItemId: zod.z.string().optional().describe("Filter by cargo item ID"),
|
|
2683
2745
|
warehouseId: zod.z.string().optional().describe("Filter by warehouse ID"),
|
|
2684
2746
|
locationId: zod.z.string().optional().describe("Filter by location ID"),
|
|
2747
|
+
inventoryItemId: zod.z.string().optional().describe("Filter by inventory item ID"),
|
|
2685
2748
|
limit: zod.z.number().int().optional().describe("Page size (default 50)"),
|
|
2686
2749
|
offset: zod.z.number().int().optional().describe("Pagination offset (default 0)")
|
|
2687
2750
|
}
|
|
2688
2751
|
},
|
|
2689
|
-
async ({ search,
|
|
2752
|
+
async ({ search, cargoItemId, warehouseId, locationId, inventoryItemId, limit, offset }) => {
|
|
2690
2753
|
try {
|
|
2691
2754
|
const filter = {};
|
|
2692
2755
|
if (search !== void 0) filter.search = search;
|
|
2693
|
-
if (
|
|
2756
|
+
if (cargoItemId !== void 0) filter.cargoItemId = cargoItemId;
|
|
2694
2757
|
if (warehouseId !== void 0) filter.warehouseId = warehouseId;
|
|
2695
2758
|
if (locationId !== void 0) filter.locationId = locationId;
|
|
2759
|
+
if (inventoryItemId !== void 0) filter.inventoryItemId = inventoryItemId;
|
|
2696
2760
|
const data = await ctx.gql.workspace.request(LIST_INVENTORY_TRANSACTIONS, {
|
|
2697
2761
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
2698
2762
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
@@ -2712,22 +2776,22 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2712
2776
|
track(mcpToolName(ctx.productName, "inventory_create_item")),
|
|
2713
2777
|
{
|
|
2714
2778
|
title: "Create Inventory Item",
|
|
2715
|
-
description: "Create an inventory item for a
|
|
2779
|
+
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.",
|
|
2716
2780
|
inputSchema: {
|
|
2717
|
-
|
|
2781
|
+
cargoItemId: zod.z.string().min(1).describe("Cargo item ID"),
|
|
2718
2782
|
warehouseId: zod.z.string().min(1).describe("Warehouse ID"),
|
|
2719
2783
|
locationId: zod.z.string().optional().describe("Storage location ID"),
|
|
2720
|
-
onHand:
|
|
2721
|
-
available:
|
|
2722
|
-
allocated:
|
|
2723
|
-
damaged:
|
|
2724
|
-
reorderPoint:
|
|
2725
|
-
safetyStock:
|
|
2726
|
-
unitCost: zod.z.number().optional().describe("Unit cost")
|
|
2784
|
+
onHand: StockQuantity.optional().describe("On-hand quantity (default 0)"),
|
|
2785
|
+
available: StockQuantity.optional().describe("Available quantity (default 0)"),
|
|
2786
|
+
allocated: StockQuantity.optional().describe("Allocated quantity (default 0)"),
|
|
2787
|
+
damaged: StockQuantity.optional().describe("Damaged quantity (default 0)"),
|
|
2788
|
+
reorderPoint: StockQuantity.optional().describe("Reorder point"),
|
|
2789
|
+
safetyStock: StockQuantity.optional().describe("Safety stock"),
|
|
2790
|
+
unitCost: zod.z.number().nonnegative().optional().describe("Unit cost")
|
|
2727
2791
|
}
|
|
2728
2792
|
},
|
|
2729
2793
|
async ({
|
|
2730
|
-
|
|
2794
|
+
cargoItemId,
|
|
2731
2795
|
warehouseId,
|
|
2732
2796
|
locationId,
|
|
2733
2797
|
onHand,
|
|
@@ -2739,7 +2803,7 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2739
2803
|
unitCost
|
|
2740
2804
|
}) => {
|
|
2741
2805
|
try {
|
|
2742
|
-
const input = {
|
|
2806
|
+
const input = { cargoItemId, warehouseId };
|
|
2743
2807
|
if (locationId !== void 0) input.locationId = locationId;
|
|
2744
2808
|
if (onHand !== void 0) input.onHand = onHand;
|
|
2745
2809
|
if (available !== void 0) input.available = available;
|
|
@@ -2748,6 +2812,17 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2748
2812
|
if (reorderPoint !== void 0) input.reorderPoint = reorderPoint;
|
|
2749
2813
|
if (safetyStock !== void 0) input.safetyStock = safetyStock;
|
|
2750
2814
|
if (unitCost !== void 0) input.unitCost = unitCost;
|
|
2815
|
+
const counts = {
|
|
2816
|
+
onHand: onHand ?? 0,
|
|
2817
|
+
available: available ?? 0,
|
|
2818
|
+
allocated: allocated ?? 0,
|
|
2819
|
+
damaged: damaged ?? 0
|
|
2820
|
+
};
|
|
2821
|
+
if (counts.available + counts.allocated + counts.damaged !== counts.onHand) {
|
|
2822
|
+
return errorResult(
|
|
2823
|
+
`Stock counts do not balance: available (${counts.available}) + allocated (${counts.allocated}) + damaged (${counts.damaged}) must equal onHand (${counts.onHand}).`
|
|
2824
|
+
);
|
|
2825
|
+
}
|
|
2751
2826
|
const data = await ctx.gql.workspace.request(CREATE_INVENTORY_ITEM, { input });
|
|
2752
2827
|
return jsonResult(data.createInventoryItem);
|
|
2753
2828
|
} catch (error) {
|
|
@@ -2762,17 +2837,17 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2762
2837
|
track(mcpToolName(ctx.productName, "inventory_update_item")),
|
|
2763
2838
|
{
|
|
2764
2839
|
title: "Update Inventory Item",
|
|
2765
|
-
description: "Update an inventory item. At least one mutable field must be provided.",
|
|
2840
|
+
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.",
|
|
2766
2841
|
inputSchema: {
|
|
2767
2842
|
id: zod.z.string().describe("Inventory item ID"),
|
|
2768
2843
|
locationId: zod.z.string().optional().describe("Updated location ID"),
|
|
2769
|
-
onHand:
|
|
2770
|
-
available:
|
|
2771
|
-
allocated:
|
|
2772
|
-
damaged:
|
|
2773
|
-
reorderPoint:
|
|
2774
|
-
safetyStock:
|
|
2775
|
-
unitCost: zod.z.number().optional().describe("Updated unit cost")
|
|
2844
|
+
onHand: StockQuantity.optional().describe("Updated on-hand quantity"),
|
|
2845
|
+
available: StockQuantity.optional().describe("Updated available quantity"),
|
|
2846
|
+
allocated: StockQuantity.optional().describe("Updated allocated quantity"),
|
|
2847
|
+
damaged: StockQuantity.optional().describe("Updated damaged quantity"),
|
|
2848
|
+
reorderPoint: StockQuantity.optional().describe("Updated reorder point"),
|
|
2849
|
+
safetyStock: StockQuantity.optional().describe("Updated safety stock"),
|
|
2850
|
+
unitCost: zod.z.number().nonnegative().optional().describe("Updated unit cost")
|
|
2776
2851
|
}
|
|
2777
2852
|
},
|
|
2778
2853
|
async ({
|
|
@@ -2813,13 +2888,13 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2813
2888
|
track(mcpToolName(ctx.productName, "inventory_adjust_stock")),
|
|
2814
2889
|
{
|
|
2815
2890
|
title: "Adjust Inventory Stock",
|
|
2816
|
-
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.",
|
|
2891
|
+
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.",
|
|
2817
2892
|
inputSchema: {
|
|
2818
2893
|
id: zod.z.string().describe("Inventory item ID"),
|
|
2819
|
-
onHand:
|
|
2820
|
-
available:
|
|
2821
|
-
allocated:
|
|
2822
|
-
damaged:
|
|
2894
|
+
onHand: StockQuantity.optional().describe("New on-hand quantity"),
|
|
2895
|
+
available: StockQuantity.optional().describe("New available quantity"),
|
|
2896
|
+
allocated: StockQuantity.optional().describe("New allocated quantity"),
|
|
2897
|
+
damaged: StockQuantity.optional().describe("New damaged quantity")
|
|
2823
2898
|
}
|
|
2824
2899
|
},
|
|
2825
2900
|
async ({ id, onHand, available, allocated, damaged }) => {
|
|
@@ -2844,20 +2919,50 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2844
2919
|
}
|
|
2845
2920
|
}
|
|
2846
2921
|
);
|
|
2922
|
+
server.registerTool(
|
|
2923
|
+
track(mcpToolName(ctx.productName, "inventory_transfer_stock")),
|
|
2924
|
+
{
|
|
2925
|
+
title: "Transfer Inventory Stock",
|
|
2926
|
+
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.",
|
|
2927
|
+
inputSchema: {
|
|
2928
|
+
sourceInventoryItemId: zod.z.string().min(1).describe("Inventory item to take stock from"),
|
|
2929
|
+
destinationInventoryItemId: zod.z.string().min(1).describe("Inventory item to add stock to"),
|
|
2930
|
+
quantity: zod.z.number().int().min(1).max(2147483647).describe("Units to move (taken from the source available count)")
|
|
2931
|
+
}
|
|
2932
|
+
},
|
|
2933
|
+
async ({ sourceInventoryItemId, destinationInventoryItemId, quantity }) => {
|
|
2934
|
+
if (sourceInventoryItemId === destinationInventoryItemId) {
|
|
2935
|
+
return errorResult("Source and destination inventory items must be different.");
|
|
2936
|
+
}
|
|
2937
|
+
try {
|
|
2938
|
+
const data = await ctx.gql.workspace.request(TRANSFER_INVENTORY_STOCK, {
|
|
2939
|
+
input: { sourceInventoryItemId, destinationInventoryItemId, quantity }
|
|
2940
|
+
});
|
|
2941
|
+
return jsonResult(data.transferInventoryStock);
|
|
2942
|
+
} catch (error) {
|
|
2943
|
+
ctx.logger.error("movethewheels inventory_transfer_stock failed", {
|
|
2944
|
+
error: String(error)
|
|
2945
|
+
});
|
|
2946
|
+
return errorResult(
|
|
2947
|
+
`Failed to transfer inventory stock: ${error instanceof Error ? error.message : String(error)}`
|
|
2948
|
+
);
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
);
|
|
2847
2952
|
server.registerTool(
|
|
2848
2953
|
track(mcpToolName(ctx.productName, "inventory_create_transaction")),
|
|
2849
2954
|
{
|
|
2850
2955
|
title: "Create Inventory Transaction",
|
|
2851
|
-
description: "Record an inventory ledger transaction (RECEIPT/ISSUE/TRANSFER/ADJUSTMENT/RETURN). `transactionNumber`, `type`, `
|
|
2956
|
+
description: "Record an inventory ledger transaction (RECEIPT/ISSUE/TRANSFER/ADJUSTMENT/RETURN). `transactionNumber`, `type`, `cargoItemId`, `warehouseId`, and `quantity` are required.",
|
|
2852
2957
|
inputSchema: {
|
|
2853
2958
|
transactionNumber: zod.z.string().min(1).describe("Transaction number (unique)"),
|
|
2854
2959
|
type: InventoryTransactionTypeEnum.describe("Transaction type"),
|
|
2855
|
-
|
|
2960
|
+
cargoItemId: zod.z.string().min(1).describe("Cargo item ID"),
|
|
2856
2961
|
warehouseId: zod.z.string().min(1).describe("Warehouse ID"),
|
|
2857
2962
|
quantity: zod.z.number().int().describe("Quantity moved (sign per transaction semantics)"),
|
|
2858
2963
|
inventoryItemId: zod.z.string().optional().describe("Affected inventory item ID"),
|
|
2859
|
-
unitCost: zod.z.number().optional().describe("Unit cost"),
|
|
2860
|
-
referenceType: zod.z.string().optional().describe('Reference type, e.g. "
|
|
2964
|
+
unitCost: zod.z.number().nonnegative().optional().describe("Unit cost"),
|
|
2965
|
+
referenceType: zod.z.string().optional().describe('Reference type, e.g. "delivery_job", "shipment"'),
|
|
2861
2966
|
referenceId: zod.z.string().optional().describe("Reference ID"),
|
|
2862
2967
|
notes: zod.z.string().optional().describe("Notes")
|
|
2863
2968
|
}
|
|
@@ -2865,7 +2970,7 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2865
2970
|
async ({
|
|
2866
2971
|
transactionNumber,
|
|
2867
2972
|
type,
|
|
2868
|
-
|
|
2973
|
+
cargoItemId,
|
|
2869
2974
|
warehouseId,
|
|
2870
2975
|
quantity,
|
|
2871
2976
|
inventoryItemId,
|
|
@@ -2878,7 +2983,7 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2878
2983
|
const input = {
|
|
2879
2984
|
transactionNumber,
|
|
2880
2985
|
type,
|
|
2881
|
-
|
|
2986
|
+
cargoItemId,
|
|
2882
2987
|
warehouseId,
|
|
2883
2988
|
quantity
|
|
2884
2989
|
};
|
|
@@ -2922,12 +3027,28 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2922
3027
|
}
|
|
2923
3028
|
);
|
|
2924
3029
|
}
|
|
3030
|
+
var Rating = zod.z.number().min(0).max(5);
|
|
3031
|
+
var Tags = zod.z.array(zod.z.string().min(1));
|
|
3032
|
+
var Currency = zod.z.string().regex(/^[A-Za-z]{3}$/).describe('ISO 4217 currency code, e.g. "INR" or "USD"');
|
|
3033
|
+
function definedOnly(source) {
|
|
3034
|
+
const out = {};
|
|
3035
|
+
for (const [key, value] of Object.entries(source)) {
|
|
3036
|
+
if (value !== void 0) out[key] = value;
|
|
3037
|
+
}
|
|
3038
|
+
return out;
|
|
3039
|
+
}
|
|
3040
|
+
function failure(ctx, tool, action, error) {
|
|
3041
|
+
ctx.logger.error(`movethewheels ${tool} failed`, { error: String(error) });
|
|
3042
|
+
return errorResult(
|
|
3043
|
+
`Failed to ${action}: ${error instanceof Error ? error.message : String(error)}`
|
|
3044
|
+
);
|
|
3045
|
+
}
|
|
2925
3046
|
function registerMarketplaceTools(server, ctx, track) {
|
|
2926
3047
|
server.registerTool(
|
|
2927
3048
|
track(mcpToolName(ctx.productName, "marketplace_get_provider")),
|
|
2928
3049
|
{
|
|
2929
3050
|
title: "Get Service Provider",
|
|
2930
|
-
description: "Fetch a single
|
|
3051
|
+
description: "Fetch a single marketplace service provider by ID, including its offerings.",
|
|
2931
3052
|
inputSchema: { id: zod.z.string().describe("Service provider ID") }
|
|
2932
3053
|
},
|
|
2933
3054
|
async ({ id }) => {
|
|
@@ -2936,10 +3057,7 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
2936
3057
|
if (!data.serviceProvider) return errorResult(`Service provider ${id} not found`);
|
|
2937
3058
|
return jsonResult(data.serviceProvider);
|
|
2938
3059
|
} catch (error) {
|
|
2939
|
-
ctx
|
|
2940
|
-
return errorResult(
|
|
2941
|
-
`Failed to get service provider: ${error instanceof Error ? error.message : String(error)}`
|
|
2942
|
-
);
|
|
3060
|
+
return failure(ctx, "marketplace_get_provider", "get service provider", error);
|
|
2943
3061
|
}
|
|
2944
3062
|
}
|
|
2945
3063
|
);
|
|
@@ -2947,33 +3065,27 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
2947
3065
|
track(mcpToolName(ctx.productName, "marketplace_list_providers")),
|
|
2948
3066
|
{
|
|
2949
3067
|
title: "List Service Providers",
|
|
2950
|
-
description: "List
|
|
3068
|
+
description: "List marketplace service providers with optional type/verified/active/rating/text filters and pagination.",
|
|
2951
3069
|
inputSchema: {
|
|
2952
|
-
search: zod.z.string().optional().describe("
|
|
2953
|
-
type:
|
|
3070
|
+
search: zod.z.string().optional().describe("Case-insensitive match on name, description, services and service areas"),
|
|
3071
|
+
type: ServiceProviderTypeEnum.optional(),
|
|
3072
|
+
isVerified: zod.z.boolean().optional().describe("Only verified (or unverified) providers"),
|
|
2954
3073
|
isActive: zod.z.boolean().optional().describe("Filter by active flag"),
|
|
2955
|
-
|
|
2956
|
-
|
|
3074
|
+
minRating: Rating.optional().describe("Only providers rated at least this (0-5)"),
|
|
3075
|
+
limit: zod.z.number().int().positive().optional().describe("Page size (default 50)"),
|
|
3076
|
+
offset: zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
|
|
2957
3077
|
}
|
|
2958
3078
|
},
|
|
2959
|
-
async ({ search, type, isActive, limit, offset }) => {
|
|
3079
|
+
async ({ search, type, isVerified, isActive, minRating, limit, offset }) => {
|
|
2960
3080
|
try {
|
|
2961
|
-
const filter = {};
|
|
2962
|
-
if (search !== void 0) filter.search = search;
|
|
2963
|
-
if (type !== void 0) filter.type = type;
|
|
2964
|
-
if (isActive !== void 0) filter.isActive = isActive;
|
|
3081
|
+
const filter = definedOnly({ search, type, isVerified, isActive, minRating });
|
|
2965
3082
|
const data = await ctx.gql.workspace.request(LIST_SERVICE_PROVIDERS, {
|
|
2966
3083
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
2967
3084
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
2968
3085
|
});
|
|
2969
3086
|
return jsonResult(data.serviceProviders);
|
|
2970
3087
|
} catch (error) {
|
|
2971
|
-
ctx
|
|
2972
|
-
error: String(error)
|
|
2973
|
-
});
|
|
2974
|
-
return errorResult(
|
|
2975
|
-
`Failed to list service providers: ${error instanceof Error ? error.message : String(error)}`
|
|
2976
|
-
);
|
|
3088
|
+
return failure(ctx, "marketplace_list_providers", "list service providers", error);
|
|
2977
3089
|
}
|
|
2978
3090
|
}
|
|
2979
3091
|
);
|
|
@@ -2981,36 +3093,27 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
2981
3093
|
track(mcpToolName(ctx.productName, "marketplace_create_provider")),
|
|
2982
3094
|
{
|
|
2983
3095
|
title: "Create Service Provider",
|
|
2984
|
-
description: "
|
|
3096
|
+
description: "Add a service provider to the workspace marketplace directory. `name` and `type` are required; `isActive` defaults to true, `isVerified` to false.",
|
|
2985
3097
|
inputSchema: {
|
|
2986
3098
|
name: zod.z.string().min(1).describe("Provider name"),
|
|
2987
|
-
type:
|
|
3099
|
+
type: ServiceProviderTypeEnum,
|
|
2988
3100
|
description: zod.z.string().optional().describe("Description"),
|
|
2989
|
-
|
|
3101
|
+
rating: Rating.optional().describe("The workspace's own rating, 0-5"),
|
|
3102
|
+
contactInfo: JsonObject.optional().describe(
|
|
3103
|
+
"Contact details, e.g. { contactName, email, phone, website }"
|
|
3104
|
+
),
|
|
3105
|
+
services: Tags.optional().describe('Short service tags, e.g. ["reefer", "hazmat"]'),
|
|
3106
|
+
serviceAreas: Tags.optional().describe("Regions, lanes or cities covered"),
|
|
2990
3107
|
isVerified: zod.z.boolean().optional().describe("Verified flag (default false)"),
|
|
2991
|
-
|
|
2992
|
-
services: JsonObject.optional().describe("Services JSON"),
|
|
2993
|
-
contactInfo: JsonObject.optional().describe("Contact info JSON")
|
|
3108
|
+
isActive: zod.z.boolean().optional().describe("Active flag (default true)")
|
|
2994
3109
|
}
|
|
2995
3110
|
},
|
|
2996
|
-
async (
|
|
3111
|
+
async (args) => {
|
|
2997
3112
|
try {
|
|
2998
|
-
const
|
|
2999
|
-
if (description !== void 0) input.description = description;
|
|
3000
|
-
if (isActive !== void 0) input.isActive = isActive;
|
|
3001
|
-
if (isVerified !== void 0) input.isVerified = isVerified;
|
|
3002
|
-
if (rating !== void 0) input.rating = rating;
|
|
3003
|
-
if (services !== void 0) input.services = services;
|
|
3004
|
-
if (contactInfo !== void 0) input.contactInfo = contactInfo;
|
|
3005
|
-
const data = await ctx.gql.workspace.request(CREATE_SERVICE_PROVIDER, { input });
|
|
3113
|
+
const data = await ctx.gql.workspace.request(CREATE_SERVICE_PROVIDER, { input: definedOnly(args) });
|
|
3006
3114
|
return jsonResult(data.createServiceProvider);
|
|
3007
3115
|
} catch (error) {
|
|
3008
|
-
ctx
|
|
3009
|
-
error: String(error)
|
|
3010
|
-
});
|
|
3011
|
-
return errorResult(
|
|
3012
|
-
`Failed to create service provider: ${error instanceof Error ? error.message : String(error)}`
|
|
3013
|
-
);
|
|
3116
|
+
return failure(ctx, "marketplace_create_provider", "create service provider", error);
|
|
3014
3117
|
}
|
|
3015
3118
|
}
|
|
3016
3119
|
);
|
|
@@ -3021,49 +3124,27 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3021
3124
|
description: "Update a service provider. At least one mutable field must be provided.",
|
|
3022
3125
|
inputSchema: {
|
|
3023
3126
|
id: zod.z.string().describe("Service provider ID"),
|
|
3024
|
-
name: zod.z.string().optional().describe("Updated name"),
|
|
3025
|
-
type:
|
|
3127
|
+
name: zod.z.string().min(1).optional().describe("Updated name"),
|
|
3128
|
+
type: ServiceProviderTypeEnum.optional(),
|
|
3026
3129
|
description: zod.z.string().optional().describe("Updated description"),
|
|
3027
|
-
|
|
3130
|
+
rating: Rating.optional().describe("Updated rating, 0-5"),
|
|
3131
|
+
contactInfo: JsonObject.optional().describe("Updated contact details"),
|
|
3132
|
+
services: Tags.optional().describe("Replacement service tags"),
|
|
3133
|
+
serviceAreas: Tags.optional().describe("Replacement service areas"),
|
|
3028
3134
|
isVerified: zod.z.boolean().optional().describe("Updated verified flag"),
|
|
3029
|
-
|
|
3030
|
-
services: JsonObject.optional().describe("Updated services JSON"),
|
|
3031
|
-
contactInfo: JsonObject.optional().describe("Updated contact info JSON")
|
|
3135
|
+
isActive: zod.z.boolean().optional().describe("Updated active flag")
|
|
3032
3136
|
}
|
|
3033
3137
|
},
|
|
3034
|
-
async ({
|
|
3035
|
-
id,
|
|
3036
|
-
name,
|
|
3037
|
-
type,
|
|
3038
|
-
description,
|
|
3039
|
-
isActive,
|
|
3040
|
-
isVerified,
|
|
3041
|
-
rating,
|
|
3042
|
-
services,
|
|
3043
|
-
contactInfo
|
|
3044
|
-
}) => {
|
|
3138
|
+
async ({ id, ...rest }) => {
|
|
3045
3139
|
try {
|
|
3046
|
-
const input =
|
|
3047
|
-
if (name !== void 0) input.name = name;
|
|
3048
|
-
if (type !== void 0) input.type = type;
|
|
3049
|
-
if (description !== void 0) input.description = description;
|
|
3050
|
-
if (isActive !== void 0) input.isActive = isActive;
|
|
3051
|
-
if (isVerified !== void 0) input.isVerified = isVerified;
|
|
3052
|
-
if (rating !== void 0) input.rating = rating;
|
|
3053
|
-
if (services !== void 0) input.services = services;
|
|
3054
|
-
if (contactInfo !== void 0) input.contactInfo = contactInfo;
|
|
3140
|
+
const input = definedOnly(rest);
|
|
3055
3141
|
if (Object.keys(input).length === 0) {
|
|
3056
3142
|
return errorResult("No updates specified \u2014 provide at least one mutable field.");
|
|
3057
3143
|
}
|
|
3058
3144
|
const data = await ctx.gql.workspace.request(UPDATE_SERVICE_PROVIDER, { id, input });
|
|
3059
3145
|
return jsonResult(data.updateServiceProvider);
|
|
3060
3146
|
} catch (error) {
|
|
3061
|
-
ctx
|
|
3062
|
-
error: String(error)
|
|
3063
|
-
});
|
|
3064
|
-
return errorResult(
|
|
3065
|
-
`Failed to update service provider: ${error instanceof Error ? error.message : String(error)}`
|
|
3066
|
-
);
|
|
3147
|
+
return failure(ctx, "marketplace_update_provider", "update service provider", error);
|
|
3067
3148
|
}
|
|
3068
3149
|
}
|
|
3069
3150
|
);
|
|
@@ -3071,7 +3152,7 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3071
3152
|
track(mcpToolName(ctx.productName, "marketplace_delete_provider")),
|
|
3072
3153
|
{
|
|
3073
3154
|
title: "Delete Service Provider",
|
|
3074
|
-
description: "Soft-delete a service provider
|
|
3155
|
+
description: "Soft-delete a service provider and its offerings. Shipments that already use it as carrier keep the reference.",
|
|
3075
3156
|
inputSchema: { id: zod.z.string().describe("Service provider ID") }
|
|
3076
3157
|
},
|
|
3077
3158
|
async ({ id }) => {
|
|
@@ -3082,12 +3163,7 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3082
3163
|
);
|
|
3083
3164
|
return jsonResult({ deleted: data.deleteServiceProvider, id });
|
|
3084
3165
|
} catch (error) {
|
|
3085
|
-
ctx
|
|
3086
|
-
error: String(error)
|
|
3087
|
-
});
|
|
3088
|
-
return errorResult(
|
|
3089
|
-
`Failed to delete service provider: ${error instanceof Error ? error.message : String(error)}`
|
|
3090
|
-
);
|
|
3166
|
+
return failure(ctx, "marketplace_delete_provider", "delete service provider", error);
|
|
3091
3167
|
}
|
|
3092
3168
|
}
|
|
3093
3169
|
);
|
|
@@ -3104,10 +3180,7 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3104
3180
|
if (!data.serviceOffering) return errorResult(`Service offering ${id} not found`);
|
|
3105
3181
|
return jsonResult(data.serviceOffering);
|
|
3106
3182
|
} catch (error) {
|
|
3107
|
-
ctx
|
|
3108
|
-
return errorResult(
|
|
3109
|
-
`Failed to get service offering: ${error instanceof Error ? error.message : String(error)}`
|
|
3110
|
-
);
|
|
3183
|
+
return failure(ctx, "marketplace_get_offering", "get service offering", error);
|
|
3111
3184
|
}
|
|
3112
3185
|
}
|
|
3113
3186
|
);
|
|
@@ -3115,33 +3188,28 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3115
3188
|
track(mcpToolName(ctx.productName, "marketplace_list_offerings")),
|
|
3116
3189
|
{
|
|
3117
3190
|
title: "List Service Offerings",
|
|
3118
|
-
description: "List service offerings with optional provider/category/text filters and pagination.",
|
|
3191
|
+
description: "List service offerings with optional provider/category/availability/price/text filters and pagination.",
|
|
3119
3192
|
inputSchema: {
|
|
3120
|
-
search: zod.z.string().optional().describe("
|
|
3193
|
+
search: zod.z.string().optional().describe("Case-insensitive match on name and description"),
|
|
3121
3194
|
providerId: zod.z.string().optional().describe("Filter by provider ID"),
|
|
3122
|
-
category:
|
|
3123
|
-
|
|
3124
|
-
|
|
3195
|
+
category: ServiceOfferingCategoryEnum.optional(),
|
|
3196
|
+
availability: ServiceAvailabilityEnum.optional(),
|
|
3197
|
+
isActive: zod.z.boolean().optional().describe("Filter by active flag"),
|
|
3198
|
+
maxPrice: zod.z.number().min(0).optional().describe("Only offerings at or below this price"),
|
|
3199
|
+
limit: zod.z.number().int().positive().optional().describe("Page size (default 50)"),
|
|
3200
|
+
offset: zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
|
|
3125
3201
|
}
|
|
3126
3202
|
},
|
|
3127
|
-
async ({
|
|
3203
|
+
async ({ limit, offset, ...rest }) => {
|
|
3128
3204
|
try {
|
|
3129
|
-
const filter =
|
|
3130
|
-
if (search !== void 0) filter.search = search;
|
|
3131
|
-
if (providerId !== void 0) filter.providerId = providerId;
|
|
3132
|
-
if (category !== void 0) filter.category = category;
|
|
3205
|
+
const filter = definedOnly(rest);
|
|
3133
3206
|
const data = await ctx.gql.workspace.request(LIST_SERVICE_OFFERINGS, {
|
|
3134
3207
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
3135
3208
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
3136
3209
|
});
|
|
3137
3210
|
return jsonResult(data.serviceOfferings);
|
|
3138
3211
|
} catch (error) {
|
|
3139
|
-
ctx
|
|
3140
|
-
error: String(error)
|
|
3141
|
-
});
|
|
3142
|
-
return errorResult(
|
|
3143
|
-
`Failed to list service offerings: ${error instanceof Error ? error.message : String(error)}`
|
|
3144
|
-
);
|
|
3212
|
+
return failure(ctx, "marketplace_list_offerings", "list service offerings", error);
|
|
3145
3213
|
}
|
|
3146
3214
|
}
|
|
3147
3215
|
);
|
|
@@ -3149,33 +3217,26 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3149
3217
|
track(mcpToolName(ctx.productName, "marketplace_create_offering")),
|
|
3150
3218
|
{
|
|
3151
3219
|
title: "Create Service Offering",
|
|
3152
|
-
description: '
|
|
3220
|
+
description: 'Publish a service offering for a provider. `providerId`, `name` and `category` are required; omit `price` when priced on request. `currency` defaults to "USD", `availability` to AVAILABLE.',
|
|
3153
3221
|
inputSchema: {
|
|
3154
|
-
name: zod.z.string().min(1).describe("Offering name"),
|
|
3155
|
-
price: zod.z.number().describe("Price"),
|
|
3156
3222
|
providerId: zod.z.string().min(1).describe("Owning provider ID"),
|
|
3157
|
-
|
|
3223
|
+
name: zod.z.string().min(1).describe("Offering name"),
|
|
3224
|
+
category: ServiceOfferingCategoryEnum,
|
|
3158
3225
|
description: zod.z.string().optional().describe("Description"),
|
|
3159
|
-
|
|
3160
|
-
|
|
3226
|
+
price: zod.z.number().min(0).optional().describe("Indicative price in `currency`"),
|
|
3227
|
+
currency: Currency.optional(),
|
|
3228
|
+
pricingUnit: zod.z.string().optional().describe('What the price is charged per, e.g. "per km" or "per pallet"'),
|
|
3229
|
+
transitDays: zod.z.number().int().min(0).optional().describe("Typical transit time in days"),
|
|
3230
|
+
availability: ServiceAvailabilityEnum.optional(),
|
|
3231
|
+
isActive: zod.z.boolean().optional().describe("Active flag (default true)")
|
|
3161
3232
|
}
|
|
3162
3233
|
},
|
|
3163
|
-
async (
|
|
3234
|
+
async (args) => {
|
|
3164
3235
|
try {
|
|
3165
|
-
const
|
|
3166
|
-
if (category !== void 0) input.category = category;
|
|
3167
|
-
if (description !== void 0) input.description = description;
|
|
3168
|
-
if (currency !== void 0) input.currency = currency;
|
|
3169
|
-
if (availability !== void 0) input.availability = availability;
|
|
3170
|
-
const data = await ctx.gql.workspace.request(CREATE_SERVICE_OFFERING, { input });
|
|
3236
|
+
const data = await ctx.gql.workspace.request(CREATE_SERVICE_OFFERING, { input: definedOnly(args) });
|
|
3171
3237
|
return jsonResult(data.createServiceOffering);
|
|
3172
3238
|
} catch (error) {
|
|
3173
|
-
ctx
|
|
3174
|
-
error: String(error)
|
|
3175
|
-
});
|
|
3176
|
-
return errorResult(
|
|
3177
|
-
`Failed to create service offering: ${error instanceof Error ? error.message : String(error)}`
|
|
3178
|
-
);
|
|
3239
|
+
return failure(ctx, "marketplace_create_offering", "create service offering", error);
|
|
3179
3240
|
}
|
|
3180
3241
|
}
|
|
3181
3242
|
);
|
|
@@ -3186,37 +3247,27 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3186
3247
|
description: "Update a service offering. At least one mutable field must be provided.",
|
|
3187
3248
|
inputSchema: {
|
|
3188
3249
|
id: zod.z.string().describe("Service offering ID"),
|
|
3189
|
-
name: zod.z.string().optional().describe("Updated name"),
|
|
3190
|
-
|
|
3191
|
-
providerId: zod.z.string().optional().describe("Updated provider ID"),
|
|
3192
|
-
category: zod.z.string().optional().describe("Updated category"),
|
|
3250
|
+
name: zod.z.string().min(1).optional().describe("Updated name"),
|
|
3251
|
+
category: ServiceOfferingCategoryEnum.optional(),
|
|
3193
3252
|
description: zod.z.string().optional().describe("Updated description"),
|
|
3194
|
-
|
|
3195
|
-
|
|
3253
|
+
price: zod.z.number().min(0).optional().describe("Updated price"),
|
|
3254
|
+
currency: Currency.optional(),
|
|
3255
|
+
pricingUnit: zod.z.string().optional().describe("Updated pricing unit"),
|
|
3256
|
+
transitDays: zod.z.number().int().min(0).optional().describe("Updated transit days"),
|
|
3257
|
+
availability: ServiceAvailabilityEnum.optional(),
|
|
3258
|
+
isActive: zod.z.boolean().optional().describe("Updated active flag")
|
|
3196
3259
|
}
|
|
3197
3260
|
},
|
|
3198
|
-
async ({ id,
|
|
3261
|
+
async ({ id, ...rest }) => {
|
|
3199
3262
|
try {
|
|
3200
|
-
const input =
|
|
3201
|
-
if (name !== void 0) input.name = name;
|
|
3202
|
-
if (price !== void 0) input.price = price;
|
|
3203
|
-
if (providerId !== void 0) input.providerId = providerId;
|
|
3204
|
-
if (category !== void 0) input.category = category;
|
|
3205
|
-
if (description !== void 0) input.description = description;
|
|
3206
|
-
if (currency !== void 0) input.currency = currency;
|
|
3207
|
-
if (availability !== void 0) input.availability = availability;
|
|
3263
|
+
const input = definedOnly(rest);
|
|
3208
3264
|
if (Object.keys(input).length === 0) {
|
|
3209
3265
|
return errorResult("No updates specified \u2014 provide at least one mutable field.");
|
|
3210
3266
|
}
|
|
3211
3267
|
const data = await ctx.gql.workspace.request(UPDATE_SERVICE_OFFERING, { id, input });
|
|
3212
3268
|
return jsonResult(data.updateServiceOffering);
|
|
3213
3269
|
} catch (error) {
|
|
3214
|
-
ctx
|
|
3215
|
-
error: String(error)
|
|
3216
|
-
});
|
|
3217
|
-
return errorResult(
|
|
3218
|
-
`Failed to update service offering: ${error instanceof Error ? error.message : String(error)}`
|
|
3219
|
-
);
|
|
3270
|
+
return failure(ctx, "marketplace_update_offering", "update service offering", error);
|
|
3220
3271
|
}
|
|
3221
3272
|
}
|
|
3222
3273
|
);
|
|
@@ -3235,266 +3286,42 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3235
3286
|
);
|
|
3236
3287
|
return jsonResult({ deleted: data.deleteServiceOffering, id });
|
|
3237
3288
|
} catch (error) {
|
|
3238
|
-
ctx
|
|
3239
|
-
error: String(error)
|
|
3240
|
-
});
|
|
3241
|
-
return errorResult(
|
|
3242
|
-
`Failed to delete service offering: ${error instanceof Error ? error.message : String(error)}`
|
|
3243
|
-
);
|
|
3244
|
-
}
|
|
3245
|
-
}
|
|
3246
|
-
);
|
|
3247
|
-
}
|
|
3248
|
-
function registerReportTools(server, ctx, track) {
|
|
3249
|
-
server.registerTool(
|
|
3250
|
-
track(mcpToolName(ctx.productName, "reports_get")),
|
|
3251
|
-
{
|
|
3252
|
-
title: "Get Report",
|
|
3253
|
-
description: "Fetch a single report definition by ID.",
|
|
3254
|
-
inputSchema: { id: zod.z.string().describe("Report ID") }
|
|
3255
|
-
},
|
|
3256
|
-
async ({ id }) => {
|
|
3257
|
-
try {
|
|
3258
|
-
const data = await ctx.gql.workspace.request(GET_REPORT, { id });
|
|
3259
|
-
if (!data.movethewheelsReport) return errorResult(`Report ${id} not found`);
|
|
3260
|
-
return jsonResult(data.movethewheelsReport);
|
|
3261
|
-
} catch (error) {
|
|
3262
|
-
ctx.logger.error("movethewheels reports_get failed", { error: String(error) });
|
|
3263
|
-
return errorResult(
|
|
3264
|
-
`Failed to get report: ${error instanceof Error ? error.message : String(error)}`
|
|
3265
|
-
);
|
|
3266
|
-
}
|
|
3267
|
-
}
|
|
3268
|
-
);
|
|
3269
|
-
server.registerTool(
|
|
3270
|
-
track(mcpToolName(ctx.productName, "reports_list")),
|
|
3271
|
-
{
|
|
3272
|
-
title: "List Reports",
|
|
3273
|
-
description: "List report definitions with optional type/status/text filters and pagination.",
|
|
3274
|
-
inputSchema: {
|
|
3275
|
-
search: zod.z.string().optional().describe("Free-text search across name"),
|
|
3276
|
-
type: zod.z.string().optional().describe("Filter by report type"),
|
|
3277
|
-
status: zod.z.string().optional().describe('Filter by status, e.g. "DRAFT", "ACTIVE"'),
|
|
3278
|
-
limit: zod.z.number().int().optional().describe("Page size (default 50)"),
|
|
3279
|
-
offset: zod.z.number().int().optional().describe("Pagination offset (default 0)")
|
|
3280
|
-
}
|
|
3281
|
-
},
|
|
3282
|
-
async ({ search, type, status, limit, offset }) => {
|
|
3283
|
-
try {
|
|
3284
|
-
const filter = {};
|
|
3285
|
-
if (search !== void 0) filter.search = search;
|
|
3286
|
-
if (type !== void 0) filter.type = type;
|
|
3287
|
-
if (status !== void 0) filter.status = status;
|
|
3288
|
-
const data = await ctx.gql.workspace.request(LIST_REPORTS, {
|
|
3289
|
-
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
3290
|
-
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
3291
|
-
});
|
|
3292
|
-
return jsonResult(data.movethewheelsReports);
|
|
3293
|
-
} catch (error) {
|
|
3294
|
-
ctx.logger.error("movethewheels reports_list failed", { error: String(error) });
|
|
3295
|
-
return errorResult(
|
|
3296
|
-
`Failed to list reports: ${error instanceof Error ? error.message : String(error)}`
|
|
3297
|
-
);
|
|
3298
|
-
}
|
|
3299
|
-
}
|
|
3300
|
-
);
|
|
3301
|
-
server.registerTool(
|
|
3302
|
-
track(mcpToolName(ctx.productName, "reports_create")),
|
|
3303
|
-
{
|
|
3304
|
-
title: "Create Report",
|
|
3305
|
-
description: 'Create a report definition. `name` and `type` are required; `status` defaults to "DRAFT".',
|
|
3306
|
-
inputSchema: {
|
|
3307
|
-
name: zod.z.string().min(1).describe("Report name"),
|
|
3308
|
-
type: zod.z.string().min(1).describe("Report type"),
|
|
3309
|
-
status: zod.z.string().optional().describe('Status (default "DRAFT")'),
|
|
3310
|
-
description: zod.z.string().optional().describe("Description"),
|
|
3311
|
-
configuration: JsonObject.optional().describe("Report configuration JSON"),
|
|
3312
|
-
schedule: zod.z.string().optional().describe("Schedule (e.g. cron string)")
|
|
3313
|
-
}
|
|
3314
|
-
},
|
|
3315
|
-
async ({ name, type, status, description, configuration, schedule }) => {
|
|
3316
|
-
try {
|
|
3317
|
-
const input = { name, type };
|
|
3318
|
-
if (status !== void 0) input.status = status;
|
|
3319
|
-
if (description !== void 0) input.description = description;
|
|
3320
|
-
if (configuration !== void 0) input.configuration = configuration;
|
|
3321
|
-
if (schedule !== void 0) input.schedule = schedule;
|
|
3322
|
-
const data = await ctx.gql.workspace.request(CREATE_REPORT, { input });
|
|
3323
|
-
return jsonResult(data.createMovethewheelsReport);
|
|
3324
|
-
} catch (error) {
|
|
3325
|
-
ctx.logger.error("movethewheels reports_create failed", { error: String(error) });
|
|
3326
|
-
return errorResult(
|
|
3327
|
-
`Failed to create report: ${error instanceof Error ? error.message : String(error)}`
|
|
3328
|
-
);
|
|
3329
|
-
}
|
|
3330
|
-
}
|
|
3331
|
-
);
|
|
3332
|
-
server.registerTool(
|
|
3333
|
-
track(mcpToolName(ctx.productName, "reports_update")),
|
|
3334
|
-
{
|
|
3335
|
-
title: "Update Report",
|
|
3336
|
-
description: "Update a report definition. At least one mutable field must be provided.",
|
|
3337
|
-
inputSchema: {
|
|
3338
|
-
id: zod.z.string().describe("Report ID"),
|
|
3339
|
-
name: zod.z.string().optional().describe("Updated name"),
|
|
3340
|
-
type: zod.z.string().optional().describe("Updated type"),
|
|
3341
|
-
status: zod.z.string().optional().describe("Updated status"),
|
|
3342
|
-
description: zod.z.string().optional().describe("Updated description"),
|
|
3343
|
-
configuration: JsonObject.optional().describe("Updated configuration JSON"),
|
|
3344
|
-
schedule: zod.z.string().optional().describe("Updated schedule")
|
|
3345
|
-
}
|
|
3346
|
-
},
|
|
3347
|
-
async ({ id, name, type, status, description, configuration, schedule }) => {
|
|
3348
|
-
try {
|
|
3349
|
-
const input = {};
|
|
3350
|
-
if (name !== void 0) input.name = name;
|
|
3351
|
-
if (type !== void 0) input.type = type;
|
|
3352
|
-
if (status !== void 0) input.status = status;
|
|
3353
|
-
if (description !== void 0) input.description = description;
|
|
3354
|
-
if (configuration !== void 0) input.configuration = configuration;
|
|
3355
|
-
if (schedule !== void 0) input.schedule = schedule;
|
|
3356
|
-
if (Object.keys(input).length === 0) {
|
|
3357
|
-
return errorResult("No updates specified \u2014 provide at least one mutable field.");
|
|
3358
|
-
}
|
|
3359
|
-
const data = await ctx.gql.workspace.request(UPDATE_REPORT, { id, input });
|
|
3360
|
-
return jsonResult(data.updateMovethewheelsReport);
|
|
3361
|
-
} catch (error) {
|
|
3362
|
-
ctx.logger.error("movethewheels reports_update failed", { error: String(error) });
|
|
3363
|
-
return errorResult(
|
|
3364
|
-
`Failed to update report: ${error instanceof Error ? error.message : String(error)}`
|
|
3365
|
-
);
|
|
3366
|
-
}
|
|
3367
|
-
}
|
|
3368
|
-
);
|
|
3369
|
-
server.registerTool(
|
|
3370
|
-
track(mcpToolName(ctx.productName, "reports_generate")),
|
|
3371
|
-
{
|
|
3372
|
-
title: "Generate Report",
|
|
3373
|
-
description: "Run a report definition and return the generated result payload.",
|
|
3374
|
-
inputSchema: {
|
|
3375
|
-
reportId: zod.z.string().describe("Report ID to generate"),
|
|
3376
|
-
parameters: JsonObject.optional().describe("Runtime parameters JSON")
|
|
3377
|
-
}
|
|
3378
|
-
},
|
|
3379
|
-
async ({ reportId, parameters }) => {
|
|
3380
|
-
try {
|
|
3381
|
-
const input = { reportId };
|
|
3382
|
-
if (parameters !== void 0) input.parameters = parameters;
|
|
3383
|
-
const data = await ctx.gql.workspace.request(GENERATE_REPORT, { input });
|
|
3384
|
-
return jsonResult(data.generateMovethewheelsReport);
|
|
3385
|
-
} catch (error) {
|
|
3386
|
-
ctx.logger.error("movethewheels reports_generate failed", { error: String(error) });
|
|
3387
|
-
return errorResult(
|
|
3388
|
-
`Failed to generate report: ${error instanceof Error ? error.message : String(error)}`
|
|
3389
|
-
);
|
|
3390
|
-
}
|
|
3391
|
-
}
|
|
3392
|
-
);
|
|
3393
|
-
server.registerTool(
|
|
3394
|
-
track(mcpToolName(ctx.productName, "reports_delete")),
|
|
3395
|
-
{
|
|
3396
|
-
title: "Delete Report",
|
|
3397
|
-
description: "Soft-delete a report definition by ID.",
|
|
3398
|
-
inputSchema: { id: zod.z.string().describe("Report ID") }
|
|
3399
|
-
},
|
|
3400
|
-
async ({ id }) => {
|
|
3401
|
-
try {
|
|
3402
|
-
const data = await ctx.gql.workspace.request(
|
|
3403
|
-
DELETE_REPORT,
|
|
3404
|
-
{ id }
|
|
3405
|
-
);
|
|
3406
|
-
return jsonResult({ deleted: data.deleteMovethewheelsReport, id });
|
|
3407
|
-
} catch (error) {
|
|
3408
|
-
ctx.logger.error("movethewheels reports_delete failed", { error: String(error) });
|
|
3409
|
-
return errorResult(
|
|
3410
|
-
`Failed to delete report: ${error instanceof Error ? error.message : String(error)}`
|
|
3411
|
-
);
|
|
3289
|
+
return failure(ctx, "marketplace_delete_offering", "delete service offering", error);
|
|
3412
3290
|
}
|
|
3413
3291
|
}
|
|
3414
3292
|
);
|
|
3415
3293
|
server.registerTool(
|
|
3416
|
-
track(mcpToolName(ctx.productName, "
|
|
3294
|
+
track(mcpToolName(ctx.productName, "marketplace_stats")),
|
|
3417
3295
|
{
|
|
3418
|
-
title: "
|
|
3419
|
-
description: "
|
|
3296
|
+
title: "Marketplace Stats",
|
|
3297
|
+
description: "Counts of providers (total, verified, active) and live offerings, plus the average provider rating.",
|
|
3420
3298
|
inputSchema: {}
|
|
3421
3299
|
},
|
|
3422
3300
|
async () => {
|
|
3423
3301
|
try {
|
|
3424
|
-
const data = await ctx.gql.workspace.request(
|
|
3425
|
-
return jsonResult(data.
|
|
3302
|
+
const data = await ctx.gql.workspace.request(MARKETPLACE_STATS, {});
|
|
3303
|
+
return jsonResult(data.marketplaceStats);
|
|
3426
3304
|
} catch (error) {
|
|
3427
|
-
ctx
|
|
3428
|
-
return errorResult(
|
|
3429
|
-
`Failed to get module settings: ${error instanceof Error ? error.message : String(error)}`
|
|
3430
|
-
);
|
|
3431
|
-
}
|
|
3432
|
-
}
|
|
3433
|
-
);
|
|
3434
|
-
server.registerTool(
|
|
3435
|
-
track(mcpToolName(ctx.productName, "settings_update")),
|
|
3436
|
-
{
|
|
3437
|
-
title: "Update Module Settings",
|
|
3438
|
-
description: "Replace the Movethewheels module preferences JSON for the bound workspace.",
|
|
3439
|
-
inputSchema: {
|
|
3440
|
-
preferences: JsonObject.describe("Module preferences JSON (full replacement)")
|
|
3441
|
-
}
|
|
3442
|
-
},
|
|
3443
|
-
async ({ preferences }) => {
|
|
3444
|
-
try {
|
|
3445
|
-
const data = await ctx.gql.workspace.request(UPDATE_MODULE_SETTINGS, { input: { preferences } });
|
|
3446
|
-
return jsonResult(data.updateModuleSettings);
|
|
3447
|
-
} catch (error) {
|
|
3448
|
-
ctx.logger.error("movethewheels settings_update failed", { error: String(error) });
|
|
3449
|
-
return errorResult(
|
|
3450
|
-
`Failed to update module settings: ${error instanceof Error ? error.message : String(error)}`
|
|
3451
|
-
);
|
|
3305
|
+
return failure(ctx, "marketplace_stats", "get marketplace stats", error);
|
|
3452
3306
|
}
|
|
3453
3307
|
}
|
|
3454
3308
|
);
|
|
3455
3309
|
server.registerTool(
|
|
3456
|
-
track(mcpToolName(ctx.productName, "
|
|
3310
|
+
track(mcpToolName(ctx.productName, "marketplace_assign_shipment")),
|
|
3457
3311
|
{
|
|
3458
|
-
title: "
|
|
3459
|
-
description:
|
|
3312
|
+
title: "Assign Provider to Shipment",
|
|
3313
|
+
description: "Make a marketplace provider the shipment's carrier, or clear the carrier by passing providerId null. Unverified or inactive providers are allowed; check their flags first.",
|
|
3460
3314
|
inputSchema: {
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
}
|
|
3464
|
-
},
|
|
3465
|
-
async ({ resource, format }) => {
|
|
3466
|
-
try {
|
|
3467
|
-
const input = { resource };
|
|
3468
|
-
if (format !== void 0) input.format = format;
|
|
3469
|
-
const data = await ctx.gql.workspace.request(EXPORT_DATA, { input });
|
|
3470
|
-
return jsonResult(data.exportData);
|
|
3471
|
-
} catch (error) {
|
|
3472
|
-
ctx.logger.error("movethewheels data_export failed", { error: String(error) });
|
|
3473
|
-
return errorResult(
|
|
3474
|
-
`Failed to export data: ${error instanceof Error ? error.message : String(error)}`
|
|
3475
|
-
);
|
|
3476
|
-
}
|
|
3477
|
-
}
|
|
3478
|
-
);
|
|
3479
|
-
server.registerTool(
|
|
3480
|
-
track(mcpToolName(ctx.productName, "data_import")),
|
|
3481
|
-
{
|
|
3482
|
-
title: "Import Data",
|
|
3483
|
-
description: 'Import a payload into a Movethewheels resource (e.g. "orders", "customers"). `resource` and `payload` are required.',
|
|
3484
|
-
inputSchema: {
|
|
3485
|
-
resource: zod.z.string().min(1).describe('Resource to import into, e.g. "customers"'),
|
|
3486
|
-
payload: JsonObject.describe("Payload JSON to import")
|
|
3315
|
+
shipmentId: zod.z.string().min(1).describe("Shipment ID"),
|
|
3316
|
+
providerId: zod.z.string().min(1).nullable().describe("Service provider ID, or null to clear the carrier")
|
|
3487
3317
|
}
|
|
3488
3318
|
},
|
|
3489
|
-
async ({
|
|
3319
|
+
async ({ shipmentId, providerId }) => {
|
|
3490
3320
|
try {
|
|
3491
|
-
const data = await ctx.gql.workspace.request(
|
|
3492
|
-
return jsonResult(data.
|
|
3321
|
+
const data = await ctx.gql.workspace.request(ASSIGN_SHIPMENT_SERVICE_PROVIDER, { shipmentId, providerId });
|
|
3322
|
+
return jsonResult(data.assignShipmentServiceProvider);
|
|
3493
3323
|
} catch (error) {
|
|
3494
|
-
ctx
|
|
3495
|
-
return errorResult(
|
|
3496
|
-
`Failed to import data: ${error instanceof Error ? error.message : String(error)}`
|
|
3497
|
-
);
|
|
3324
|
+
return failure(ctx, "marketplace_assign_shipment", "assign provider to shipment", error);
|
|
3498
3325
|
}
|
|
3499
3326
|
}
|
|
3500
3327
|
);
|
|
@@ -3506,7 +3333,7 @@ function registerAnalyticsTools(server, ctx, track) {
|
|
|
3506
3333
|
track(mcpToolName(ctx.productName, "analytics_series")),
|
|
3507
3334
|
{
|
|
3508
3335
|
title: "Analytics Time Series",
|
|
3509
|
-
description: "Time-series trends for
|
|
3336
|
+
description: "Time-series trends for delivery jobs (orderTrend), deliveries, and revenue.",
|
|
3510
3337
|
inputSchema: {}
|
|
3511
3338
|
},
|
|
3512
3339
|
async () => {
|
|
@@ -3525,7 +3352,7 @@ function registerAnalyticsTools(server, ctx, track) {
|
|
|
3525
3352
|
track(mcpToolName(ctx.productName, "analytics_dashboard")),
|
|
3526
3353
|
{
|
|
3527
3354
|
title: "Dashboard Metrics",
|
|
3528
|
-
description: "Headline operations KPIs: total
|
|
3355
|
+
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.",
|
|
3529
3356
|
inputSchema: {}
|
|
3530
3357
|
},
|
|
3531
3358
|
async () => {
|
|
@@ -3541,20 +3368,22 @@ function registerAnalyticsTools(server, ctx, track) {
|
|
|
3541
3368
|
}
|
|
3542
3369
|
);
|
|
3543
3370
|
server.registerTool(
|
|
3544
|
-
track(mcpToolName(ctx.productName, "
|
|
3371
|
+
track(mcpToolName(ctx.productName, "analytics_delivery_job_stats")),
|
|
3545
3372
|
{
|
|
3546
|
-
title: "
|
|
3547
|
-
description: "
|
|
3373
|
+
title: "Delivery Job Stats",
|
|
3374
|
+
description: "Delivery job counts by lifecycle status: total, pending, confirmed, assigned, picked up, in transit, out for delivery, delivered, cancelled, failed, returned.",
|
|
3548
3375
|
inputSchema: {}
|
|
3549
3376
|
},
|
|
3550
3377
|
async () => {
|
|
3551
3378
|
try {
|
|
3552
|
-
const data = await ctx.gql.workspace.request(
|
|
3553
|
-
return jsonResult(data.
|
|
3379
|
+
const data = await ctx.gql.workspace.request(GET_DELIVERY_JOB_STATS, {});
|
|
3380
|
+
return jsonResult(data.deliveryJobStats);
|
|
3554
3381
|
} catch (error) {
|
|
3555
|
-
ctx.logger.error("movethewheels
|
|
3382
|
+
ctx.logger.error("movethewheels analytics_delivery_job_stats failed", {
|
|
3383
|
+
error: String(error)
|
|
3384
|
+
});
|
|
3556
3385
|
return errorResult(
|
|
3557
|
-
`Failed to get
|
|
3386
|
+
`Failed to get delivery job stats: ${error instanceof Error ? error.message : String(error)}`
|
|
3558
3387
|
);
|
|
3559
3388
|
}
|
|
3560
3389
|
}
|
|
@@ -3623,32 +3452,38 @@ Logistics / fleet / warehouse / last-mile-delivery operations platform.
|
|
|
3623
3452
|
- Customer \u2014 shipper/consignee (B2B/B2C)
|
|
3624
3453
|
- Driver \u2014 fleet driver (status, license, telemetry)
|
|
3625
3454
|
- Vehicle \u2014 fleet vehicle (type, status, capacity, location)
|
|
3626
|
-
-
|
|
3627
|
-
|
|
3628
|
-
-
|
|
3455
|
+
- CargoItem \u2014 cargo SKU master (weight, dimensions, hazardous/fragile/temp).
|
|
3456
|
+
Not a sellable product: storefront SKUs live in global-store-svc.
|
|
3457
|
+
- DeliveryJob (+DeliveryJobStatusHistory) \u2014 the dispatch unit (pickup,
|
|
3458
|
+
delivery, cargo, driver/vehicle/route) + status timeline. Not a checkout
|
|
3459
|
+
order: the order of record is a global-store StoreOrder (storeOrderId).
|
|
3460
|
+
- Shipment (+TrackingEvent) \u2014 freight shipment for a delivery job + tracking
|
|
3461
|
+
timeline; carrierId may point at a marketplace ServiceProvider
|
|
3629
3462
|
- Route \u2014 planned/optimized delivery route
|
|
3630
3463
|
- Warehouse (+WarehouseLocation) \u2014 facilities + storage locations
|
|
3631
3464
|
- InventoryItem (+InventoryTransaction) \u2014 stock at a warehouse + ledger
|
|
3632
3465
|
- ServiceProvider (+ServiceOffering) \u2014 3PL marketplace providers + offerings
|
|
3633
|
-
- MovethewheelsReport \u2014 report definitions
|
|
3634
3466
|
|
|
3635
3467
|
## Enums
|
|
3636
3468
|
- DriverStatus: AVAILABLE, INACTIVE, OFF_DUTY, ON_BREAK, ON_DELIVERY
|
|
3637
3469
|
- VehicleStatus: ACTIVE, DECOMMISSIONED, INACTIVE, IN_TRANSIT, MAINTENANCE
|
|
3638
3470
|
- VehicleType: BICYCLE, DRONE, FLATBED, MOTORCYCLE, REFRIGERATED, SEMI_TRAILER, TRUCK, VAN
|
|
3639
|
-
-
|
|
3640
|
-
-
|
|
3641
|
-
- OrderStatus: PENDING, CONFIRMED, ASSIGNED, PICKED_UP, IN_TRANSIT, OUT_FOR_DELIVERY, DELIVERED, CANCELLED, FAILED, RETURNED
|
|
3471
|
+
- DeliveryPriority: CRITICAL, HIGH, LOW, MEDIUM, URGENT
|
|
3472
|
+
- DeliveryJobStatus: PENDING, CONFIRMED, ASSIGNED, PICKED_UP, IN_TRANSIT, OUT_FOR_DELIVERY, DELIVERED, CANCELLED, FAILED, RETURNED
|
|
3642
3473
|
- ShipmentStatus: PLANNED, PICKED_UP, IN_TRANSIT, DELIVERED, FAILED, RETURNED
|
|
3643
3474
|
- TrackingEventType: CREATED, PICKED_UP, DEPARTED, ARRIVED, IN_TRANSIT, OUT_FOR_DELIVERY, DELIVERED, FAILED, RETURNED
|
|
3644
3475
|
- RouteStatus: PLANNED, IN_PROGRESS, COMPLETED, CANCELLED
|
|
3645
3476
|
- WarehouseType: COLD_STORAGE, CROSS_DOCK, DISTRIBUTION, FULFILLMENT, RETAIL
|
|
3646
3477
|
- InventoryTransactionType: RECEIPT, ISSUE, TRANSFER, ADJUSTMENT, RETURN
|
|
3647
3478
|
|
|
3479
|
+
## Stock rule
|
|
3480
|
+
Inventory counts are non-negative integers and available + allocated + damaged
|
|
3481
|
+
must equal onHand. Move stock between lines with inventory_transfer_stock.
|
|
3482
|
+
|
|
3648
3483
|
## Tool groups
|
|
3649
|
-
customers, drivers, vehicles,
|
|
3650
|
-
warehouses, inventory, marketplace (service providers + offerings),
|
|
3651
|
-
|
|
3484
|
+
customers, drivers, vehicles, cargo, delivery_jobs, shipments, tracking,
|
|
3485
|
+
routes, warehouses, inventory, marketplace (service providers + offerings),
|
|
3486
|
+
analytics.
|
|
3652
3487
|
All run against the WORKSPACE gateway (workspace-scoped). The subgraph has no
|
|
3653
3488
|
@public health field, so there is no health tool.
|
|
3654
3489
|
`;
|
|
@@ -3662,7 +3497,7 @@ All run against the WORKSPACE gateway (workspace-scoped). The subgraph has no
|
|
|
3662
3497
|
dashboardUri,
|
|
3663
3498
|
{
|
|
3664
3499
|
title: "Movethewheels Dashboard Metrics",
|
|
3665
|
-
description: "Live headline operations KPIs (
|
|
3500
|
+
description: "Live headline operations KPIs (delivery jobs, active deliveries, vehicles, drivers, low-stock, revenue, on-time rate).",
|
|
3666
3501
|
mimeType: "application/json"
|
|
3667
3502
|
},
|
|
3668
3503
|
async () => {
|
|
@@ -3780,28 +3615,28 @@ function registerMovethewheelsPrompts(server, ctx, track) {
|
|
|
3780
3615
|
fulfilmentName,
|
|
3781
3616
|
{
|
|
3782
3617
|
title: "Delivery Fulfilment",
|
|
3783
|
-
description: "Guide for fulfilling a delivery
|
|
3618
|
+
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.",
|
|
3784
3619
|
argsSchema: {
|
|
3785
|
-
customerId: zod.z.string().optional().describe("Customer
|
|
3786
|
-
|
|
3620
|
+
customerId: zod.z.string().optional().describe("Customer the delivery is for"),
|
|
3621
|
+
deliveryJobId: zod.z.string().optional().describe("Existing delivery job ID to fulfil")
|
|
3787
3622
|
}
|
|
3788
3623
|
},
|
|
3789
|
-
({ customerId,
|
|
3790
|
-
ctx.logger.debug(`Prompt ${fulfilmentName} called`, { customerId,
|
|
3791
|
-
const
|
|
3624
|
+
({ customerId, deliveryJobId }) => {
|
|
3625
|
+
ctx.logger.debug(`Prompt ${fulfilmentName} called`, { customerId, deliveryJobId });
|
|
3626
|
+
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).`;
|
|
3792
3627
|
return {
|
|
3793
3628
|
messages: [
|
|
3794
3629
|
{
|
|
3795
3630
|
role: "user",
|
|
3796
3631
|
content: {
|
|
3797
3632
|
type: "text",
|
|
3798
|
-
text: `Help me fulfil a Movethewheels delivery
|
|
3633
|
+
text: `Help me fulfil a Movethewheels delivery job. ${jobNote}
|
|
3799
3634
|
|
|
3800
|
-
1. **
|
|
3801
|
-
2. **Assign Capacity**: Use ${p}_drivers_list (status=AVAILABLE) and ${p}_vehicles_list (status=ACTIVE), then ${p}_drivers_assign_vehicle and ${p}
|
|
3802
|
-
3. **Shipment**: Use ${p}_shipments_create with the
|
|
3803
|
-
4. **Track**: As the shipment moves, use ${p}_tracking_add_event (PICKED_UP \u2192 IN_TRANSIT \u2192 OUT_FOR_DELIVERY \u2192 DELIVERED) and mirror
|
|
3804
|
-
5. **Verify**: Use ${p}
|
|
3635
|
+
1. **Delivery job**: If needed, use ${p}_delivery_jobs_create with a unique deliveryJobNumber, pickupAddress, deliveryAddress, and cargoItems.
|
|
3636
|
+
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.
|
|
3637
|
+
3. **Shipment**: Use ${p}_shipments_create with the deliveryJobId, a unique shipmentNumber, origin, and destination.
|
|
3638
|
+
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.
|
|
3639
|
+
5. **Verify**: Use ${p}_tracking_delivery_job_events to confirm the timeline and ${p}_delivery_jobs_get for the final state.
|
|
3805
3640
|
|
|
3806
3641
|
Show results at each step and confirm before marking DELIVERED.`
|
|
3807
3642
|
}
|
|
@@ -3814,7 +3649,7 @@ Show results at each step and confirm before marking DELIVERED.`
|
|
|
3814
3649
|
fleetName,
|
|
3815
3650
|
{
|
|
3816
3651
|
title: "Fleet & Warehouse Operations",
|
|
3817
|
-
description: "Daily operations workflow: review KPIs, triage the
|
|
3652
|
+
description: "Daily operations workflow: review KPIs, triage the delivery-job queue and tracking alerts, balance fleet status, and watch low inventory.",
|
|
3818
3653
|
argsSchema: {}
|
|
3819
3654
|
},
|
|
3820
3655
|
() => {
|
|
@@ -3827,11 +3662,11 @@ Show results at each step and confirm before marking DELIVERED.`
|
|
|
3827
3662
|
type: "text",
|
|
3828
3663
|
text: `Run daily Movethewheels operations.
|
|
3829
3664
|
|
|
3830
|
-
1. **KPIs**: Use ${p}_analytics_dashboard for headline numbers, ${p}
|
|
3831
|
-
2. **
|
|
3832
|
-
3. **Tracking Alerts**: Use ${p}_tracking_alerts to find
|
|
3665
|
+
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.
|
|
3666
|
+
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.
|
|
3667
|
+
3. **Tracking Alerts**: Use ${p}_tracking_alerts to find DELAYED and AT_RISK shipments and ${p}_shipments_get to investigate.
|
|
3833
3668
|
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.
|
|
3834
|
-
5. **Inventory**: Use ${p}_inventory_stats and ${p}_inventory_list_items to find low-stock items; record
|
|
3669
|
+
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.
|
|
3835
3670
|
|
|
3836
3671
|
Summarize what needs attention after each step.`
|
|
3837
3672
|
}
|
|
@@ -3868,15 +3703,14 @@ var movethewheelsModule = {
|
|
|
3868
3703
|
registerCustomerTools(server, ctx, trackTool);
|
|
3869
3704
|
registerDriverTools(server, ctx, trackTool);
|
|
3870
3705
|
registerVehicleTools(server, ctx, trackTool);
|
|
3871
|
-
|
|
3872
|
-
|
|
3706
|
+
registerCargoTools(server, ctx, trackTool);
|
|
3707
|
+
registerDeliveryJobTools(server, ctx, trackTool);
|
|
3873
3708
|
registerShipmentTools(server, ctx, trackTool);
|
|
3874
3709
|
registerTrackingTools(server, ctx, trackTool);
|
|
3875
3710
|
registerRouteTools(server, ctx, trackTool);
|
|
3876
3711
|
registerWarehouseTools(server, ctx, trackTool);
|
|
3877
3712
|
registerInventoryTools(server, ctx, trackTool);
|
|
3878
3713
|
registerMarketplaceTools(server, ctx, trackTool);
|
|
3879
|
-
registerReportTools(server, ctx, trackTool);
|
|
3880
3714
|
registerAnalyticsTools(server, ctx, trackTool);
|
|
3881
3715
|
registerMovethewheelsResources(server, ctx, trackResource);
|
|
3882
3716
|
registerMovethewheelsPrompts(server, ctx, trackPrompt);
|