Skip to main content
Glama

create-pod

Create GPU-enabled cloud pods for running Docker containers with customizable resources, volumes, and network configurations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoName for the pod
imageNameYesDocker image to use
cloudTypeNoSECURE or COMMUNITY cloud
gpuTypeIdsNoList of acceptable GPU types
gpuCountNoNumber of GPUs
containerDiskInGbNoContainer disk size in GB
volumeInGbNoVolume size in GB
volumeMountPathNoPath to mount the volume
portsNoPorts to expose (e.g., '8888/http', '22/tcp')
envNoEnvironment variables
dataCenterIdsNoList of data centers

Implementation Reference

  • Handler function for the 'create-pod' tool that sends a POST request to the RunPod /pods endpoint with the input parameters and returns the JSON response as formatted text.
    async (params) => { const result = await runpodRequest('/pods', 'POST', params); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], };
  • Zod schema defining the input parameters for the 'create-pod' tool, including optional fields like name, imageName, gpu specs, volumes, ports, env vars, etc.
    { name: z.string().optional().describe('Name for the pod'), imageName: z.string().describe('Docker image to use'), cloudType: z .enum(['SECURE', 'COMMUNITY']) .optional() .describe('SECURE or COMMUNITY cloud'), gpuTypeIds: z .array(z.string()) .optional() .describe('List of acceptable GPU types'), gpuCount: z.number().optional().describe('Number of GPUs'), containerDiskInGb: z .number() .optional() .describe('Container disk size in GB'), volumeInGb: z.number().optional().describe('Volume size in GB'), volumeMountPath: z.string().optional().describe('Path to mount the volume'), ports: z .array(z.string()) .optional() .describe("Ports to expose (e.g., '8888/http', '22/tcp')"), env: z.record(z.string()).optional().describe('Environment variables'), dataCenterIds: z .array(z.string()) .optional() .describe('List of data centers'), },
  • src/index.ts:179-221 (registration)
    Registration of the 'create-pod' tool on the MCP server using server.tool(), specifying the name, input schema, and handler function.
    server.tool( 'create-pod', { name: z.string().optional().describe('Name for the pod'), imageName: z.string().describe('Docker image to use'), cloudType: z .enum(['SECURE', 'COMMUNITY']) .optional() .describe('SECURE or COMMUNITY cloud'), gpuTypeIds: z .array(z.string()) .optional() .describe('List of acceptable GPU types'), gpuCount: z.number().optional().describe('Number of GPUs'), containerDiskInGb: z .number() .optional() .describe('Container disk size in GB'), volumeInGb: z.number().optional().describe('Volume size in GB'), volumeMountPath: z.string().optional().describe('Path to mount the volume'), ports: z .array(z.string()) .optional() .describe("Ports to expose (e.g., '8888/http', '22/tcp')"), env: z.record(z.string()).optional().describe('Environment variables'), dataCenterIds: z .array(z.string()) .optional() .describe('List of data centers'), }, async (params) => { const result = await runpodRequest('/pods', 'POST', params); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } );
  • Reusable helper function that makes authenticated HTTP requests to the RunPod API. Used by the create-pod handler and all other tools.
    async function runpodRequest( endpoint: string, method: string = 'GET', body?: Record<string, unknown> ) { const url = `${API_BASE_URL}${endpoint}`; const headers = { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }; const options: NodeFetchRequestInit = { method, headers, }; if (body && (method === 'POST' || method === 'PATCH')) { options.body = JSON.stringify(body); } try { const response = await fetch(url, options); if (!response.ok) { const errorText = await response.text(); throw new Error(`RunPod API Error: ${response.status} - ${errorText}`); } // Some endpoints might not return JSON const contentType = response.headers.get('content-type'); if (contentType && contentType.includes('application/json')) { return await response.json(); } return { success: true, status: response.status }; } catch (error) { console.error('Error calling RunPod API:', error); throw error; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/runpod/runpod-mcp-ts'

If you have feedback or need assistance with the MCP directory API, please join our Discord server