rename_network
Change the name of an existing network in Civo cloud platform by specifying its ID and new label. Update network identifiers for better organization and management.
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)Executes the rename_network tool by validating arguments and calling the renameNetwork API function, returning a success message.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/tools/networks.ts:31-52 (schema)Defines the input schema, name, and description for the rename_network tool.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 in the MCP server capabilities.tools object.[RENAME_NETWORK_TOOL.name]: RENAME_NETWORK_TOOL,
- src/api/networks.ts:48-68 (helper)Implements the core logic for renaming a network by making a PUT request to the Civo API.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(); }