@runpod/mcp-server 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/{chunk-ICUS4KGX.mjs → chunk-G4URDODF.mjs} +163 -18
- package/dist/chunk-G4URDODF.mjs.map +1 -0
- package/dist/http.cjs +163 -18
- package/dist/http.cjs.map +1 -1
- package/dist/http.mjs +2 -2
- package/dist/stdio.cjs +163 -18
- package/dist/stdio.cjs.map +1 -1
- package/dist/stdio.mjs +163 -18
- package/dist/stdio.mjs.map +1 -1
- package/dist/tools.cjs +162 -17
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-ICUS4KGX.mjs.map +0 -1
package/dist/tools.cjs
CHANGED
|
@@ -416,10 +416,15 @@ function containerConfigToV2(p) {
|
|
|
416
416
|
mounts: persistentMount(p.volumeInGb, p.volumeMountPath)
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
|
-
function gpuConfigToV2(gpuTypeIds, gpuCount) {
|
|
419
|
+
function gpuConfigToV2(gpuTypeIds, gpuCount, allowedCudaVersions, minCudaVersion2) {
|
|
420
420
|
const id = gpuTypeIds?.[0];
|
|
421
421
|
if (id === void 0) return void 0;
|
|
422
|
-
return {
|
|
422
|
+
return compact({
|
|
423
|
+
id,
|
|
424
|
+
count: gpuCount ?? 1,
|
|
425
|
+
allowedCudaVersions,
|
|
426
|
+
minCudaVersion: minCudaVersion2
|
|
427
|
+
});
|
|
423
428
|
}
|
|
424
429
|
function mapPodCreateToV2(params) {
|
|
425
430
|
return compact({
|
|
@@ -440,7 +445,12 @@ function mapPodCreateToV2(params) {
|
|
|
440
445
|
// singular on v2 (`gpu.id`): gpuConfigToV2 takes the first id; the
|
|
441
446
|
// create-pod handler warns when more than one gpuTypeId was supplied.
|
|
442
447
|
dataCenterIds: params.dataCenterIds?.length ? params.dataCenterIds : void 0,
|
|
443
|
-
gpu: gpuConfigToV2(
|
|
448
|
+
gpu: gpuConfigToV2(
|
|
449
|
+
params.gpuTypeIds,
|
|
450
|
+
params.gpuCount,
|
|
451
|
+
params.allowedCudaVersions,
|
|
452
|
+
params.minCudaVersion
|
|
453
|
+
)
|
|
444
454
|
});
|
|
445
455
|
}
|
|
446
456
|
function mapPodUpdateToV2(params) {
|
|
@@ -457,9 +467,15 @@ function defaultScalerType(endpointType) {
|
|
|
457
467
|
function endpointScaling(scalerType, value) {
|
|
458
468
|
return scalerType === "REQUEST_COUNT" ? { type: "REQUEST_COUNT", requestCount: value } : { type: "QUEUE_DELAY", queueDelay: value };
|
|
459
469
|
}
|
|
460
|
-
function endpointGpuConfig(
|
|
461
|
-
|
|
462
|
-
|
|
470
|
+
function endpointGpuConfig(params, mode) {
|
|
471
|
+
const gpu = compact({
|
|
472
|
+
pools: params.gpuPoolIds?.length ? params.gpuPoolIds : void 0,
|
|
473
|
+
count: params.gpuCount,
|
|
474
|
+
allowedCudaVersions: params.allowedCudaVersions,
|
|
475
|
+
minCudaVersion: params.minCudaVersion
|
|
476
|
+
});
|
|
477
|
+
if (mode === "create" && !("pools" in gpu)) return void 0;
|
|
478
|
+
return Object.keys(gpu).length ? gpu : void 0;
|
|
463
479
|
}
|
|
464
480
|
function endpointWorkers(params) {
|
|
465
481
|
const workers = compact({
|
|
@@ -469,7 +485,7 @@ function endpointWorkers(params) {
|
|
|
469
485
|
});
|
|
470
486
|
return Object.keys(workers).length ? workers : void 0;
|
|
471
487
|
}
|
|
472
|
-
function endpointCommonToV2(params) {
|
|
488
|
+
function endpointCommonToV2(params, mode) {
|
|
473
489
|
return compact({
|
|
474
490
|
name: params.name,
|
|
475
491
|
image: params.imageName,
|
|
@@ -478,7 +494,7 @@ function endpointCommonToV2(params) {
|
|
|
478
494
|
ports: params.ports,
|
|
479
495
|
env: params.env,
|
|
480
496
|
registry: params.containerRegistryAuthId,
|
|
481
|
-
gpu: endpointGpuConfig(params
|
|
497
|
+
gpu: endpointGpuConfig(params, mode),
|
|
482
498
|
workers: endpointWorkers(params),
|
|
483
499
|
dataCenterIds: params.dataCenterIds?.length ? params.dataCenterIds : void 0,
|
|
484
500
|
networkVolumes: params.networkVolumeIds?.length ? params.networkVolumeIds : void 0,
|
|
@@ -489,7 +505,7 @@ function endpointCommonToV2(params) {
|
|
|
489
505
|
function mapEndpointCreateToV2(params) {
|
|
490
506
|
const endpointType = params.endpointType ?? DEFAULT_ENDPOINT_TYPE;
|
|
491
507
|
return compact({
|
|
492
|
-
...endpointCommonToV2(params),
|
|
508
|
+
...endpointCommonToV2(params, "create"),
|
|
493
509
|
type: endpointType,
|
|
494
510
|
scaling: endpointScaling(
|
|
495
511
|
params.scalerType ?? defaultScalerType(endpointType),
|
|
@@ -499,13 +515,28 @@ function mapEndpointCreateToV2(params) {
|
|
|
499
515
|
}
|
|
500
516
|
function mapEndpointUpdateToV2(params) {
|
|
501
517
|
return compact({
|
|
502
|
-
...endpointCommonToV2(params),
|
|
518
|
+
...endpointCommonToV2(params, "update"),
|
|
503
519
|
scaling: params.scalerType ? endpointScaling(
|
|
504
520
|
params.scalerType,
|
|
505
521
|
params.scalerValue ?? DEFAULT_SCALER_VALUE
|
|
506
522
|
) : void 0
|
|
507
523
|
});
|
|
508
524
|
}
|
|
525
|
+
var CUDA_MAJOR_MINOR = /^\d+\.\d+$/;
|
|
526
|
+
function cudaConstraintError(params, opts = {}) {
|
|
527
|
+
const { allowedCudaVersions, minCudaVersion: minCudaVersion2 } = params;
|
|
528
|
+
if (allowedCudaVersions?.length && minCudaVersion2) {
|
|
529
|
+
return "allowedCudaVersions and minCudaVersion are mutually exclusive \u2014 pass either an exact set or an open-ended floor, not both.";
|
|
530
|
+
}
|
|
531
|
+
if (minCudaVersion2 !== void 0 && !CUDA_MAJOR_MINOR.test(minCudaVersion2) && !(opts.allowClear && minCudaVersion2 === "")) {
|
|
532
|
+
return `minCudaVersion must be major.minor (e.g. "12.0", not "12")${opts.allowClear ? "; an empty string clears the floor" : ""}.`;
|
|
533
|
+
}
|
|
534
|
+
const bad = allowedCudaVersions?.find((v) => !CUDA_MAJOR_MINOR.test(v));
|
|
535
|
+
if (bad !== void 0) {
|
|
536
|
+
return `allowedCudaVersions entries must be major.minor (e.g. "12.8"); got "${bad}". Discover valid values via get-capacity or list-gpu-types.`;
|
|
537
|
+
}
|
|
538
|
+
return void 0;
|
|
539
|
+
}
|
|
509
540
|
function mapNetworkVolumeCreateToV2(params) {
|
|
510
541
|
return compact({
|
|
511
542
|
name: params.name,
|
|
@@ -788,7 +819,7 @@ function resolveBackend(opts) {
|
|
|
788
819
|
}
|
|
789
820
|
|
|
790
821
|
// src/tools/runtime.ts
|
|
791
|
-
var MCP_SERVER_VERSION = true ? "3.
|
|
822
|
+
var MCP_SERVER_VERSION = true ? "3.4.0" : "dev";
|
|
792
823
|
var SESSION_ID = (0, import_node_crypto.randomUUID)();
|
|
793
824
|
function trackingHeaders(server, ctx) {
|
|
794
825
|
const info = server.server.getClientVersion();
|
|
@@ -1118,16 +1149,47 @@ function registerCatalogTools(server, rt) {
|
|
|
1118
1149
|
),
|
|
1119
1150
|
product: import_zod3.z.enum(["POD", "CLUSTER", "SERVERLESS"]).optional().describe(
|
|
1120
1151
|
"Product context for the availability lookup \u2014 the same GPU can be scarce for Pods and plentiful for Serverless. Default POD. Use SERVERLESS when picking a GPU for an endpoint, CLUSTER for Instant Clusters. Ignored when includeAvailability is false."
|
|
1152
|
+
),
|
|
1153
|
+
minCudaVersion: import_zod3.z.string().optional().describe(
|
|
1154
|
+
'Scope the availability lookup to hosts at or above this CUDA version (v2 only). Integer major or major.minor \u2014 "12" means any 12.x release; unlike the create-pod/create-endpoint body fields, a bare major is accepted here because the filter only widens a read. Requires includeAvailability (the default).'
|
|
1121
1155
|
)
|
|
1122
1156
|
},
|
|
1123
1157
|
{ title: "List GPU types", ...READ_ONLY },
|
|
1124
1158
|
async (params) => {
|
|
1125
1159
|
const backend = backendFor("gpus");
|
|
1160
|
+
if (params.minCudaVersion !== void 0 && backend.version !== "v2") {
|
|
1161
|
+
return jsonReply2({
|
|
1162
|
+
error: "The minCudaVersion filter is only supported on the v2 REST API. Set RUNPOD_REST_VERSION=v2, or use get-capacity for per-CUDA-version availability.",
|
|
1163
|
+
status: 501
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1126
1166
|
if (backend.version === "v2") {
|
|
1127
1167
|
const wantAvailability = params.includeAvailability !== false;
|
|
1128
1168
|
const product = GPU_PRODUCTS.has(String(params.product)) ? String(params.product) : "POD";
|
|
1169
|
+
if (params.minCudaVersion !== void 0) {
|
|
1170
|
+
if (!wantAvailability) {
|
|
1171
|
+
return jsonReply2({
|
|
1172
|
+
error: "minCudaVersion filters the availability lookup, so it requires includeAvailability (the default). Drop includeAvailability:false or the filter.",
|
|
1173
|
+
status: 400
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
if (!/^\d+(\.\d+)?$/.test(params.minCudaVersion)) {
|
|
1177
|
+
return jsonReply2({
|
|
1178
|
+
error: 'minCudaVersion must be an integer major ("12") or major.minor ("12.1").',
|
|
1179
|
+
status: 400
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
const query = new URLSearchParams();
|
|
1184
|
+
if (wantAvailability) {
|
|
1185
|
+
query.set("include", "AVAILABILITY");
|
|
1186
|
+
query.set("product", product);
|
|
1187
|
+
if (params.minCudaVersion !== void 0) {
|
|
1188
|
+
query.set("minCudaVersion", params.minCudaVersion);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1129
1191
|
const raw = await callRestUrl(
|
|
1130
|
-
`${backend.base}${backend.list}${
|
|
1192
|
+
`${backend.base}${backend.list}${query.size ? `?${query}` : ""}`
|
|
1131
1193
|
);
|
|
1132
1194
|
let gpus = backend.unwrap(raw);
|
|
1133
1195
|
gpus = gpus.filter((g) => g.id !== "unknown");
|
|
@@ -2225,7 +2287,13 @@ function registerPodTools(server, rt) {
|
|
|
2225
2287
|
containerRegistryAuthId: import_zod7.z.string().optional().describe(
|
|
2226
2288
|
"Container registry credential ID for pulling a private image (see list-container-registry-auths). When deploying from a templateId, this overrides the credential the template carries; pass an empty string to deploy with NO credential (clears a template\u2019s inherited registry)."
|
|
2227
2289
|
),
|
|
2228
|
-
dataCenterIds: import_zod7.z.array(import_zod7.z.string()).optional().describe("List of data centers")
|
|
2290
|
+
dataCenterIds: import_zod7.z.array(import_zod7.z.string()).optional().describe("List of data centers"),
|
|
2291
|
+
allowedCudaVersions: import_zod7.z.array(import_zod7.z.string()).optional().describe(
|
|
2292
|
+
'Acceptable host CUDA versions as major.minor, e.g. ["12.8","12.6"] (v2, GPU pods only). Exact match \u2014 discover valid values per GPU type with get-capacity. Mutually exclusive with minCudaVersion.'
|
|
2293
|
+
),
|
|
2294
|
+
minCudaVersion: import_zod7.z.string().optional().describe(
|
|
2295
|
+
'Lowest acceptable host CUDA version as major.minor, e.g. "12.4" (v2, GPU pods only). A bare major like "12" is rejected. Open-ended floor; mutually exclusive with a non-empty allowedCudaVersions.'
|
|
2296
|
+
)
|
|
2229
2297
|
},
|
|
2230
2298
|
{ title: "Create pod", ...WRITE },
|
|
2231
2299
|
async (params) => {
|
|
@@ -2239,6 +2307,13 @@ function registerPodTools(server, rt) {
|
|
|
2239
2307
|
sshKey = validated.key;
|
|
2240
2308
|
}
|
|
2241
2309
|
const sshNote = "sshPublicKey applied: PUBLIC_KEY env set and 22/tcp exposed. Full SSH (incl. SCP/SFTP/rsync) also requires an image that installs PUBLIC_KEY into authorized_keys and starts sshd (all runpod/* official images do) and a machine with a public IP \u2014 read the pod\u2019s portMappings for port 22 once it is running.";
|
|
2310
|
+
const hasCudaParams = params.allowedCudaVersions !== void 0 || params.minCudaVersion !== void 0;
|
|
2311
|
+
if (hasCudaParams && backend.version !== "v2") {
|
|
2312
|
+
return jsonReply2({
|
|
2313
|
+
error: "allowedCudaVersions/minCudaVersion are only supported on the v2 REST API. Set RUNPOD_REST_VERSION=v2.",
|
|
2314
|
+
status: 501
|
|
2315
|
+
});
|
|
2316
|
+
}
|
|
2242
2317
|
if (params.templateId && backend.version !== "v2") {
|
|
2243
2318
|
return jsonReply2({
|
|
2244
2319
|
error: "Deploying a pod from a templateId is only supported on the v2 REST API. Set RUNPOD_REST_VERSION=v2, or pass imageName instead.",
|
|
@@ -2274,6 +2349,16 @@ function registerPodTools(server, rt) {
|
|
|
2274
2349
|
status: 400
|
|
2275
2350
|
});
|
|
2276
2351
|
}
|
|
2352
|
+
if (hasCudaParams && !wantsGpu) {
|
|
2353
|
+
return jsonReply2({
|
|
2354
|
+
error: "allowedCudaVersions/minCudaVersion apply to GPU pods only \u2014 pass gpuTypeIds (see list-gpu-types).",
|
|
2355
|
+
status: 400
|
|
2356
|
+
});
|
|
2357
|
+
}
|
|
2358
|
+
if (hasCudaParams) {
|
|
2359
|
+
const cudaError = cudaConstraintError(params);
|
|
2360
|
+
if (cudaError) return jsonReply2({ error: cudaError, status: 400 });
|
|
2361
|
+
}
|
|
2277
2362
|
if (!wantsCpu && !params.name && !params.templateId) {
|
|
2278
2363
|
return jsonReply2({
|
|
2279
2364
|
error: "Provide a name for the pod (deploying from a templateId inherits the template name).",
|
|
@@ -2463,6 +2548,9 @@ function registerPodTools(server, rt) {
|
|
|
2463
2548
|
var import_zod8 = require("zod");
|
|
2464
2549
|
var MIN_QUEUE_DELAY = 0.5;
|
|
2465
2550
|
var MIN_REQUEST_COUNT = 1;
|
|
2551
|
+
function isRequestCountScaler(type) {
|
|
2552
|
+
return type === "REQUEST_COUNT";
|
|
2553
|
+
}
|
|
2466
2554
|
var MIN_IDLE_TIMEOUT = 1;
|
|
2467
2555
|
var MAX_IDLE_TIMEOUT = 3600;
|
|
2468
2556
|
function scalerValueError(scalerType, scalerValue) {
|
|
@@ -2555,6 +2643,12 @@ function registerEndpointTools(server, rt) {
|
|
|
2555
2643
|
'GPU pool names (v2, required). The `pool` field from list-gpu-types, e.g. ["AMPERE_80"]. NOT GPU type ids.'
|
|
2556
2644
|
),
|
|
2557
2645
|
gpuCount: import_zod8.z.number().optional().describe("GPUs per worker (v2)"),
|
|
2646
|
+
allowedCudaVersions: import_zod8.z.array(import_zod8.z.string()).optional().describe(
|
|
2647
|
+
'Acceptable host CUDA versions for worker placement as major.minor, e.g. ["12.8"] (v2). Exact match \u2014 see get-capacity for which versions have stock. Mutually exclusive with minCudaVersion.'
|
|
2648
|
+
),
|
|
2649
|
+
minCudaVersion: import_zod8.z.string().optional().describe(
|
|
2650
|
+
'Lowest acceptable host CUDA version as major.minor, e.g. "12.4" (v2). A bare major like "12" is rejected. Mutually exclusive with a non-empty allowedCudaVersions.'
|
|
2651
|
+
),
|
|
2558
2652
|
args: import_zod8.z.string().optional().describe("Container start command/args (v2)"),
|
|
2559
2653
|
containerDiskInGb: import_zod8.z.number().optional().describe("Container disk size in GB (v2)"),
|
|
2560
2654
|
ports: import_zod8.z.array(import_zod8.z.string()).optional().describe("Ports to expose (v2), e.g. ['8000/http']"),
|
|
@@ -2584,6 +2678,13 @@ function registerEndpointTools(server, rt) {
|
|
|
2584
2678
|
{ title: "Create endpoint", ...WRITE },
|
|
2585
2679
|
async (params) => {
|
|
2586
2680
|
const backend = backendFor("endpoints");
|
|
2681
|
+
const hasCudaParams = params.allowedCudaVersions !== void 0 || params.minCudaVersion !== void 0;
|
|
2682
|
+
if (hasCudaParams && backend.version !== "v2") {
|
|
2683
|
+
return jsonReply2({
|
|
2684
|
+
error: "allowedCudaVersions/minCudaVersion are only supported on the v2 REST API. Set RUNPOD_REST_VERSION=v2.",
|
|
2685
|
+
status: 501
|
|
2686
|
+
});
|
|
2687
|
+
}
|
|
2587
2688
|
if (backend.version === "v2") {
|
|
2588
2689
|
if (!params.name) {
|
|
2589
2690
|
return jsonReply2({
|
|
@@ -2616,6 +2717,10 @@ function registerEndpointTools(server, rt) {
|
|
|
2616
2717
|
if (scalerError) {
|
|
2617
2718
|
return jsonReply2({ error: scalerError, status: 400 });
|
|
2618
2719
|
}
|
|
2720
|
+
if (hasCudaParams) {
|
|
2721
|
+
const cudaError = cudaConstraintError(params);
|
|
2722
|
+
if (cudaError) return jsonReply2({ error: cudaError, status: 400 });
|
|
2723
|
+
}
|
|
2619
2724
|
const body = backend.mapCreate(params);
|
|
2620
2725
|
const result2 = await callRestUrl(
|
|
2621
2726
|
`${backend.base}${backend.list}`,
|
|
@@ -2653,7 +2758,7 @@ function registerEndpointTools(server, rt) {
|
|
|
2653
2758
|
);
|
|
2654
2759
|
server.tool(
|
|
2655
2760
|
"update-endpoint",
|
|
2656
|
-
"Update a Serverless endpoint's config. On v2 you can change image/disk/env/ports/registry/workers/scaling/networkVolumes/timeout/flashboot; on v1, scaling fields (worker min/max, idle timeout, scaler type/value, name). Only provided fields change. An endpoint's request routing (queue vs load balancer) is fixed at creation and cannot be changed here \u2014 recreate the endpoint instead.",
|
|
2761
|
+
"Update a Serverless endpoint's config. On v2 you can change image/disk/env/ports/registry/workers/scaling/networkVolumes/timeout/flashboot, plus the GPU selection (gpuPoolIds/gpuCount) and its CUDA constraints (allowedCudaVersions/minCudaVersion) \u2014 CUDA-only or count-only changes do not require resending gpuPoolIds; on v1, scaling fields (worker min/max, idle timeout, scaler type/value, name). Only provided fields change. An endpoint's request routing (queue vs load balancer) is fixed at creation and cannot be changed here \u2014 recreate the endpoint instead. Note: passing gpuPoolIds replaces the GPU selection wholesale, which clears any GPU-type exclusions set elsewhere (console or set-endpoint-gpus) \u2014 the reply carries a _warning when that happens.",
|
|
2657
2762
|
{
|
|
2658
2763
|
endpointId: import_zod8.z.string().describe("ID of the endpoint to update"),
|
|
2659
2764
|
name: import_zod8.z.string().optional().describe("New name for the endpoint"),
|
|
@@ -2672,6 +2777,12 @@ function registerEndpointTools(server, rt) {
|
|
|
2672
2777
|
imageName: import_zod8.z.string().optional().describe("New Docker image (v2)"),
|
|
2673
2778
|
gpuPoolIds: import_zod8.z.array(import_zod8.z.string()).optional().describe('New GPU pool names (v2), e.g. ["AMPERE_80"]'),
|
|
2674
2779
|
gpuCount: import_zod8.z.number().optional().describe("New GPUs per worker (v2)"),
|
|
2780
|
+
allowedCudaVersions: import_zod8.z.array(import_zod8.z.string()).optional().describe(
|
|
2781
|
+
"New acceptable host CUDA versions as major.minor (v2). Changing only this does not require resending gpuPoolIds. An explicit [] clears the constraint. Mutually exclusive with minCudaVersion."
|
|
2782
|
+
),
|
|
2783
|
+
minCudaVersion: import_zod8.z.string().optional().describe(
|
|
2784
|
+
'New lowest acceptable host CUDA version as major.minor (v2). An empty string clears the floor; a bare major like "12" is rejected. Mutually exclusive with a non-empty allowedCudaVersions.'
|
|
2785
|
+
),
|
|
2675
2786
|
args: import_zod8.z.string().optional().describe("New container args (v2)"),
|
|
2676
2787
|
containerDiskInGb: import_zod8.z.number().optional().describe("New container disk size in GB (v2)"),
|
|
2677
2788
|
ports: import_zod8.z.array(import_zod8.z.string()).optional().describe("New ports (v2)"),
|
|
@@ -2686,14 +2797,41 @@ function registerEndpointTools(server, rt) {
|
|
|
2686
2797
|
const { endpointId, ...updateParams } = params;
|
|
2687
2798
|
const backend = backendFor("endpoints");
|
|
2688
2799
|
const url = `${backend.base}${backend.get(endpointId)}`;
|
|
2800
|
+
const hasCudaParams = updateParams.allowedCudaVersions !== void 0 || updateParams.minCudaVersion !== void 0;
|
|
2689
2801
|
if (backend.version !== "v2") {
|
|
2802
|
+
if (hasCudaParams) {
|
|
2803
|
+
return jsonReply2({
|
|
2804
|
+
error: "allowedCudaVersions/minCudaVersion are only supported on the v2 REST API. Set RUNPOD_REST_VERSION=v2.",
|
|
2805
|
+
status: 501
|
|
2806
|
+
});
|
|
2807
|
+
}
|
|
2690
2808
|
const body2 = backend.mapUpdate(updateParams);
|
|
2691
2809
|
return jsonReply2(await callRestUrl(url, "PATCH", body2));
|
|
2692
2810
|
}
|
|
2811
|
+
if (hasCudaParams) {
|
|
2812
|
+
const cudaError = cudaConstraintError(updateParams, {
|
|
2813
|
+
allowClear: true
|
|
2814
|
+
});
|
|
2815
|
+
if (cudaError) return jsonReply2({ error: cudaError, status: 400 });
|
|
2816
|
+
}
|
|
2817
|
+
if (updateParams.gpuPoolIds !== void 0 && !updateParams.gpuPoolIds.length) {
|
|
2818
|
+
return jsonReply2({
|
|
2819
|
+
error: "gpuPoolIds cannot be empty \u2014 omit it to keep the current GPU selection.",
|
|
2820
|
+
status: 400
|
|
2821
|
+
});
|
|
2822
|
+
}
|
|
2693
2823
|
let scalerType = updateParams.scalerType;
|
|
2694
|
-
|
|
2824
|
+
const needScalerRead = scalerType === void 0 && updateParams.scalerValue !== void 0;
|
|
2825
|
+
const needExclusionRead = (updateParams.gpuPoolIds?.length ?? 0) > 0;
|
|
2826
|
+
let clearedExclusions = [];
|
|
2827
|
+
if (needScalerRead || needExclusionRead) {
|
|
2695
2828
|
const current = await callRestUrl(url);
|
|
2696
|
-
|
|
2829
|
+
if (needScalerRead) {
|
|
2830
|
+
scalerType = isRequestCountScaler(current?.scaling?.type) ? "REQUEST_COUNT" : "QUEUE_DELAY";
|
|
2831
|
+
}
|
|
2832
|
+
if (needExclusionRead && current?.gpu?.excludedTypes?.length) {
|
|
2833
|
+
clearedExclusions = current.gpu.excludedTypes;
|
|
2834
|
+
}
|
|
2697
2835
|
}
|
|
2698
2836
|
const scalerError = scalerValueError(
|
|
2699
2837
|
scalerType,
|
|
@@ -2706,7 +2844,14 @@ function registerEndpointTools(server, rt) {
|
|
|
2706
2844
|
...updateParams,
|
|
2707
2845
|
scalerType
|
|
2708
2846
|
});
|
|
2709
|
-
|
|
2847
|
+
const result = await callRestUrl(url, "PATCH", body);
|
|
2848
|
+
if (clearedExclusions.length) {
|
|
2849
|
+
return jsonReply2({
|
|
2850
|
+
...result,
|
|
2851
|
+
_warning: `Supplying gpuPoolIds replaced the GPU selection wholesale, clearing ${clearedExclusions.length} GPU-type exclusion(s) previously set on this endpoint: ${clearedExclusions.join(", ")}. Re-apply them with set-endpoint-gpus if still wanted.`
|
|
2852
|
+
});
|
|
2853
|
+
}
|
|
2854
|
+
return jsonReply2(result);
|
|
2710
2855
|
}
|
|
2711
2856
|
);
|
|
2712
2857
|
server.tool(
|