update-network-volume
Modify network volume properties such as name and storage capacity within the RunPod MCP Server environment. Change volume size or rename existing volumes to meet evolving storage requirements.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | New name for the network volume | |
| networkVolumeId | Yes | ID of the network volume to update | |
| size | No | New size in GB (must be larger than current) |
Implementation Reference
- src/index.ts:698-714 (handler)Handler function that performs a PATCH request to the RunPod API to update the network volume's name or size, and formats the response as text content.async (params) => { const { networkVolumeId, ...updateParams } = params; const result = await runpodRequest( `/networkvolumes/${networkVolumeId}`, 'PATCH', updateParams ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:690-697 (schema)Input schema using Zod for validating parameters: networkVolumeId (required), name and size (optional).{ networkVolumeId: z.string().describe('ID of the network volume to update'), name: z.string().optional().describe('New name for the network volume'), size: z .number() .optional() .describe('New size in GB (must be larger than current)'), },
- src/index.ts:688-715 (registration)Registration of the 'update-network-volume' tool using server.tool(), including inline schema and handler.server.tool( 'update-network-volume', { networkVolumeId: z.string().describe('ID of the network volume to update'), name: z.string().optional().describe('New name for the network volume'), size: z .number() .optional() .describe('New size in GB (must be larger than current)'), }, async (params) => { const { networkVolumeId, ...updateParams } = params; const result = await runpodRequest( `/networkvolumes/${networkVolumeId}`, 'PATCH', updateParams ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } );
- src/index.ts:27-66 (helper)Shared helper function runpodRequest that makes authenticated HTTP requests to the RunPod API, used by the tool handler.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; } }