rename_network
Change the name of an existing network in your Civo cloud infrastructure by providing the network ID and new label.
Instructions
Rename a network on Civo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Network ID | |
| label | Yes | New network label | |
| region | No | Region identifier |
Implementation Reference
- src/index.ts:402-424 (handler)MCP server request handler for the 'rename_network' tool: validates input arguments, calls the renameNetwork API helper, and constructs the tool response.case 'rename_network': { if ( typeof args !== 'object' || args === null || typeof args.id !== 'string' || typeof args.label !== 'string' ) { throw new Error('Invalid arguments for rename_network'); } const network = await renameNetwork( args as { id: string; label: string; region?: string } ); return { content: [ { type: 'text', text: `Renamed network ${network.id} to ${network.label}`, }, ], isError: false, }; }
- src/api/networks.ts:48-68 (helper)Supporting function that executes the HTTP PUT request to the Civo API to rename the specified network.export async function renameNetwork(params: { id: string; label: string; region?: string; }): Promise<any> { const url = `${CIVO_API_URL}/networks/${params.id}`; const response = await fetch(url, { method: 'PUT', headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${CIVO_API_KEY}`, }, body: JSON.stringify({ label: params.label, region: params.region }), }); if (!response.ok) { throw new Error(`Failed to rename network: ${response.statusText}`); } return await response.json(); }
- src/tools/networks.ts:31-52 (schema)Tool definition including name, description, and input schema (parameters: id (required), label (required), region (optional)).export const RENAME_NETWORK_TOOL: Tool = { name: 'rename_network', description: 'Rename a network on Civo', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Network ID', }, label: { type: 'string', description: 'New network label', }, region: { type: 'string', description: 'Region identifier', }, }, required: ['id', 'label'], }, };
- src/index.ts:84-84 (registration)Registers the 'rename_network' tool schema in the MCP server's capabilities.tools map.[RENAME_NETWORK_TOOL.name]: RENAME_NETWORK_TOOL,