delete_instance
Remove a cloud instance from the Civo platform by specifying its ID and region to manage infrastructure resources and control costs.
Instructions
Delete a cloud instance on Civo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Instance ID | |
| region | Yes | Region identifier |
Implementation Reference
- src/api/instances.ts:178-201 (handler)The core handler function that executes the DELETE request to the Civo API to delete the instance.export async function deleteInstance(params: { id: string; region: string; }): Promise<any> { checkRateLimit(); const url = new URL(`${CIVO_API_URL}/instances/${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( `Civo API error: ${response.status} ${response.statusText}` ); } return response.json(); }
- src/index.ts:449-471 (handler)The MCP server dispatcher case for 'delete_instance' that validates input and invokes the deleteInstance handler.case 'delete_instance': { if ( typeof args !== 'object' || args === null || typeof args.id !== 'string' || typeof args.region !== 'string' ) { throw new Error('Invalid arguments for delete_instance'); } const result = await deleteInstance( args as { id: string; region: string } ); return { content: [ { type: 'text', text: `Instance ${args.id} deleted: ${result.result}`, }, ], isError: false, }; }
- src/tools/instances.ts:140-157 (schema)The Tool definition providing the input schema, name, and description for the delete_instance tool.export const DELETE_INSTANCE_TOOL: Tool = { name: 'delete_instance', description: 'Delete a cloud instance on Civo', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Instance ID', }, region: { type: 'string', description: 'Region identifier', }, }, required: ['id', 'region'], }, };
- src/index.ts:77-77 (registration)Registration of the delete_instance tool schema in the MCP server's capabilities.tools dictionary.[DELETE_INSTANCE_TOOL.name]: DELETE_INSTANCE_TOOL,