delete_network
Remove a virtual network from the Civo cloud platform by specifying its ID and optional region to manage infrastructure resources.
Instructions
Delete a network on Civo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Network ID | |
| region | No | Region identifier |
Implementation Reference
- src/index.ts:426-447 (handler)MCP server handler for 'delete_network' tool: validates input arguments and calls the deleteNetwork API function to execute the deletion.case 'delete_network': { if ( typeof args !== 'object' || args === null || typeof args.id !== 'string' ) { throw new Error('Invalid arguments for delete_network'); } const result = await deleteNetwork( args as { id: string; region: string } ); return { content: [ { type: 'text', text: `Deleted network ${args.id}: ${result.result}`, }, ], isError: false, }; }
- src/tools/networks.ts:54-71 (schema)Tool schema definition for 'delete_network', specifying input parameters (id required, region optional).export const DELETE_NETWORK_TOOL: Tool = { name: 'delete_network', description: 'Delete a network on Civo', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Network ID', }, region: { type: 'string', description: 'Region identifier', }, }, required: ['id'], }, };
- src/index.ts:85-85 (registration)Registration of the 'delete_network' tool in the MCP server capabilities.tools map.[DELETE_NETWORK_TOOL.name]: DELETE_NETWORK_TOOL,
- src/api/networks.ts:70-89 (helper)API helper function that performs the actual HTTP DELETE request to Civo's networks endpoint.export async function deleteNetwork(params: { id: string; region: string; }): Promise<any> { const url = new URL(`${CIVO_API_URL}/networks/${params.id}`); url.searchParams.set('region', params.region); const response = await fetch(url.toString(), { method: 'DELETE', headers: { Authorization: `Bearer ${CIVO_API_KEY}`, }, }); if (!response.ok) { throw new Error(`Failed to delete network: ${response.statusText}`); } return await response.json(); }