@runpod/mcp-server 1.3.0 → 1.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/dist/tools.cjs CHANGED
@@ -33,13 +33,72 @@ __export(tools_exports, {
33
33
  registerTools: () => registerTools
34
34
  });
35
35
  module.exports = __toCommonJS(tools_exports);
36
- var import_zod = require("zod");
36
+ var import_zod2 = require("zod");
37
37
  var import_node_fetch = __toESM(require("node-fetch"), 1);
38
38
  var import_node_crypto = require("crypto");
39
+
40
+ // src/pagination.ts
41
+ var import_zod = require("zod");
42
+ var DEFAULT_LIST_LIMIT = 20;
43
+ var MAX_LIST_LIMIT = 100;
44
+ var listPaginationParams = {
45
+ limit: import_zod.z.number().int().positive().max(MAX_LIST_LIMIT).optional().describe(
46
+ `Maximum number of items to return (default ${DEFAULT_LIST_LIMIT}, max ${MAX_LIST_LIMIT}). Use the returned nextCursor to fetch the next page.`
47
+ ),
48
+ cursor: import_zod.z.string().optional().describe(
49
+ "Opaque pagination cursor from a previous response (nextCursor). Omit to start from the beginning."
50
+ )
51
+ };
52
+ function decodeCursorOffset(cursor) {
53
+ if (!cursor) return 0;
54
+ try {
55
+ const decoded = Buffer.from(cursor, "base64").toString("utf8");
56
+ const offset = Number.parseInt(decoded, 10);
57
+ return Number.isFinite(offset) && offset >= 0 ? offset : 0;
58
+ } catch {
59
+ return 0;
60
+ }
61
+ }
62
+ function encodeCursorOffset(offset) {
63
+ return Buffer.from(String(offset), "utf8").toString("base64");
64
+ }
65
+ function capListResult(result, options) {
66
+ const limit = Math.min(options.limit ?? DEFAULT_LIST_LIMIT, MAX_LIST_LIMIT);
67
+ const offset = decodeCursorOffset(options.cursor);
68
+ if (!Array.isArray(result)) {
69
+ return {
70
+ content: [
71
+ { type: "text", text: JSON.stringify(result, null, 2) }
72
+ ]
73
+ };
74
+ }
75
+ const total = result.length;
76
+ const page = result.slice(offset, offset + limit);
77
+ const nextOffset = offset + page.length;
78
+ const hasMore = nextOffset < total;
79
+ const envelope = {
80
+ items: page,
81
+ pagination: {
82
+ total,
83
+ returned: page.length,
84
+ offset,
85
+ truncated: hasMore,
86
+ nextCursor: hasMore ? encodeCursorOffset(nextOffset) : null,
87
+ note: hasMore ? `Showing ${page.length} of ${total}. Pass cursor=nextCursor to fetch more, or narrow the query with filters.` : void 0
88
+ }
89
+ };
90
+ return {
91
+ content: [
92
+ { type: "text", text: JSON.stringify(envelope, null, 2) }
93
+ ]
94
+ };
95
+ }
96
+
97
+ // src/tools.ts
39
98
  var API_BASE_URL = process.env.RUNPOD_REST_API_URL ?? "https://rest.runpod.io/v1";
40
99
  var SERVERLESS_API_BASE_URL = process.env.RUNPOD_SERVERLESS_API_URL ?? "https://api.runpod.ai/v2";
41
100
  var GRAPHQL_URL = process.env.RUNPOD_PUBLIC_GRAPHQL_URL ?? "https://api.runpod.io/graphql";
42
- var MCP_SERVER_VERSION = true ? "1.3.0" : "dev";
101
+ var MCP_SERVER_VERSION = true ? "1.4.0" : "dev";
43
102
  var SESSION_ID = (0, import_node_crypto.randomUUID)();
44
103
  function sanitizeUaToken(value) {
45
104
  return value.replace(/[()<>@,;:\\"/[\]?={}\s]/g, "_").slice(0, 64);
@@ -149,13 +208,13 @@ function registerTools(server, ctx) {
149
208
  server.tool(
150
209
  "list-gpu-types",
151
210
  {
152
- minMemoryGb: import_zod.z.number().optional().describe("Filter to GPUs with at least this much VRAM in GB"),
153
- secureCloudOnly: import_zod.z.boolean().optional().describe("Filter to only GPUs available in secure cloud"),
154
- communityCloudOnly: import_zod.z.boolean().optional().describe("Filter to only GPUs available in community cloud"),
155
- searchTerm: import_zod.z.string().optional().describe(
211
+ minMemoryGb: import_zod2.z.number().optional().describe("Filter to GPUs with at least this much VRAM in GB"),
212
+ secureCloudOnly: import_zod2.z.boolean().optional().describe("Filter to only GPUs available in secure cloud"),
213
+ communityCloudOnly: import_zod2.z.boolean().optional().describe("Filter to only GPUs available in community cloud"),
214
+ searchTerm: import_zod2.z.string().optional().describe(
156
215
  "Search term to filter GPUs by name (e.g., 'A100', 'RTX 4090')"
157
216
  ),
158
- includeUnavailable: import_zod.z.boolean().optional().describe(
217
+ includeUnavailable: import_zod2.z.boolean().optional().describe(
159
218
  "Include GPUs that are currently out of stock. Default is false"
160
219
  )
161
220
  },
@@ -235,7 +294,7 @@ function registerTools(server, ctx) {
235
294
  server.tool(
236
295
  "list-data-centers",
237
296
  {
238
- region: import_zod.z.string().optional().describe(
297
+ region: import_zod2.z.string().optional().describe(
239
298
  "Filter by region/location (e.g., 'United States', 'Europe', 'Canada')"
240
299
  )
241
300
  },
@@ -272,12 +331,13 @@ function registerTools(server, ctx) {
272
331
  server.tool(
273
332
  "list-pods",
274
333
  {
275
- computeType: import_zod.z.enum(["GPU", "CPU"]).optional().describe("Filter to only GPU or only CPU Pods"),
276
- gpuTypeId: import_zod.z.array(import_zod.z.string()).optional().describe("Filter to Pods with any of the listed GPU types"),
277
- dataCenterId: import_zod.z.array(import_zod.z.string()).optional().describe("Filter to Pods in any of the provided data centers"),
278
- name: import_zod.z.string().optional().describe("Filter to Pods with the provided name"),
279
- includeMachine: import_zod.z.boolean().optional().describe("Include information about the machine"),
280
- includeNetworkVolume: import_zod.z.boolean().optional().describe("Include information about attached network volumes")
334
+ ...listPaginationParams,
335
+ computeType: import_zod2.z.enum(["GPU", "CPU"]).optional().describe("Filter to only GPU or only CPU Pods"),
336
+ gpuTypeId: import_zod2.z.array(import_zod2.z.string()).optional().describe("Filter to Pods with any of the listed GPU types"),
337
+ dataCenterId: import_zod2.z.array(import_zod2.z.string()).optional().describe("Filter to Pods in any of the provided data centers"),
338
+ name: import_zod2.z.string().optional().describe("Filter to Pods with the provided name"),
339
+ includeMachine: import_zod2.z.boolean().optional().describe("Include information about the machine"),
340
+ includeNetworkVolume: import_zod2.z.boolean().optional().describe("Include information about attached network volumes")
281
341
  },
282
342
  async (params) => {
283
343
  const queryParams = new URLSearchParams();
@@ -301,22 +361,18 @@ function registerTools(server, ctx) {
301
361
  );
302
362
  const queryString = queryParams.toString() ? `?${queryParams.toString()}` : "";
303
363
  const result = await runpodRequest(`/pods${queryString}`);
304
- return {
305
- content: [
306
- {
307
- type: "text",
308
- text: JSON.stringify(result, null, 2)
309
- }
310
- ]
311
- };
364
+ return capListResult(result, {
365
+ limit: params.limit,
366
+ cursor: params.cursor
367
+ });
312
368
  }
313
369
  );
314
370
  server.tool(
315
371
  "get-pod",
316
372
  {
317
- podId: import_zod.z.string().describe("ID of the pod to retrieve"),
318
- includeMachine: import_zod.z.boolean().optional().describe("Include information about the machine"),
319
- includeNetworkVolume: import_zod.z.boolean().optional().describe("Include information about attached network volumes")
373
+ podId: import_zod2.z.string().describe("ID of the pod to retrieve"),
374
+ includeMachine: import_zod2.z.boolean().optional().describe("Include information about the machine"),
375
+ includeNetworkVolume: import_zod2.z.boolean().optional().describe("Include information about attached network volumes")
320
376
  },
321
377
  async (params) => {
322
378
  const queryParams = new URLSearchParams();
@@ -343,17 +399,17 @@ function registerTools(server, ctx) {
343
399
  "create-pod",
344
400
  'Create a new GPU/CPU pod on Runpod. If the user does not specify an image, recommend the "Runpod Pytorch 2.8.0" image (runpod/pytorch:1.0.2-cu1281-torch280-ubuntu2404) as the default \u2014 it has the most up-to-date CUDA and PyTorch versions.',
345
401
  {
346
- name: import_zod.z.string().optional().describe("Name for the pod"),
347
- imageName: import_zod.z.string().describe("Docker image to use"),
348
- cloudType: import_zod.z.enum(["SECURE", "COMMUNITY"]).optional().describe("SECURE or COMMUNITY cloud"),
349
- gpuTypeIds: import_zod.z.array(import_zod.z.string()).optional().describe("List of acceptable GPU types"),
350
- gpuCount: import_zod.z.number().optional().describe("Number of GPUs"),
351
- containerDiskInGb: import_zod.z.number().optional().describe("Container disk size in GB"),
352
- volumeInGb: import_zod.z.number().optional().describe("Volume size in GB"),
353
- volumeMountPath: import_zod.z.string().optional().describe("Path to mount the volume"),
354
- ports: import_zod.z.array(import_zod.z.string()).optional().describe("Ports to expose (e.g., '8888/http', '22/tcp')"),
355
- env: import_zod.z.record(import_zod.z.string()).optional().describe("Environment variables"),
356
- dataCenterIds: import_zod.z.array(import_zod.z.string()).optional().describe("List of data centers")
402
+ name: import_zod2.z.string().optional().describe("Name for the pod"),
403
+ imageName: import_zod2.z.string().describe("Docker image to use"),
404
+ cloudType: import_zod2.z.enum(["SECURE", "COMMUNITY"]).optional().describe("SECURE or COMMUNITY cloud"),
405
+ gpuTypeIds: import_zod2.z.array(import_zod2.z.string()).optional().describe("List of acceptable GPU types"),
406
+ gpuCount: import_zod2.z.number().optional().describe("Number of GPUs"),
407
+ containerDiskInGb: import_zod2.z.number().optional().describe("Container disk size in GB"),
408
+ volumeInGb: import_zod2.z.number().optional().describe("Volume size in GB"),
409
+ volumeMountPath: import_zod2.z.string().optional().describe("Path to mount the volume"),
410
+ ports: import_zod2.z.array(import_zod2.z.string()).optional().describe("Ports to expose (e.g., '8888/http', '22/tcp')"),
411
+ env: import_zod2.z.record(import_zod2.z.string()).optional().describe("Environment variables"),
412
+ dataCenterIds: import_zod2.z.array(import_zod2.z.string()).optional().describe("List of data centers")
357
413
  },
358
414
  async (params) => {
359
415
  const result = await runpodRequest("/pods", "POST", params);
@@ -370,14 +426,14 @@ function registerTools(server, ctx) {
370
426
  server.tool(
371
427
  "update-pod",
372
428
  {
373
- podId: import_zod.z.string().describe("ID of the pod to update"),
374
- name: import_zod.z.string().optional().describe("New name for the pod"),
375
- imageName: import_zod.z.string().optional().describe("New Docker image"),
376
- containerDiskInGb: import_zod.z.number().optional().describe("New container disk size in GB"),
377
- volumeInGb: import_zod.z.number().optional().describe("New volume size in GB"),
378
- volumeMountPath: import_zod.z.string().optional().describe("New path to mount the volume"),
379
- ports: import_zod.z.array(import_zod.z.string()).optional().describe("New ports to expose"),
380
- env: import_zod.z.record(import_zod.z.string()).optional().describe("New environment variables")
429
+ podId: import_zod2.z.string().describe("ID of the pod to update"),
430
+ name: import_zod2.z.string().optional().describe("New name for the pod"),
431
+ imageName: import_zod2.z.string().optional().describe("New Docker image"),
432
+ containerDiskInGb: import_zod2.z.number().optional().describe("New container disk size in GB"),
433
+ volumeInGb: import_zod2.z.number().optional().describe("New volume size in GB"),
434
+ volumeMountPath: import_zod2.z.string().optional().describe("New path to mount the volume"),
435
+ ports: import_zod2.z.array(import_zod2.z.string()).optional().describe("New ports to expose"),
436
+ env: import_zod2.z.record(import_zod2.z.string()).optional().describe("New environment variables")
381
437
  },
382
438
  async (params) => {
383
439
  const { podId, ...updateParams } = params;
@@ -399,7 +455,7 @@ function registerTools(server, ctx) {
399
455
  server.tool(
400
456
  "start-pod",
401
457
  {
402
- podId: import_zod.z.string().describe("ID of the pod to start")
458
+ podId: import_zod2.z.string().describe("ID of the pod to start")
403
459
  },
404
460
  async (params) => {
405
461
  const result = await runpodRequest(`/pods/${params.podId}/start`, "POST");
@@ -416,7 +472,7 @@ function registerTools(server, ctx) {
416
472
  server.tool(
417
473
  "stop-pod",
418
474
  {
419
- podId: import_zod.z.string().describe("ID of the pod to stop")
475
+ podId: import_zod2.z.string().describe("ID of the pod to stop")
420
476
  },
421
477
  async (params) => {
422
478
  const result = await runpodRequest(`/pods/${params.podId}/stop`, "POST");
@@ -433,7 +489,7 @@ function registerTools(server, ctx) {
433
489
  server.tool(
434
490
  "delete-pod",
435
491
  {
436
- podId: import_zod.z.string().describe("ID of the pod to delete")
492
+ podId: import_zod2.z.string().describe("ID of the pod to delete")
437
493
  },
438
494
  async (params) => {
439
495
  const result = await runpodRequest(`/pods/${params.podId}`, "DELETE");
@@ -450,8 +506,9 @@ function registerTools(server, ctx) {
450
506
  server.tool(
451
507
  "list-endpoints",
452
508
  {
453
- includeTemplate: import_zod.z.boolean().optional().describe("Include template information"),
454
- includeWorkers: import_zod.z.boolean().optional().describe("Include information about workers")
509
+ ...listPaginationParams,
510
+ includeTemplate: import_zod2.z.boolean().optional().describe("Include template information"),
511
+ includeWorkers: import_zod2.z.boolean().optional().describe("Include information about workers")
455
512
  },
456
513
  async (params) => {
457
514
  const queryParams = new URLSearchParams();
@@ -464,22 +521,18 @@ function registerTools(server, ctx) {
464
521
  queryParams.append("includeWorkers", params.includeWorkers.toString());
465
522
  const queryString = queryParams.toString() ? `?${queryParams.toString()}` : "";
466
523
  const result = await runpodRequest(`/endpoints${queryString}`);
467
- return {
468
- content: [
469
- {
470
- type: "text",
471
- text: JSON.stringify(result, null, 2)
472
- }
473
- ]
474
- };
524
+ return capListResult(result, {
525
+ limit: params.limit,
526
+ cursor: params.cursor
527
+ });
475
528
  }
476
529
  );
477
530
  server.tool(
478
531
  "get-endpoint",
479
532
  {
480
- endpointId: import_zod.z.string().describe("ID of the endpoint to retrieve"),
481
- includeTemplate: import_zod.z.boolean().optional().describe("Include template information"),
482
- includeWorkers: import_zod.z.boolean().optional().describe("Include information about workers")
533
+ endpointId: import_zod2.z.string().describe("ID of the endpoint to retrieve"),
534
+ includeTemplate: import_zod2.z.boolean().optional().describe("Include template information"),
535
+ includeWorkers: import_zod2.z.boolean().optional().describe("Include information about workers")
483
536
  },
484
537
  async (params) => {
485
538
  const queryParams = new URLSearchParams();
@@ -507,14 +560,14 @@ function registerTools(server, ctx) {
507
560
  server.tool(
508
561
  "create-endpoint",
509
562
  {
510
- name: import_zod.z.string().optional().describe("Name for the endpoint"),
511
- templateId: import_zod.z.string().describe("Template ID to use"),
512
- computeType: import_zod.z.enum(["GPU", "CPU"]).optional().describe("GPU or CPU endpoint"),
513
- gpuTypeIds: import_zod.z.array(import_zod.z.string()).optional().describe("List of acceptable GPU types"),
514
- gpuCount: import_zod.z.number().optional().describe("Number of GPUs per worker"),
515
- workersMin: import_zod.z.number().optional().describe("Minimum number of workers"),
516
- workersMax: import_zod.z.number().optional().describe("Maximum number of workers"),
517
- dataCenterIds: import_zod.z.array(import_zod.z.string()).optional().describe("List of data centers")
563
+ name: import_zod2.z.string().optional().describe("Name for the endpoint"),
564
+ templateId: import_zod2.z.string().describe("Template ID to use"),
565
+ computeType: import_zod2.z.enum(["GPU", "CPU"]).optional().describe("GPU or CPU endpoint"),
566
+ gpuTypeIds: import_zod2.z.array(import_zod2.z.string()).optional().describe("List of acceptable GPU types"),
567
+ gpuCount: import_zod2.z.number().optional().describe("Number of GPUs per worker"),
568
+ workersMin: import_zod2.z.number().optional().describe("Minimum number of workers"),
569
+ workersMax: import_zod2.z.number().optional().describe("Maximum number of workers"),
570
+ dataCenterIds: import_zod2.z.array(import_zod2.z.string()).optional().describe("List of data centers")
518
571
  },
519
572
  async (params) => {
520
573
  const result = await runpodRequest("/endpoints", "POST", params);
@@ -531,13 +584,13 @@ function registerTools(server, ctx) {
531
584
  server.tool(
532
585
  "update-endpoint",
533
586
  {
534
- endpointId: import_zod.z.string().describe("ID of the endpoint to update"),
535
- name: import_zod.z.string().optional().describe("New name for the endpoint"),
536
- workersMin: import_zod.z.number().optional().describe("New minimum number of workers"),
537
- workersMax: import_zod.z.number().optional().describe("New maximum number of workers"),
538
- idleTimeout: import_zod.z.number().optional().describe("New idle timeout in seconds"),
539
- scalerType: import_zod.z.enum(["QUEUE_DELAY", "REQUEST_COUNT"]).optional().describe("Scaler type"),
540
- scalerValue: import_zod.z.number().optional().describe("Scaler value")
587
+ endpointId: import_zod2.z.string().describe("ID of the endpoint to update"),
588
+ name: import_zod2.z.string().optional().describe("New name for the endpoint"),
589
+ workersMin: import_zod2.z.number().optional().describe("New minimum number of workers"),
590
+ workersMax: import_zod2.z.number().optional().describe("New maximum number of workers"),
591
+ idleTimeout: import_zod2.z.number().optional().describe("New idle timeout in seconds"),
592
+ scalerType: import_zod2.z.enum(["QUEUE_DELAY", "REQUEST_COUNT"]).optional().describe("Scaler type"),
593
+ scalerValue: import_zod2.z.number().optional().describe("Scaler value")
541
594
  },
542
595
  async (params) => {
543
596
  const { endpointId, ...updateParams } = params;
@@ -559,7 +612,7 @@ function registerTools(server, ctx) {
559
612
  server.tool(
560
613
  "delete-endpoint",
561
614
  {
562
- endpointId: import_zod.z.string().describe("ID of the endpoint to delete")
615
+ endpointId: import_zod2.z.string().describe("ID of the endpoint to delete")
563
616
  },
564
617
  async (params) => {
565
618
  const result = await runpodRequest(
@@ -576,24 +629,24 @@ function registerTools(server, ctx) {
576
629
  };
577
630
  }
578
631
  );
579
- const endpointIdSchema = import_zod.z.string().regex(/^[a-zA-Z0-9_-]+$/, "Invalid endpoint ID format");
580
- const jobIdSchema = import_zod.z.string().regex(/^[a-zA-Z0-9_-]+$/, "Invalid job ID format");
581
- const inputSchema = import_zod.z.record(import_zod.z.unknown()).describe(
632
+ const endpointIdSchema = import_zod2.z.string().regex(/^[a-zA-Z0-9_-]+$/, "Invalid endpoint ID format");
633
+ const jobIdSchema = import_zod2.z.string().regex(/^[a-zA-Z0-9_-]+$/, "Invalid job ID format");
634
+ const inputSchema = import_zod2.z.record(import_zod2.z.unknown()).describe(
582
635
  "Input payload for the worker handler. The expected fields depend on the deployed model or worker."
583
636
  );
584
- const webhookSchema = import_zod.z.string().url().optional().describe(
637
+ const webhookSchema = import_zod2.z.string().url().optional().describe(
585
638
  "Webhook URL to receive job completion notifications instead of polling"
586
639
  );
587
- const policySchema = import_zod.z.object({
588
- executionTimeout: import_zod.z.number().optional().describe("Maximum execution time in milliseconds"),
589
- lowPriority: import_zod.z.boolean().optional().describe("Submit as a low-priority job"),
590
- ttl: import_zod.z.number().optional().describe("Time-to-live for the job result in milliseconds")
640
+ const policySchema = import_zod2.z.object({
641
+ executionTimeout: import_zod2.z.number().optional().describe("Maximum execution time in milliseconds"),
642
+ lowPriority: import_zod2.z.boolean().optional().describe("Submit as a low-priority job"),
643
+ ttl: import_zod2.z.number().optional().describe("Time-to-live for the job result in milliseconds")
591
644
  }).optional().describe("Execution policy options");
592
- const s3ConfigSchema = import_zod.z.object({
593
- accessId: import_zod.z.string().describe("S3 access key ID"),
594
- accessSecret: import_zod.z.string().describe("S3 secret access key"),
595
- bucketName: import_zod.z.string().describe("S3 bucket name"),
596
- endpointUrl: import_zod.z.string().describe("S3 endpoint URL")
645
+ const s3ConfigSchema = import_zod2.z.object({
646
+ accessId: import_zod2.z.string().describe("S3 access key ID"),
647
+ accessSecret: import_zod2.z.string().describe("S3 secret access key"),
648
+ bucketName: import_zod2.z.string().describe("S3 bucket name"),
649
+ endpointUrl: import_zod2.z.string().describe("S3 endpoint URL")
597
650
  }).optional().describe("S3-compatible storage config for large outputs");
598
651
  server.tool(
599
652
  "run-endpoint",
@@ -633,7 +686,7 @@ function registerTools(server, ctx) {
633
686
  "ID of the Serverless endpoint to run synchronously"
634
687
  ),
635
688
  input: inputSchema,
636
- wait: import_zod.z.number().min(1e3).max(3e5).optional().describe(
689
+ wait: import_zod2.z.number().min(1e3).max(3e5).optional().describe(
637
690
  "How long in milliseconds the server should wait for a result before returning a job ID to poll (1000\u2013300000). Defaults to 90000 (90 seconds)."
638
691
  ),
639
692
  webhook: webhookSchema,
@@ -849,9 +902,10 @@ function registerTools(server, ctx) {
849
902
  "list-templates",
850
903
  `List available templates. By default returns only the user's own templates. Use includeRunpodTemplates to also include official Runpod templates. The recommended default template for new pods is "Runpod Pytorch 2.8.0" (ID: runpod-torch-v280) \u2014 it has the latest CUDA and PyTorch versions.`,
851
904
  {
852
- includeRunpodTemplates: import_zod.z.boolean().optional().describe("Include official Runpod templates in the response"),
853
- includePublicTemplates: import_zod.z.boolean().optional().describe("Include community-made public templates in the response"),
854
- includeEndpointBoundTemplates: import_zod.z.boolean().optional().describe(
905
+ ...listPaginationParams,
906
+ includeRunpodTemplates: import_zod2.z.boolean().optional().describe("Include official Runpod templates in the response"),
907
+ includePublicTemplates: import_zod2.z.boolean().optional().describe("Include community-made public templates in the response"),
908
+ includeEndpointBoundTemplates: import_zod2.z.boolean().optional().describe(
855
909
  "Include templates bound to Serverless endpoints in the response"
856
910
  )
857
911
  },
@@ -867,20 +921,16 @@ function registerTools(server, ctx) {
867
921
  const result = await runpodRequest(
868
922
  `/templates${query ? `?${query}` : ""}`
869
923
  );
870
- return {
871
- content: [
872
- {
873
- type: "text",
874
- text: JSON.stringify(result, null, 2)
875
- }
876
- ]
877
- };
924
+ return capListResult(result, {
925
+ limit: params.limit,
926
+ cursor: params.cursor
927
+ });
878
928
  }
879
929
  );
880
930
  server.tool(
881
931
  "get-template",
882
932
  {
883
- templateId: import_zod.z.string().describe("ID of the template to retrieve")
933
+ templateId: import_zod2.z.string().describe("ID of the template to retrieve")
884
934
  },
885
935
  async (params) => {
886
936
  const result = await runpodRequest(`/templates/${params.templateId}`);
@@ -897,17 +947,20 @@ function registerTools(server, ctx) {
897
947
  server.tool(
898
948
  "create-template",
899
949
  {
900
- name: import_zod.z.string().describe("Name for the template"),
901
- imageName: import_zod.z.string().describe("Docker image to use"),
902
- isServerless: import_zod.z.boolean().optional().describe("Is this a serverless template"),
903
- ports: import_zod.z.array(import_zod.z.string()).optional().describe("Ports to expose"),
904
- dockerEntrypoint: import_zod.z.array(import_zod.z.string()).optional().describe("Docker entrypoint commands"),
905
- dockerStartCmd: import_zod.z.array(import_zod.z.string()).optional().describe("Docker start commands"),
906
- env: import_zod.z.record(import_zod.z.string()).optional().describe("Environment variables"),
907
- containerDiskInGb: import_zod.z.number().optional().describe("Container disk size in GB"),
908
- volumeInGb: import_zod.z.number().optional().describe("Volume size in GB"),
909
- volumeMountPath: import_zod.z.string().optional().describe("Path to mount the volume"),
910
- readme: import_zod.z.string().optional().describe("README content in markdown format")
950
+ name: import_zod2.z.string().describe("Name for the template"),
951
+ imageName: import_zod2.z.string().describe("Docker image to use"),
952
+ isServerless: import_zod2.z.boolean().optional().describe("Is this a serverless template"),
953
+ ports: import_zod2.z.array(import_zod2.z.string()).optional().describe("Ports to expose"),
954
+ dockerEntrypoint: import_zod2.z.array(import_zod2.z.string()).optional().describe("Docker entrypoint commands"),
955
+ dockerStartCmd: import_zod2.z.array(import_zod2.z.string()).optional().describe("Docker start commands"),
956
+ env: import_zod2.z.record(import_zod2.z.string()).optional().describe("Environment variables"),
957
+ containerDiskInGb: import_zod2.z.number().optional().describe("Container disk size in GB"),
958
+ volumeInGb: import_zod2.z.number().optional().describe("Volume size in GB"),
959
+ volumeMountPath: import_zod2.z.string().optional().describe("Path to mount the volume"),
960
+ readme: import_zod2.z.string().optional().describe("README content in markdown format"),
961
+ containerRegistryAuthId: import_zod2.z.string().optional().describe(
962
+ "ID of a container registry credential (from create-container-registry-auth / list-container-registry-auths) used to pull a private image. Required when imageName points at a private registry; without it serverless workers fail the image pull."
963
+ )
911
964
  },
912
965
  async (params) => {
913
966
  const result = await runpodRequest("/templates", "POST", params);
@@ -924,12 +977,15 @@ function registerTools(server, ctx) {
924
977
  server.tool(
925
978
  "update-template",
926
979
  {
927
- templateId: import_zod.z.string().describe("ID of the template to update"),
928
- name: import_zod.z.string().optional().describe("New name for the template"),
929
- imageName: import_zod.z.string().optional().describe("New Docker image"),
930
- ports: import_zod.z.array(import_zod.z.string()).optional().describe("New ports to expose"),
931
- env: import_zod.z.record(import_zod.z.string()).optional().describe("New environment variables"),
932
- readme: import_zod.z.string().optional().describe("New README content in markdown format")
980
+ templateId: import_zod2.z.string().describe("ID of the template to update"),
981
+ name: import_zod2.z.string().optional().describe("New name for the template"),
982
+ imageName: import_zod2.z.string().optional().describe("New Docker image"),
983
+ ports: import_zod2.z.array(import_zod2.z.string()).optional().describe("New ports to expose"),
984
+ env: import_zod2.z.record(import_zod2.z.string()).optional().describe("New environment variables"),
985
+ readme: import_zod2.z.string().optional().describe("New README content in markdown format"),
986
+ containerRegistryAuthId: import_zod2.z.string().optional().describe(
987
+ "ID of a container registry credential (from create-container-registry-auth / list-container-registry-auths) used to pull a private image. Set this to attach a credential to a template referencing a private registry."
988
+ )
933
989
  },
934
990
  async (params) => {
935
991
  const { templateId, ...updateParams } = params;
@@ -951,7 +1007,7 @@ function registerTools(server, ctx) {
951
1007
  server.tool(
952
1008
  "delete-template",
953
1009
  {
954
- templateId: import_zod.z.string().describe("ID of the template to delete")
1010
+ templateId: import_zod2.z.string().describe("ID of the template to delete")
955
1011
  },
956
1012
  async (params) => {
957
1013
  const result = await runpodRequest(
@@ -968,21 +1024,17 @@ function registerTools(server, ctx) {
968
1024
  };
969
1025
  }
970
1026
  );
971
- server.tool("list-network-volumes", {}, async () => {
1027
+ server.tool("list-network-volumes", listPaginationParams, async (params) => {
972
1028
  const result = await runpodRequest("/networkvolumes");
973
- return {
974
- content: [
975
- {
976
- type: "text",
977
- text: JSON.stringify(result, null, 2)
978
- }
979
- ]
980
- };
1029
+ return capListResult(result, {
1030
+ limit: params.limit,
1031
+ cursor: params.cursor
1032
+ });
981
1033
  });
982
1034
  server.tool(
983
1035
  "get-network-volume",
984
1036
  {
985
- networkVolumeId: import_zod.z.string().describe("ID of the network volume to retrieve")
1037
+ networkVolumeId: import_zod2.z.string().describe("ID of the network volume to retrieve")
986
1038
  },
987
1039
  async (params) => {
988
1040
  const result = await runpodRequest(
@@ -1001,9 +1053,9 @@ function registerTools(server, ctx) {
1001
1053
  server.tool(
1002
1054
  "create-network-volume",
1003
1055
  {
1004
- name: import_zod.z.string().describe("Name for the network volume"),
1005
- size: import_zod.z.number().describe("Size in GB (1-4000)"),
1006
- dataCenterId: import_zod.z.string().describe("Data center ID")
1056
+ name: import_zod2.z.string().describe("Name for the network volume"),
1057
+ size: import_zod2.z.number().describe("Size in GB (1-4000)"),
1058
+ dataCenterId: import_zod2.z.string().describe("Data center ID")
1007
1059
  },
1008
1060
  async (params) => {
1009
1061
  const result = await runpodRequest("/networkvolumes", "POST", params);
@@ -1020,9 +1072,9 @@ function registerTools(server, ctx) {
1020
1072
  server.tool(
1021
1073
  "update-network-volume",
1022
1074
  {
1023
- networkVolumeId: import_zod.z.string().describe("ID of the network volume to update"),
1024
- name: import_zod.z.string().optional().describe("New name for the network volume"),
1025
- size: import_zod.z.number().optional().describe("New size in GB (must be larger than current)")
1075
+ networkVolumeId: import_zod2.z.string().describe("ID of the network volume to update"),
1076
+ name: import_zod2.z.string().optional().describe("New name for the network volume"),
1077
+ size: import_zod2.z.number().optional().describe("New size in GB (must be larger than current)")
1026
1078
  },
1027
1079
  async (params) => {
1028
1080
  const { networkVolumeId, ...updateParams } = params;
@@ -1044,7 +1096,7 @@ function registerTools(server, ctx) {
1044
1096
  server.tool(
1045
1097
  "delete-network-volume",
1046
1098
  {
1047
- networkVolumeId: import_zod.z.string().describe("ID of the network volume to delete")
1099
+ networkVolumeId: import_zod2.z.string().describe("ID of the network volume to delete")
1048
1100
  },
1049
1101
  async (params) => {
1050
1102
  const result = await runpodRequest(
@@ -1061,21 +1113,21 @@ function registerTools(server, ctx) {
1061
1113
  };
1062
1114
  }
1063
1115
  );
1064
- server.tool("list-container-registry-auths", {}, async () => {
1065
- const result = await runpodRequest("/containerregistryauth");
1066
- return {
1067
- content: [
1068
- {
1069
- type: "text",
1070
- text: JSON.stringify(result, null, 2)
1071
- }
1072
- ]
1073
- };
1074
- });
1116
+ server.tool(
1117
+ "list-container-registry-auths",
1118
+ listPaginationParams,
1119
+ async (params) => {
1120
+ const result = await runpodRequest("/containerregistryauth");
1121
+ return capListResult(result, {
1122
+ limit: params.limit,
1123
+ cursor: params.cursor
1124
+ });
1125
+ }
1126
+ );
1075
1127
  server.tool(
1076
1128
  "get-container-registry-auth",
1077
1129
  {
1078
- containerRegistryAuthId: import_zod.z.string().describe("ID of the container registry auth to retrieve")
1130
+ containerRegistryAuthId: import_zod2.z.string().describe("ID of the container registry auth to retrieve")
1079
1131
  },
1080
1132
  async (params) => {
1081
1133
  const result = await runpodRequest(
@@ -1094,9 +1146,9 @@ function registerTools(server, ctx) {
1094
1146
  server.tool(
1095
1147
  "create-container-registry-auth",
1096
1148
  {
1097
- name: import_zod.z.string().describe("Name for the container registry auth"),
1098
- username: import_zod.z.string().describe("Registry username"),
1099
- password: import_zod.z.string().describe("Registry password")
1149
+ name: import_zod2.z.string().describe("Name for the container registry auth"),
1150
+ username: import_zod2.z.string().describe("Registry username"),
1151
+ password: import_zod2.z.string().describe("Registry password")
1100
1152
  },
1101
1153
  async (params) => {
1102
1154
  const result = await runpodRequest(
@@ -1117,7 +1169,7 @@ function registerTools(server, ctx) {
1117
1169
  server.tool(
1118
1170
  "delete-container-registry-auth",
1119
1171
  {
1120
- containerRegistryAuthId: import_zod.z.string().describe("ID of the container registry auth to delete")
1172
+ containerRegistryAuthId: import_zod2.z.string().describe("ID of the container registry auth to delete")
1121
1173
  },
1122
1174
  async (params) => {
1123
1175
  const result = await runpodRequest(