delete_network
Delete a network on Civo cloud by specifying its ID and region.
Instructions
Delete a network on Civo
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Network ID | |
| region | No | Region identifier |
Implementation Reference
- src/api/networks.ts:70-89 (handler)The actual API handler that performs the DELETE request to the Civo API to delete a network by ID and region.
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)The Tool definition with inputSchema for the delete_network tool, specifying required field 'id' and 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:85-85 (registration)Registration of DELETE_NETWORK_TOOL in the server's tool capabilities map.
[DELETE_NETWORK_TOOL.name]: DELETE_NETWORK_TOOL, - src/index.ts:112-112 (registration)Inclusion of DELETE_NETWORK_TOOL in the list of tools returned by ListToolsRequestSchema handler.
DELETE_NETWORK_TOOL, - src/index.ts:426-447 (handler)The call tool request handler that validates arguments for 'delete_network' and invokes the deleteNetwork API function.
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, }; }