@burdenoff/mcp-libs 2026.1030.4 → 2026.1030.5
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 +176 -159
- package/dist/modules/movethewheels/index.cjs.map +1 -1
- package/dist/modules/movethewheels/index.js +176 -159
- package/dist/modules/movethewheels/index.js.map +1 -1
- package/dist/modules/movethewheels/operations.d.ts +12 -10
- package/dist/modules/movethewheels/tools/shared.d.ts +3 -0
- package/package.json +1 -1
|
@@ -125,13 +125,14 @@ var INVENTORY_TRANSACTION_FIELDS = `
|
|
|
125
125
|
id transactionNumber type productId warehouseId inventoryItemId quantity
|
|
126
126
|
unitCost referenceType referenceId notes ${AUDIT_FIELDS} ${CONTEXT_FIELDS}
|
|
127
127
|
`;
|
|
128
|
+
var MARKETPLACE_AUDIT_FIELDS = `workspaceId createdBy onBehalfOf updatedBy createdAt updatedAt deletedAt`;
|
|
128
129
|
var SERVICE_OFFERING_FIELDS = `
|
|
129
|
-
id name
|
|
130
|
-
|
|
130
|
+
id providerId name description category price currency pricingUnit transitDays
|
|
131
|
+
availability isActive ${MARKETPLACE_AUDIT_FIELDS}
|
|
131
132
|
`;
|
|
132
133
|
var SERVICE_PROVIDER_FIELDS = `
|
|
133
|
-
id name type description
|
|
134
|
-
|
|
134
|
+
id name type description rating contactInfo services serviceAreas isVerified isActive
|
|
135
|
+
offeringsCount ${MARKETPLACE_AUDIT_FIELDS}
|
|
135
136
|
`;
|
|
136
137
|
var REPORT_FIELDS = `
|
|
137
138
|
id name type status description configuration schedule lastGenerated
|
|
@@ -495,19 +496,19 @@ var GET_SERVICE_PROVIDER = `
|
|
|
495
496
|
`;
|
|
496
497
|
var LIST_SERVICE_PROVIDERS = `
|
|
497
498
|
query MovethewheelsListServiceProviders(
|
|
498
|
-
$filter:
|
|
499
|
+
$filter: MtwServiceProviderFilterInput
|
|
499
500
|
$pagination: PaginationInput
|
|
500
501
|
) {
|
|
501
502
|
serviceProviders(filter: $filter, pagination: $pagination) { ${SERVICE_PROVIDER_FIELDS} }
|
|
502
503
|
}
|
|
503
504
|
`;
|
|
504
505
|
var CREATE_SERVICE_PROVIDER = `
|
|
505
|
-
mutation MovethewheelsCreateServiceProvider($input:
|
|
506
|
+
mutation MovethewheelsCreateServiceProvider($input: MtwCreateServiceProviderInput!) {
|
|
506
507
|
createServiceProvider(input: $input) { ${SERVICE_PROVIDER_FIELDS} }
|
|
507
508
|
}
|
|
508
509
|
`;
|
|
509
510
|
var UPDATE_SERVICE_PROVIDER = `
|
|
510
|
-
mutation MovethewheelsUpdateServiceProvider($id: ID!, $input:
|
|
511
|
+
mutation MovethewheelsUpdateServiceProvider($id: ID!, $input: MtwUpdateServiceProviderInput!) {
|
|
511
512
|
updateServiceProvider(id: $id, input: $input) { ${SERVICE_PROVIDER_FIELDS} }
|
|
512
513
|
}
|
|
513
514
|
`;
|
|
@@ -520,25 +521,28 @@ var GET_SERVICE_OFFERING = `
|
|
|
520
521
|
query MovethewheelsGetServiceOffering($id: ID!) {
|
|
521
522
|
serviceOffering(id: $id) {
|
|
522
523
|
${SERVICE_OFFERING_FIELDS}
|
|
523
|
-
provider { id name type }
|
|
524
|
+
provider { id name type isVerified isActive }
|
|
524
525
|
}
|
|
525
526
|
}
|
|
526
527
|
`;
|
|
527
528
|
var LIST_SERVICE_OFFERINGS = `
|
|
528
529
|
query MovethewheelsListServiceOfferings(
|
|
529
|
-
$filter:
|
|
530
|
+
$filter: MtwServiceOfferingFilterInput
|
|
530
531
|
$pagination: PaginationInput
|
|
531
532
|
) {
|
|
532
|
-
serviceOfferings(filter: $filter, pagination: $pagination) {
|
|
533
|
+
serviceOfferings(filter: $filter, pagination: $pagination) {
|
|
534
|
+
${SERVICE_OFFERING_FIELDS}
|
|
535
|
+
provider { id name type isVerified }
|
|
536
|
+
}
|
|
533
537
|
}
|
|
534
538
|
`;
|
|
535
539
|
var CREATE_SERVICE_OFFERING = `
|
|
536
|
-
mutation MovethewheelsCreateServiceOffering($input:
|
|
540
|
+
mutation MovethewheelsCreateServiceOffering($input: MtwCreateServiceOfferingInput!) {
|
|
537
541
|
createServiceOffering(input: $input) { ${SERVICE_OFFERING_FIELDS} }
|
|
538
542
|
}
|
|
539
543
|
`;
|
|
540
544
|
var UPDATE_SERVICE_OFFERING = `
|
|
541
|
-
mutation MovethewheelsUpdateServiceOffering($id: ID!, $input:
|
|
545
|
+
mutation MovethewheelsUpdateServiceOffering($id: ID!, $input: MtwUpdateServiceOfferingInput!) {
|
|
542
546
|
updateServiceOffering(id: $id, input: $input) { ${SERVICE_OFFERING_FIELDS} }
|
|
543
547
|
}
|
|
544
548
|
`;
|
|
@@ -547,6 +551,19 @@ var DELETE_SERVICE_OFFERING = `
|
|
|
547
551
|
deleteServiceOffering(id: $id)
|
|
548
552
|
}
|
|
549
553
|
`;
|
|
554
|
+
var MARKETPLACE_STATS = `
|
|
555
|
+
query MovethewheelsMarketplaceStats {
|
|
556
|
+
marketplaceStats { providers verifiedProviders activeProviders offerings avgRating }
|
|
557
|
+
}
|
|
558
|
+
`;
|
|
559
|
+
var ASSIGN_SHIPMENT_SERVICE_PROVIDER = `
|
|
560
|
+
mutation MovethewheelsAssignShipmentServiceProvider($shipmentId: ID!, $providerId: ID) {
|
|
561
|
+
assignShipmentServiceProvider(shipmentId: $shipmentId, providerId: $providerId) {
|
|
562
|
+
id shipmentNumber status carrierId
|
|
563
|
+
serviceProvider { id name type isVerified isActive deletedAt }
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
`;
|
|
550
567
|
var GET_REPORT = `
|
|
551
568
|
query MovethewheelsGetReport($id: ID!) {
|
|
552
569
|
movethewheelsReport(id: $id) { ${REPORT_FIELDS} }
|
|
@@ -696,6 +713,30 @@ var VehicleTypeEnum = zod.z.enum([
|
|
|
696
713
|
"VAN"
|
|
697
714
|
]).describe("Class of vehicle in the fleet");
|
|
698
715
|
var WarehouseTypeEnum = zod.z.enum(["COLD_STORAGE", "CROSS_DOCK", "DISTRIBUTION", "FULFILLMENT", "RETAIL"]).describe("Type of warehouse facility");
|
|
716
|
+
var ServiceProviderTypeEnum = zod.z.enum([
|
|
717
|
+
"CARRIER",
|
|
718
|
+
"FREIGHT_FORWARDER",
|
|
719
|
+
"THIRD_PARTY_LOGISTICS",
|
|
720
|
+
"WAREHOUSE",
|
|
721
|
+
"CUSTOMS_BROKER",
|
|
722
|
+
"LAST_MILE",
|
|
723
|
+
"COURIER",
|
|
724
|
+
"OTHER"
|
|
725
|
+
]).describe("Kind of marketplace service provider");
|
|
726
|
+
var ServiceOfferingCategoryEnum = zod.z.enum([
|
|
727
|
+
"FULL_TRUCKLOAD",
|
|
728
|
+
"LESS_THAN_TRUCKLOAD",
|
|
729
|
+
"LAST_MILE",
|
|
730
|
+
"EXPRESS",
|
|
731
|
+
"OCEAN_FREIGHT",
|
|
732
|
+
"AIR_FREIGHT",
|
|
733
|
+
"RAIL_FREIGHT",
|
|
734
|
+
"WAREHOUSING",
|
|
735
|
+
"CUSTOMS_CLEARANCE",
|
|
736
|
+
"COLD_CHAIN",
|
|
737
|
+
"OTHER"
|
|
738
|
+
]).describe("What a marketplace service offering provides");
|
|
739
|
+
var ServiceAvailabilityEnum = zod.z.enum(["AVAILABLE", "LIMITED", "UNAVAILABLE"]).describe("Whether the provider currently has capacity for an offering");
|
|
699
740
|
var JsonObject = zod.z.record(zod.z.string(), zod.z.unknown());
|
|
700
741
|
var JsonValue = zod.z.union([JsonObject, zod.z.array(zod.z.unknown())]);
|
|
701
742
|
|
|
@@ -2922,12 +2963,28 @@ function registerInventoryTools(server, ctx, track) {
|
|
|
2922
2963
|
}
|
|
2923
2964
|
);
|
|
2924
2965
|
}
|
|
2966
|
+
var Rating = zod.z.number().min(0).max(5);
|
|
2967
|
+
var Tags = zod.z.array(zod.z.string().min(1));
|
|
2968
|
+
var Currency = zod.z.string().regex(/^[A-Za-z]{3}$/).describe('ISO 4217 currency code, e.g. "INR" or "USD"');
|
|
2969
|
+
function definedOnly(source) {
|
|
2970
|
+
const out = {};
|
|
2971
|
+
for (const [key, value] of Object.entries(source)) {
|
|
2972
|
+
if (value !== void 0) out[key] = value;
|
|
2973
|
+
}
|
|
2974
|
+
return out;
|
|
2975
|
+
}
|
|
2976
|
+
function failure(ctx, tool, action, error) {
|
|
2977
|
+
ctx.logger.error(`movethewheels ${tool} failed`, { error: String(error) });
|
|
2978
|
+
return errorResult(
|
|
2979
|
+
`Failed to ${action}: ${error instanceof Error ? error.message : String(error)}`
|
|
2980
|
+
);
|
|
2981
|
+
}
|
|
2925
2982
|
function registerMarketplaceTools(server, ctx, track) {
|
|
2926
2983
|
server.registerTool(
|
|
2927
2984
|
track(mcpToolName(ctx.productName, "marketplace_get_provider")),
|
|
2928
2985
|
{
|
|
2929
2986
|
title: "Get Service Provider",
|
|
2930
|
-
description: "Fetch a single
|
|
2987
|
+
description: "Fetch a single marketplace service provider by ID, including its offerings.",
|
|
2931
2988
|
inputSchema: { id: zod.z.string().describe("Service provider ID") }
|
|
2932
2989
|
},
|
|
2933
2990
|
async ({ id }) => {
|
|
@@ -2936,10 +2993,7 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
2936
2993
|
if (!data.serviceProvider) return errorResult(`Service provider ${id} not found`);
|
|
2937
2994
|
return jsonResult(data.serviceProvider);
|
|
2938
2995
|
} catch (error) {
|
|
2939
|
-
ctx
|
|
2940
|
-
return errorResult(
|
|
2941
|
-
`Failed to get service provider: ${error instanceof Error ? error.message : String(error)}`
|
|
2942
|
-
);
|
|
2996
|
+
return failure(ctx, "marketplace_get_provider", "get service provider", error);
|
|
2943
2997
|
}
|
|
2944
2998
|
}
|
|
2945
2999
|
);
|
|
@@ -2947,33 +3001,27 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
2947
3001
|
track(mcpToolName(ctx.productName, "marketplace_list_providers")),
|
|
2948
3002
|
{
|
|
2949
3003
|
title: "List Service Providers",
|
|
2950
|
-
description: "List
|
|
3004
|
+
description: "List marketplace service providers with optional type/verified/active/rating/text filters and pagination.",
|
|
2951
3005
|
inputSchema: {
|
|
2952
|
-
search: zod.z.string().optional().describe("
|
|
2953
|
-
type:
|
|
3006
|
+
search: zod.z.string().optional().describe("Case-insensitive match on name, description, services and service areas"),
|
|
3007
|
+
type: ServiceProviderTypeEnum.optional(),
|
|
3008
|
+
isVerified: zod.z.boolean().optional().describe("Only verified (or unverified) providers"),
|
|
2954
3009
|
isActive: zod.z.boolean().optional().describe("Filter by active flag"),
|
|
2955
|
-
|
|
2956
|
-
|
|
3010
|
+
minRating: Rating.optional().describe("Only providers rated at least this (0-5)"),
|
|
3011
|
+
limit: zod.z.number().int().positive().optional().describe("Page size (default 50)"),
|
|
3012
|
+
offset: zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
|
|
2957
3013
|
}
|
|
2958
3014
|
},
|
|
2959
|
-
async ({ search, type, isActive, limit, offset }) => {
|
|
3015
|
+
async ({ search, type, isVerified, isActive, minRating, limit, offset }) => {
|
|
2960
3016
|
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;
|
|
3017
|
+
const filter = definedOnly({ search, type, isVerified, isActive, minRating });
|
|
2965
3018
|
const data = await ctx.gql.workspace.request(LIST_SERVICE_PROVIDERS, {
|
|
2966
3019
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
2967
3020
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
2968
3021
|
});
|
|
2969
3022
|
return jsonResult(data.serviceProviders);
|
|
2970
3023
|
} 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
|
-
);
|
|
3024
|
+
return failure(ctx, "marketplace_list_providers", "list service providers", error);
|
|
2977
3025
|
}
|
|
2978
3026
|
}
|
|
2979
3027
|
);
|
|
@@ -2981,36 +3029,27 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
2981
3029
|
track(mcpToolName(ctx.productName, "marketplace_create_provider")),
|
|
2982
3030
|
{
|
|
2983
3031
|
title: "Create Service Provider",
|
|
2984
|
-
description: "
|
|
3032
|
+
description: "Add a service provider to the workspace marketplace directory. `name` and `type` are required; `isActive` defaults to true, `isVerified` to false.",
|
|
2985
3033
|
inputSchema: {
|
|
2986
3034
|
name: zod.z.string().min(1).describe("Provider name"),
|
|
2987
|
-
type:
|
|
3035
|
+
type: ServiceProviderTypeEnum,
|
|
2988
3036
|
description: zod.z.string().optional().describe("Description"),
|
|
2989
|
-
|
|
3037
|
+
rating: Rating.optional().describe("The workspace's own rating, 0-5"),
|
|
3038
|
+
contactInfo: JsonObject.optional().describe(
|
|
3039
|
+
"Contact details, e.g. { contactName, email, phone, website }"
|
|
3040
|
+
),
|
|
3041
|
+
services: Tags.optional().describe('Short service tags, e.g. ["reefer", "hazmat"]'),
|
|
3042
|
+
serviceAreas: Tags.optional().describe("Regions, lanes or cities covered"),
|
|
2990
3043
|
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")
|
|
3044
|
+
isActive: zod.z.boolean().optional().describe("Active flag (default true)")
|
|
2994
3045
|
}
|
|
2995
3046
|
},
|
|
2996
|
-
async (
|
|
3047
|
+
async (args) => {
|
|
2997
3048
|
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 });
|
|
3049
|
+
const data = await ctx.gql.workspace.request(CREATE_SERVICE_PROVIDER, { input: definedOnly(args) });
|
|
3006
3050
|
return jsonResult(data.createServiceProvider);
|
|
3007
3051
|
} 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
|
-
);
|
|
3052
|
+
return failure(ctx, "marketplace_create_provider", "create service provider", error);
|
|
3014
3053
|
}
|
|
3015
3054
|
}
|
|
3016
3055
|
);
|
|
@@ -3021,49 +3060,27 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3021
3060
|
description: "Update a service provider. At least one mutable field must be provided.",
|
|
3022
3061
|
inputSchema: {
|
|
3023
3062
|
id: zod.z.string().describe("Service provider ID"),
|
|
3024
|
-
name: zod.z.string().optional().describe("Updated name"),
|
|
3025
|
-
type:
|
|
3063
|
+
name: zod.z.string().min(1).optional().describe("Updated name"),
|
|
3064
|
+
type: ServiceProviderTypeEnum.optional(),
|
|
3026
3065
|
description: zod.z.string().optional().describe("Updated description"),
|
|
3027
|
-
|
|
3066
|
+
rating: Rating.optional().describe("Updated rating, 0-5"),
|
|
3067
|
+
contactInfo: JsonObject.optional().describe("Updated contact details"),
|
|
3068
|
+
services: Tags.optional().describe("Replacement service tags"),
|
|
3069
|
+
serviceAreas: Tags.optional().describe("Replacement service areas"),
|
|
3028
3070
|
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")
|
|
3071
|
+
isActive: zod.z.boolean().optional().describe("Updated active flag")
|
|
3032
3072
|
}
|
|
3033
3073
|
},
|
|
3034
|
-
async ({
|
|
3035
|
-
id,
|
|
3036
|
-
name,
|
|
3037
|
-
type,
|
|
3038
|
-
description,
|
|
3039
|
-
isActive,
|
|
3040
|
-
isVerified,
|
|
3041
|
-
rating,
|
|
3042
|
-
services,
|
|
3043
|
-
contactInfo
|
|
3044
|
-
}) => {
|
|
3074
|
+
async ({ id, ...rest }) => {
|
|
3045
3075
|
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;
|
|
3076
|
+
const input = definedOnly(rest);
|
|
3055
3077
|
if (Object.keys(input).length === 0) {
|
|
3056
3078
|
return errorResult("No updates specified \u2014 provide at least one mutable field.");
|
|
3057
3079
|
}
|
|
3058
3080
|
const data = await ctx.gql.workspace.request(UPDATE_SERVICE_PROVIDER, { id, input });
|
|
3059
3081
|
return jsonResult(data.updateServiceProvider);
|
|
3060
3082
|
} 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
|
-
);
|
|
3083
|
+
return failure(ctx, "marketplace_update_provider", "update service provider", error);
|
|
3067
3084
|
}
|
|
3068
3085
|
}
|
|
3069
3086
|
);
|
|
@@ -3071,7 +3088,7 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3071
3088
|
track(mcpToolName(ctx.productName, "marketplace_delete_provider")),
|
|
3072
3089
|
{
|
|
3073
3090
|
title: "Delete Service Provider",
|
|
3074
|
-
description: "Soft-delete a service provider
|
|
3091
|
+
description: "Soft-delete a service provider and its offerings. Shipments that already use it as carrier keep the reference.",
|
|
3075
3092
|
inputSchema: { id: zod.z.string().describe("Service provider ID") }
|
|
3076
3093
|
},
|
|
3077
3094
|
async ({ id }) => {
|
|
@@ -3082,12 +3099,7 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3082
3099
|
);
|
|
3083
3100
|
return jsonResult({ deleted: data.deleteServiceProvider, id });
|
|
3084
3101
|
} 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
|
-
);
|
|
3102
|
+
return failure(ctx, "marketplace_delete_provider", "delete service provider", error);
|
|
3091
3103
|
}
|
|
3092
3104
|
}
|
|
3093
3105
|
);
|
|
@@ -3104,10 +3116,7 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3104
3116
|
if (!data.serviceOffering) return errorResult(`Service offering ${id} not found`);
|
|
3105
3117
|
return jsonResult(data.serviceOffering);
|
|
3106
3118
|
} catch (error) {
|
|
3107
|
-
ctx
|
|
3108
|
-
return errorResult(
|
|
3109
|
-
`Failed to get service offering: ${error instanceof Error ? error.message : String(error)}`
|
|
3110
|
-
);
|
|
3119
|
+
return failure(ctx, "marketplace_get_offering", "get service offering", error);
|
|
3111
3120
|
}
|
|
3112
3121
|
}
|
|
3113
3122
|
);
|
|
@@ -3115,33 +3124,28 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3115
3124
|
track(mcpToolName(ctx.productName, "marketplace_list_offerings")),
|
|
3116
3125
|
{
|
|
3117
3126
|
title: "List Service Offerings",
|
|
3118
|
-
description: "List service offerings with optional provider/category/text filters and pagination.",
|
|
3127
|
+
description: "List service offerings with optional provider/category/availability/price/text filters and pagination.",
|
|
3119
3128
|
inputSchema: {
|
|
3120
|
-
search: zod.z.string().optional().describe("
|
|
3129
|
+
search: zod.z.string().optional().describe("Case-insensitive match on name and description"),
|
|
3121
3130
|
providerId: zod.z.string().optional().describe("Filter by provider ID"),
|
|
3122
|
-
category:
|
|
3123
|
-
|
|
3124
|
-
|
|
3131
|
+
category: ServiceOfferingCategoryEnum.optional(),
|
|
3132
|
+
availability: ServiceAvailabilityEnum.optional(),
|
|
3133
|
+
isActive: zod.z.boolean().optional().describe("Filter by active flag"),
|
|
3134
|
+
maxPrice: zod.z.number().min(0).optional().describe("Only offerings at or below this price"),
|
|
3135
|
+
limit: zod.z.number().int().positive().optional().describe("Page size (default 50)"),
|
|
3136
|
+
offset: zod.z.number().int().min(0).optional().describe("Pagination offset (default 0)")
|
|
3125
3137
|
}
|
|
3126
3138
|
},
|
|
3127
|
-
async ({
|
|
3139
|
+
async ({ limit, offset, ...rest }) => {
|
|
3128
3140
|
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;
|
|
3141
|
+
const filter = definedOnly(rest);
|
|
3133
3142
|
const data = await ctx.gql.workspace.request(LIST_SERVICE_OFFERINGS, {
|
|
3134
3143
|
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
3135
3144
|
pagination: { limit: limit ?? 50, offset: offset ?? 0 }
|
|
3136
3145
|
});
|
|
3137
3146
|
return jsonResult(data.serviceOfferings);
|
|
3138
3147
|
} 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
|
-
);
|
|
3148
|
+
return failure(ctx, "marketplace_list_offerings", "list service offerings", error);
|
|
3145
3149
|
}
|
|
3146
3150
|
}
|
|
3147
3151
|
);
|
|
@@ -3149,33 +3153,26 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3149
3153
|
track(mcpToolName(ctx.productName, "marketplace_create_offering")),
|
|
3150
3154
|
{
|
|
3151
3155
|
title: "Create Service Offering",
|
|
3152
|
-
description: '
|
|
3156
|
+
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
3157
|
inputSchema: {
|
|
3154
|
-
name: zod.z.string().min(1).describe("Offering name"),
|
|
3155
|
-
price: zod.z.number().describe("Price"),
|
|
3156
3158
|
providerId: zod.z.string().min(1).describe("Owning provider ID"),
|
|
3157
|
-
|
|
3159
|
+
name: zod.z.string().min(1).describe("Offering name"),
|
|
3160
|
+
category: ServiceOfferingCategoryEnum,
|
|
3158
3161
|
description: zod.z.string().optional().describe("Description"),
|
|
3159
|
-
|
|
3160
|
-
|
|
3162
|
+
price: zod.z.number().min(0).optional().describe("Indicative price in `currency`"),
|
|
3163
|
+
currency: Currency.optional(),
|
|
3164
|
+
pricingUnit: zod.z.string().optional().describe('What the price is charged per, e.g. "per km" or "per pallet"'),
|
|
3165
|
+
transitDays: zod.z.number().int().min(0).optional().describe("Typical transit time in days"),
|
|
3166
|
+
availability: ServiceAvailabilityEnum.optional(),
|
|
3167
|
+
isActive: zod.z.boolean().optional().describe("Active flag (default true)")
|
|
3161
3168
|
}
|
|
3162
3169
|
},
|
|
3163
|
-
async (
|
|
3170
|
+
async (args) => {
|
|
3164
3171
|
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 });
|
|
3172
|
+
const data = await ctx.gql.workspace.request(CREATE_SERVICE_OFFERING, { input: definedOnly(args) });
|
|
3171
3173
|
return jsonResult(data.createServiceOffering);
|
|
3172
3174
|
} 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
|
-
);
|
|
3175
|
+
return failure(ctx, "marketplace_create_offering", "create service offering", error);
|
|
3179
3176
|
}
|
|
3180
3177
|
}
|
|
3181
3178
|
);
|
|
@@ -3186,37 +3183,27 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3186
3183
|
description: "Update a service offering. At least one mutable field must be provided.",
|
|
3187
3184
|
inputSchema: {
|
|
3188
3185
|
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"),
|
|
3186
|
+
name: zod.z.string().min(1).optional().describe("Updated name"),
|
|
3187
|
+
category: ServiceOfferingCategoryEnum.optional(),
|
|
3193
3188
|
description: zod.z.string().optional().describe("Updated description"),
|
|
3194
|
-
|
|
3195
|
-
|
|
3189
|
+
price: zod.z.number().min(0).optional().describe("Updated price"),
|
|
3190
|
+
currency: Currency.optional(),
|
|
3191
|
+
pricingUnit: zod.z.string().optional().describe("Updated pricing unit"),
|
|
3192
|
+
transitDays: zod.z.number().int().min(0).optional().describe("Updated transit days"),
|
|
3193
|
+
availability: ServiceAvailabilityEnum.optional(),
|
|
3194
|
+
isActive: zod.z.boolean().optional().describe("Updated active flag")
|
|
3196
3195
|
}
|
|
3197
3196
|
},
|
|
3198
|
-
async ({ id,
|
|
3197
|
+
async ({ id, ...rest }) => {
|
|
3199
3198
|
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;
|
|
3199
|
+
const input = definedOnly(rest);
|
|
3208
3200
|
if (Object.keys(input).length === 0) {
|
|
3209
3201
|
return errorResult("No updates specified \u2014 provide at least one mutable field.");
|
|
3210
3202
|
}
|
|
3211
3203
|
const data = await ctx.gql.workspace.request(UPDATE_SERVICE_OFFERING, { id, input });
|
|
3212
3204
|
return jsonResult(data.updateServiceOffering);
|
|
3213
3205
|
} 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
|
-
);
|
|
3206
|
+
return failure(ctx, "marketplace_update_offering", "update service offering", error);
|
|
3220
3207
|
}
|
|
3221
3208
|
}
|
|
3222
3209
|
);
|
|
@@ -3235,12 +3222,42 @@ function registerMarketplaceTools(server, ctx, track) {
|
|
|
3235
3222
|
);
|
|
3236
3223
|
return jsonResult({ deleted: data.deleteServiceOffering, id });
|
|
3237
3224
|
} catch (error) {
|
|
3238
|
-
ctx
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3225
|
+
return failure(ctx, "marketplace_delete_offering", "delete service offering", error);
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
);
|
|
3229
|
+
server.registerTool(
|
|
3230
|
+
track(mcpToolName(ctx.productName, "marketplace_stats")),
|
|
3231
|
+
{
|
|
3232
|
+
title: "Marketplace Stats",
|
|
3233
|
+
description: "Counts of providers (total, verified, active) and live offerings, plus the average provider rating.",
|
|
3234
|
+
inputSchema: {}
|
|
3235
|
+
},
|
|
3236
|
+
async () => {
|
|
3237
|
+
try {
|
|
3238
|
+
const data = await ctx.gql.workspace.request(MARKETPLACE_STATS, {});
|
|
3239
|
+
return jsonResult(data.marketplaceStats);
|
|
3240
|
+
} catch (error) {
|
|
3241
|
+
return failure(ctx, "marketplace_stats", "get marketplace stats", error);
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
);
|
|
3245
|
+
server.registerTool(
|
|
3246
|
+
track(mcpToolName(ctx.productName, "marketplace_assign_shipment")),
|
|
3247
|
+
{
|
|
3248
|
+
title: "Assign Provider to Shipment",
|
|
3249
|
+
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.",
|
|
3250
|
+
inputSchema: {
|
|
3251
|
+
shipmentId: zod.z.string().min(1).describe("Shipment ID"),
|
|
3252
|
+
providerId: zod.z.string().min(1).nullable().describe("Service provider ID, or null to clear the carrier")
|
|
3253
|
+
}
|
|
3254
|
+
},
|
|
3255
|
+
async ({ shipmentId, providerId }) => {
|
|
3256
|
+
try {
|
|
3257
|
+
const data = await ctx.gql.workspace.request(ASSIGN_SHIPMENT_SERVICE_PROVIDER, { shipmentId, providerId });
|
|
3258
|
+
return jsonResult(data.assignShipmentServiceProvider);
|
|
3259
|
+
} catch (error) {
|
|
3260
|
+
return failure(ctx, "marketplace_assign_shipment", "assign provider to shipment", error);
|
|
3244
3261
|
}
|
|
3245
3262
|
}
|
|
3246
3263
|
);
|