update-network-volume
Modify network volume properties in RunPod, including renaming or resizing storage for cloud computing workloads.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| networkVolumeId | Yes | ID of the network volume to update | |
| name | No | New name for the network volume | |
| size | No | New size in GB (must be larger than current) |
Implementation Reference
- src/index.ts:698-714 (handler)The handler function destructures the parameters to extract networkVolumeId, calls the runpodRequest helper with a PATCH request to the RunPod API to update the network volume, and returns the API response as formatted JSON 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)Zod input schema defining the required networkVolumeId (string) and optional name (string) and size (number) parameters for updating a 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)'), },
- src/index.ts:688-715 (registration)Registers the 'update-network-volume' tool on the MCP server with its input schema and handler function.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 that makes authenticated HTTP requests to the RunPod API using node-fetch, handles JSON responses and errors, and is used by the update-network-volume 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; } }