@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/http.cjs
CHANGED
|
@@ -66,10 +66,15 @@ function containerConfigToV2(p) {
|
|
|
66
66
|
mounts: persistentMount(p.volumeInGb, p.volumeMountPath)
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
function gpuConfigToV2(gpuTypeIds, gpuCount) {
|
|
69
|
+
function gpuConfigToV2(gpuTypeIds, gpuCount, allowedCudaVersions, minCudaVersion2) {
|
|
70
70
|
const id = gpuTypeIds?.[0];
|
|
71
71
|
if (id === void 0) return void 0;
|
|
72
|
-
return {
|
|
72
|
+
return compact({
|
|
73
|
+
id,
|
|
74
|
+
count: gpuCount ?? 1,
|
|
75
|
+
allowedCudaVersions,
|
|
76
|
+
minCudaVersion: minCudaVersion2
|
|
77
|
+
});
|
|
73
78
|
}
|
|
74
79
|
function mapPodCreateToV2(params) {
|
|
75
80
|
return compact({
|
|
@@ -90,7 +95,12 @@ function mapPodCreateToV2(params) {
|
|
|
90
95
|
// singular on v2 (`gpu.id`): gpuConfigToV2 takes the first id; the
|
|
91
96
|
// create-pod handler warns when more than one gpuTypeId was supplied.
|
|
92
97
|
dataCenterIds: params.dataCenterIds?.length ? params.dataCenterIds : void 0,
|
|
93
|
-
gpu: gpuConfigToV2(
|
|
98
|
+
gpu: gpuConfigToV2(
|
|
99
|
+
params.gpuTypeIds,
|
|
100
|
+
params.gpuCount,
|
|
101
|
+
params.allowedCudaVersions,
|
|
102
|
+
params.minCudaVersion
|
|
103
|
+
)
|
|
94
104
|
});
|
|
95
105
|
}
|
|
96
106
|
function mapPodUpdateToV2(params) {
|
|
@@ -107,9 +117,15 @@ function defaultScalerType(endpointType) {
|
|
|
107
117
|
function endpointScaling(scalerType, value) {
|
|
108
118
|
return scalerType === "REQUEST_COUNT" ? { type: "REQUEST_COUNT", requestCount: value } : { type: "QUEUE_DELAY", queueDelay: value };
|
|
109
119
|
}
|
|
110
|
-
function endpointGpuConfig(
|
|
111
|
-
|
|
112
|
-
|
|
120
|
+
function endpointGpuConfig(params, mode) {
|
|
121
|
+
const gpu = compact({
|
|
122
|
+
pools: params.gpuPoolIds?.length ? params.gpuPoolIds : void 0,
|
|
123
|
+
count: params.gpuCount,
|
|
124
|
+
allowedCudaVersions: params.allowedCudaVersions,
|
|
125
|
+
minCudaVersion: params.minCudaVersion
|
|
126
|
+
});
|
|
127
|
+
if (mode === "create" && !("pools" in gpu)) return void 0;
|
|
128
|
+
return Object.keys(gpu).length ? gpu : void 0;
|
|
113
129
|
}
|
|
114
130
|
function endpointWorkers(params) {
|
|
115
131
|
const workers = compact({
|
|
@@ -119,7 +135,7 @@ function endpointWorkers(params) {
|
|
|
119
135
|
});
|
|
120
136
|
return Object.keys(workers).length ? workers : void 0;
|
|
121
137
|
}
|
|
122
|
-
function endpointCommonToV2(params) {
|
|
138
|
+
function endpointCommonToV2(params, mode) {
|
|
123
139
|
return compact({
|
|
124
140
|
name: params.name,
|
|
125
141
|
image: params.imageName,
|
|
@@ -128,7 +144,7 @@ function endpointCommonToV2(params) {
|
|
|
128
144
|
ports: params.ports,
|
|
129
145
|
env: params.env,
|
|
130
146
|
registry: params.containerRegistryAuthId,
|
|
131
|
-
gpu: endpointGpuConfig(params
|
|
147
|
+
gpu: endpointGpuConfig(params, mode),
|
|
132
148
|
workers: endpointWorkers(params),
|
|
133
149
|
dataCenterIds: params.dataCenterIds?.length ? params.dataCenterIds : void 0,
|
|
134
150
|
networkVolumes: params.networkVolumeIds?.length ? params.networkVolumeIds : void 0,
|
|
@@ -139,7 +155,7 @@ function endpointCommonToV2(params) {
|
|
|
139
155
|
function mapEndpointCreateToV2(params) {
|
|
140
156
|
const endpointType = params.endpointType ?? DEFAULT_ENDPOINT_TYPE;
|
|
141
157
|
return compact({
|
|
142
|
-
...endpointCommonToV2(params),
|
|
158
|
+
...endpointCommonToV2(params, "create"),
|
|
143
159
|
type: endpointType,
|
|
144
160
|
scaling: endpointScaling(
|
|
145
161
|
params.scalerType ?? defaultScalerType(endpointType),
|
|
@@ -149,13 +165,28 @@ function mapEndpointCreateToV2(params) {
|
|
|
149
165
|
}
|
|
150
166
|
function mapEndpointUpdateToV2(params) {
|
|
151
167
|
return compact({
|
|
152
|
-
...endpointCommonToV2(params),
|
|
168
|
+
...endpointCommonToV2(params, "update"),
|
|
153
169
|
scaling: params.scalerType ? endpointScaling(
|
|
154
170
|
params.scalerType,
|
|
155
171
|
params.scalerValue ?? DEFAULT_SCALER_VALUE
|
|
156
172
|
) : void 0
|
|
157
173
|
});
|
|
158
174
|
}
|
|
175
|
+
var CUDA_MAJOR_MINOR = /^\d+\.\d+$/;
|
|
176
|
+
function cudaConstraintError(params, opts = {}) {
|
|
177
|
+
const { allowedCudaVersions, minCudaVersion: minCudaVersion2 } = params;
|
|
178
|
+
if (allowedCudaVersions?.length && minCudaVersion2) {
|
|
179
|
+
return "allowedCudaVersions and minCudaVersion are mutually exclusive \u2014 pass either an exact set or an open-ended floor, not both.";
|
|
180
|
+
}
|
|
181
|
+
if (minCudaVersion2 !== void 0 && !CUDA_MAJOR_MINOR.test(minCudaVersion2) && !(opts.allowClear && minCudaVersion2 === "")) {
|
|
182
|
+
return `minCudaVersion must be major.minor (e.g. "12.0", not "12")${opts.allowClear ? "; an empty string clears the floor" : ""}.`;
|
|
183
|
+
}
|
|
184
|
+
const bad = allowedCudaVersions?.find((v) => !CUDA_MAJOR_MINOR.test(v));
|
|
185
|
+
if (bad !== void 0) {
|
|
186
|
+
return `allowedCudaVersions entries must be major.minor (e.g. "12.8"); got "${bad}". Discover valid values via get-capacity or list-gpu-types.`;
|
|
187
|
+
}
|
|
188
|
+
return void 0;
|
|
189
|
+
}
|
|
159
190
|
function mapNetworkVolumeCreateToV2(params) {
|
|
160
191
|
return compact({
|
|
161
192
|
name: params.name,
|
|
@@ -447,7 +478,7 @@ function resolveBackend(opts) {
|
|
|
447
478
|
|
|
448
479
|
// src/server.ts
|
|
449
480
|
var SERVER_NAME = "Runpod API Server";
|
|
450
|
-
var SERVER_VERSION = true ? "3.
|
|
481
|
+
var SERVER_VERSION = true ? "3.4.0" : "dev";
|
|
451
482
|
var SERVER_INSTRUCTIONS = `These tools cover common Runpod operations, but they are curated projections: the underlying APIs expose more fields and parameters than the tools surface.
|
|
452
483
|
|
|
453
484
|
When you need data or capability beyond these tools, consult the full API contracts directly. The REST v2 API lives at https://api.runpod.io/v2 \u2014 the same host these tools call \u2014 and is machine-readable at https://api.runpod.io/v2/openapi.json (fetch and search it to enumerate every path, parameter, and response schema). REST v1 at https://rest.runpod.io/v1 is deprecated; prefer v2. The REST version these tools are actually configured for is reported in the serverInfo.version string of the initialize response, e.g. "[RUNPOD_REST_VERSION=v2]". The GraphQL API at https://api.runpod.io/graphql may expose data the REST API does not yet cover; its schema is documented at https://graphql-spec.runpod.io/, and introspection is disabled in production, so use that reference rather than __schema queries. Both APIs take Bearer auth with a Runpod API key: use the key this client is already configured with \u2014 do not search the environment or filesystem for a credential.`;
|
|
@@ -828,7 +859,7 @@ async function streamLogsReply(rt, tool, params) {
|
|
|
828
859
|
}
|
|
829
860
|
|
|
830
861
|
// src/tools/runtime.ts
|
|
831
|
-
var MCP_SERVER_VERSION = true ? "3.
|
|
862
|
+
var MCP_SERVER_VERSION = true ? "3.4.0" : "dev";
|
|
832
863
|
var SESSION_ID = (0, import_node_crypto.randomUUID)();
|
|
833
864
|
function trackingHeaders(server, ctx) {
|
|
834
865
|
const info = server.server.getClientVersion();
|
|
@@ -1158,16 +1189,47 @@ function registerCatalogTools(server, rt) {
|
|
|
1158
1189
|
),
|
|
1159
1190
|
product: import_zod3.z.enum(["POD", "CLUSTER", "SERVERLESS"]).optional().describe(
|
|
1160
1191
|
"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."
|
|
1192
|
+
),
|
|
1193
|
+
minCudaVersion: import_zod3.z.string().optional().describe(
|
|
1194
|
+
'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).'
|
|
1161
1195
|
)
|
|
1162
1196
|
},
|
|
1163
1197
|
{ title: "List GPU types", ...READ_ONLY },
|
|
1164
1198
|
async (params) => {
|
|
1165
1199
|
const backend = backendFor("gpus");
|
|
1200
|
+
if (params.minCudaVersion !== void 0 && backend.version !== "v2") {
|
|
1201
|
+
return jsonReply2({
|
|
1202
|
+
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.",
|
|
1203
|
+
status: 501
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1166
1206
|
if (backend.version === "v2") {
|
|
1167
1207
|
const wantAvailability = params.includeAvailability !== false;
|
|
1168
1208
|
const product = GPU_PRODUCTS.has(String(params.product)) ? String(params.product) : "POD";
|
|
1209
|
+
if (params.minCudaVersion !== void 0) {
|
|
1210
|
+
if (!wantAvailability) {
|
|
1211
|
+
return jsonReply2({
|
|
1212
|
+
error: "minCudaVersion filters the availability lookup, so it requires includeAvailability (the default). Drop includeAvailability:false or the filter.",
|
|
1213
|
+
status: 400
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
if (!/^\d+(\.\d+)?$/.test(params.minCudaVersion)) {
|
|
1217
|
+
return jsonReply2({
|
|
1218
|
+
error: 'minCudaVersion must be an integer major ("12") or major.minor ("12.1").',
|
|
1219
|
+
status: 400
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
const query = new URLSearchParams();
|
|
1224
|
+
if (wantAvailability) {
|
|
1225
|
+
query.set("include", "AVAILABILITY");
|
|
1226
|
+
query.set("product", product);
|
|
1227
|
+
if (params.minCudaVersion !== void 0) {
|
|
1228
|
+
query.set("minCudaVersion", params.minCudaVersion);
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1169
1231
|
const raw = await callRestUrl(
|
|
1170
|
-
`${backend.base}${backend.list}${
|
|
1232
|
+
`${backend.base}${backend.list}${query.size ? `?${query}` : ""}`
|
|
1171
1233
|
);
|
|
1172
1234
|
let gpus = backend.unwrap(raw);
|
|
1173
1235
|
gpus = gpus.filter((g) => g.id !== "unknown");
|
|
@@ -2265,7 +2327,13 @@ function registerPodTools(server, rt) {
|
|
|
2265
2327
|
containerRegistryAuthId: import_zod7.z.string().optional().describe(
|
|
2266
2328
|
"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)."
|
|
2267
2329
|
),
|
|
2268
|
-
dataCenterIds: import_zod7.z.array(import_zod7.z.string()).optional().describe("List of data centers")
|
|
2330
|
+
dataCenterIds: import_zod7.z.array(import_zod7.z.string()).optional().describe("List of data centers"),
|
|
2331
|
+
allowedCudaVersions: import_zod7.z.array(import_zod7.z.string()).optional().describe(
|
|
2332
|
+
'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.'
|
|
2333
|
+
),
|
|
2334
|
+
minCudaVersion: import_zod7.z.string().optional().describe(
|
|
2335
|
+
'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.'
|
|
2336
|
+
)
|
|
2269
2337
|
},
|
|
2270
2338
|
{ title: "Create pod", ...WRITE },
|
|
2271
2339
|
async (params) => {
|
|
@@ -2279,6 +2347,13 @@ function registerPodTools(server, rt) {
|
|
|
2279
2347
|
sshKey = validated.key;
|
|
2280
2348
|
}
|
|
2281
2349
|
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.";
|
|
2350
|
+
const hasCudaParams = params.allowedCudaVersions !== void 0 || params.minCudaVersion !== void 0;
|
|
2351
|
+
if (hasCudaParams && backend.version !== "v2") {
|
|
2352
|
+
return jsonReply2({
|
|
2353
|
+
error: "allowedCudaVersions/minCudaVersion are only supported on the v2 REST API. Set RUNPOD_REST_VERSION=v2.",
|
|
2354
|
+
status: 501
|
|
2355
|
+
});
|
|
2356
|
+
}
|
|
2282
2357
|
if (params.templateId && backend.version !== "v2") {
|
|
2283
2358
|
return jsonReply2({
|
|
2284
2359
|
error: "Deploying a pod from a templateId is only supported on the v2 REST API. Set RUNPOD_REST_VERSION=v2, or pass imageName instead.",
|
|
@@ -2314,6 +2389,16 @@ function registerPodTools(server, rt) {
|
|
|
2314
2389
|
status: 400
|
|
2315
2390
|
});
|
|
2316
2391
|
}
|
|
2392
|
+
if (hasCudaParams && !wantsGpu) {
|
|
2393
|
+
return jsonReply2({
|
|
2394
|
+
error: "allowedCudaVersions/minCudaVersion apply to GPU pods only \u2014 pass gpuTypeIds (see list-gpu-types).",
|
|
2395
|
+
status: 400
|
|
2396
|
+
});
|
|
2397
|
+
}
|
|
2398
|
+
if (hasCudaParams) {
|
|
2399
|
+
const cudaError = cudaConstraintError(params);
|
|
2400
|
+
if (cudaError) return jsonReply2({ error: cudaError, status: 400 });
|
|
2401
|
+
}
|
|
2317
2402
|
if (!wantsCpu && !params.name && !params.templateId) {
|
|
2318
2403
|
return jsonReply2({
|
|
2319
2404
|
error: "Provide a name for the pod (deploying from a templateId inherits the template name).",
|
|
@@ -2503,6 +2588,9 @@ function registerPodTools(server, rt) {
|
|
|
2503
2588
|
var import_zod8 = require("zod");
|
|
2504
2589
|
var MIN_QUEUE_DELAY = 0.5;
|
|
2505
2590
|
var MIN_REQUEST_COUNT = 1;
|
|
2591
|
+
function isRequestCountScaler(type) {
|
|
2592
|
+
return type === "REQUEST_COUNT";
|
|
2593
|
+
}
|
|
2506
2594
|
var MIN_IDLE_TIMEOUT = 1;
|
|
2507
2595
|
var MAX_IDLE_TIMEOUT = 3600;
|
|
2508
2596
|
function scalerValueError(scalerType, scalerValue) {
|
|
@@ -2595,6 +2683,12 @@ function registerEndpointTools(server, rt) {
|
|
|
2595
2683
|
'GPU pool names (v2, required). The `pool` field from list-gpu-types, e.g. ["AMPERE_80"]. NOT GPU type ids.'
|
|
2596
2684
|
),
|
|
2597
2685
|
gpuCount: import_zod8.z.number().optional().describe("GPUs per worker (v2)"),
|
|
2686
|
+
allowedCudaVersions: import_zod8.z.array(import_zod8.z.string()).optional().describe(
|
|
2687
|
+
'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.'
|
|
2688
|
+
),
|
|
2689
|
+
minCudaVersion: import_zod8.z.string().optional().describe(
|
|
2690
|
+
'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.'
|
|
2691
|
+
),
|
|
2598
2692
|
args: import_zod8.z.string().optional().describe("Container start command/args (v2)"),
|
|
2599
2693
|
containerDiskInGb: import_zod8.z.number().optional().describe("Container disk size in GB (v2)"),
|
|
2600
2694
|
ports: import_zod8.z.array(import_zod8.z.string()).optional().describe("Ports to expose (v2), e.g. ['8000/http']"),
|
|
@@ -2624,6 +2718,13 @@ function registerEndpointTools(server, rt) {
|
|
|
2624
2718
|
{ title: "Create endpoint", ...WRITE },
|
|
2625
2719
|
async (params) => {
|
|
2626
2720
|
const backend = backendFor("endpoints");
|
|
2721
|
+
const hasCudaParams = params.allowedCudaVersions !== void 0 || params.minCudaVersion !== void 0;
|
|
2722
|
+
if (hasCudaParams && backend.version !== "v2") {
|
|
2723
|
+
return jsonReply2({
|
|
2724
|
+
error: "allowedCudaVersions/minCudaVersion are only supported on the v2 REST API. Set RUNPOD_REST_VERSION=v2.",
|
|
2725
|
+
status: 501
|
|
2726
|
+
});
|
|
2727
|
+
}
|
|
2627
2728
|
if (backend.version === "v2") {
|
|
2628
2729
|
if (!params.name) {
|
|
2629
2730
|
return jsonReply2({
|
|
@@ -2656,6 +2757,10 @@ function registerEndpointTools(server, rt) {
|
|
|
2656
2757
|
if (scalerError) {
|
|
2657
2758
|
return jsonReply2({ error: scalerError, status: 400 });
|
|
2658
2759
|
}
|
|
2760
|
+
if (hasCudaParams) {
|
|
2761
|
+
const cudaError = cudaConstraintError(params);
|
|
2762
|
+
if (cudaError) return jsonReply2({ error: cudaError, status: 400 });
|
|
2763
|
+
}
|
|
2659
2764
|
const body = backend.mapCreate(params);
|
|
2660
2765
|
const result2 = await callRestUrl(
|
|
2661
2766
|
`${backend.base}${backend.list}`,
|
|
@@ -2693,7 +2798,7 @@ function registerEndpointTools(server, rt) {
|
|
|
2693
2798
|
);
|
|
2694
2799
|
server.tool(
|
|
2695
2800
|
"update-endpoint",
|
|
2696
|
-
"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.",
|
|
2801
|
+
"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.",
|
|
2697
2802
|
{
|
|
2698
2803
|
endpointId: import_zod8.z.string().describe("ID of the endpoint to update"),
|
|
2699
2804
|
name: import_zod8.z.string().optional().describe("New name for the endpoint"),
|
|
@@ -2712,6 +2817,12 @@ function registerEndpointTools(server, rt) {
|
|
|
2712
2817
|
imageName: import_zod8.z.string().optional().describe("New Docker image (v2)"),
|
|
2713
2818
|
gpuPoolIds: import_zod8.z.array(import_zod8.z.string()).optional().describe('New GPU pool names (v2), e.g. ["AMPERE_80"]'),
|
|
2714
2819
|
gpuCount: import_zod8.z.number().optional().describe("New GPUs per worker (v2)"),
|
|
2820
|
+
allowedCudaVersions: import_zod8.z.array(import_zod8.z.string()).optional().describe(
|
|
2821
|
+
"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."
|
|
2822
|
+
),
|
|
2823
|
+
minCudaVersion: import_zod8.z.string().optional().describe(
|
|
2824
|
+
'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.'
|
|
2825
|
+
),
|
|
2715
2826
|
args: import_zod8.z.string().optional().describe("New container args (v2)"),
|
|
2716
2827
|
containerDiskInGb: import_zod8.z.number().optional().describe("New container disk size in GB (v2)"),
|
|
2717
2828
|
ports: import_zod8.z.array(import_zod8.z.string()).optional().describe("New ports (v2)"),
|
|
@@ -2726,14 +2837,41 @@ function registerEndpointTools(server, rt) {
|
|
|
2726
2837
|
const { endpointId, ...updateParams } = params;
|
|
2727
2838
|
const backend = backendFor("endpoints");
|
|
2728
2839
|
const url = `${backend.base}${backend.get(endpointId)}`;
|
|
2840
|
+
const hasCudaParams = updateParams.allowedCudaVersions !== void 0 || updateParams.minCudaVersion !== void 0;
|
|
2729
2841
|
if (backend.version !== "v2") {
|
|
2842
|
+
if (hasCudaParams) {
|
|
2843
|
+
return jsonReply2({
|
|
2844
|
+
error: "allowedCudaVersions/minCudaVersion are only supported on the v2 REST API. Set RUNPOD_REST_VERSION=v2.",
|
|
2845
|
+
status: 501
|
|
2846
|
+
});
|
|
2847
|
+
}
|
|
2730
2848
|
const body2 = backend.mapUpdate(updateParams);
|
|
2731
2849
|
return jsonReply2(await callRestUrl(url, "PATCH", body2));
|
|
2732
2850
|
}
|
|
2851
|
+
if (hasCudaParams) {
|
|
2852
|
+
const cudaError = cudaConstraintError(updateParams, {
|
|
2853
|
+
allowClear: true
|
|
2854
|
+
});
|
|
2855
|
+
if (cudaError) return jsonReply2({ error: cudaError, status: 400 });
|
|
2856
|
+
}
|
|
2857
|
+
if (updateParams.gpuPoolIds !== void 0 && !updateParams.gpuPoolIds.length) {
|
|
2858
|
+
return jsonReply2({
|
|
2859
|
+
error: "gpuPoolIds cannot be empty \u2014 omit it to keep the current GPU selection.",
|
|
2860
|
+
status: 400
|
|
2861
|
+
});
|
|
2862
|
+
}
|
|
2733
2863
|
let scalerType = updateParams.scalerType;
|
|
2734
|
-
|
|
2864
|
+
const needScalerRead = scalerType === void 0 && updateParams.scalerValue !== void 0;
|
|
2865
|
+
const needExclusionRead = (updateParams.gpuPoolIds?.length ?? 0) > 0;
|
|
2866
|
+
let clearedExclusions = [];
|
|
2867
|
+
if (needScalerRead || needExclusionRead) {
|
|
2735
2868
|
const current = await callRestUrl(url);
|
|
2736
|
-
|
|
2869
|
+
if (needScalerRead) {
|
|
2870
|
+
scalerType = isRequestCountScaler(current?.scaling?.type) ? "REQUEST_COUNT" : "QUEUE_DELAY";
|
|
2871
|
+
}
|
|
2872
|
+
if (needExclusionRead && current?.gpu?.excludedTypes?.length) {
|
|
2873
|
+
clearedExclusions = current.gpu.excludedTypes;
|
|
2874
|
+
}
|
|
2737
2875
|
}
|
|
2738
2876
|
const scalerError = scalerValueError(
|
|
2739
2877
|
scalerType,
|
|
@@ -2746,7 +2884,14 @@ function registerEndpointTools(server, rt) {
|
|
|
2746
2884
|
...updateParams,
|
|
2747
2885
|
scalerType
|
|
2748
2886
|
});
|
|
2749
|
-
|
|
2887
|
+
const result = await callRestUrl(url, "PATCH", body);
|
|
2888
|
+
if (clearedExclusions.length) {
|
|
2889
|
+
return jsonReply2({
|
|
2890
|
+
...result,
|
|
2891
|
+
_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.`
|
|
2892
|
+
});
|
|
2893
|
+
}
|
|
2894
|
+
return jsonReply2(result);
|
|
2750
2895
|
}
|
|
2751
2896
|
);
|
|
2752
2897
|
server.tool(
|