delete_network
Remove a network from the Civo cloud platform by specifying the network ID and optional region identifier to manage cloud 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/api/networks.ts:70-89 (handler)Core handler function that performs the HTTP DELETE request to the Civo API to delete the specified network.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(); }
- src/tools/networks.ts:54-71 (schema)Tool schema defining name, description, and input schema (requires network ID, optional region).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:426-447 (handler)MCP tool request handler: validates input arguments and invokes the deleteNetwork API function, formats response.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/index.ts:85-85 (registration)Registers the delete_network tool in the MCP server's capabilities.[DELETE_NETWORK_TOOL.name]: DELETE_NETWORK_TOOL,