delete_kubernetes_cluster
Remove a Kubernetes cluster from the Civo cloud platform using its cluster ID and region identifier to manage cloud resources.
Instructions
Delete a Kubernetes cluster on Civo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Cluster ID | |
| region | Yes | Region identifier |
Implementation Reference
- src/index.ts:525-547 (handler)MCP CallToolRequest handler case for 'delete_kubernetes_cluster': validates arguments (id, region), calls deleteCluster from api/kubernetes, returns success message with resultcase 'delete_kubernetes_cluster': { if ( typeof args !== 'object' || args === null || typeof args.id !== 'string' || typeof args.region !== 'string' ) { throw new Error('Invalid arguments for delete_kubernetes_cluster'); } const result = await deleteCluster( args as { id: string; region: string } ); return { content: [ { type: 'text', text: `Deleted Kubernetes cluster ${args.id}: ${result.result}`, }, ], isError: false, }; }
- src/api/kubernetes.ts:69-92 (helper)Core API function that performs the DELETE request to Civo's Kubernetes clusters endpoint to delete the specified clusterexport async function deleteCluster(params: { id: string; region: string; }): Promise<any> { checkRateLimit(); const url = new URL(`${CIVO_API_URL}/kubernetes/clusters/${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/tools/kubernetes.ts:59-76 (schema)Tool schema definition: name, description, and inputSchema (requires id and region)export const DELETE_KUBERNETES_CLUSTER_TOOL: Tool = { name: 'delete_kubernetes_cluster', description: 'Delete a Kubernetes cluster on Civo', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Cluster ID', }, region: { type: 'string', description: 'Region identifier', }, }, required: ['id', 'region'], }, };
- src/index.ts:69-90 (registration)Server capabilities registration of tools, including delete_kubernetes_cluster via DELETE_KUBERNETES_CLUSTER_TOOLcapabilities: { tools: { [CREATE_INSTANCE_TOOL.name]: CREATE_INSTANCE_TOOL, [LIST_INSTANCES_TOOL.name]: LIST_INSTANCES_TOOL, [REBOOT_INSTANCE_TOOL.name]: REBOOT_INSTANCE_TOOL, [SHUTDOWN_INSTANCE_TOOL.name]: SHUTDOWN_INSTANCE_TOOL, [START_INSTANCE_TOOL.name]: START_INSTANCE_TOOL, [RESIZE_INSTANCE_TOOL.name]: RESIZE_INSTANCE_TOOL, [DELETE_INSTANCE_TOOL.name]: DELETE_INSTANCE_TOOL, [LIST_DISK_IMAGES_TOOL.name]: LIST_DISK_IMAGES_TOOL, [GET_DISK_IMAGE_TOOL.name]: GET_DISK_IMAGE_TOOL, [LIST_SIZES_TOOL.name]: LIST_SIZES_TOOL, [LIST_REGIONS_TOOL.name]: LIST_REGIONS_TOOL, [LIST_NETWORKS_TOOL.name]: LIST_NETWORKS_TOOL, [CREATE_NETWORK_TOOL.name]: CREATE_NETWORK_TOOL, [RENAME_NETWORK_TOOL.name]: RENAME_NETWORK_TOOL, [DELETE_NETWORK_TOOL.name]: DELETE_NETWORK_TOOL, [LIST_KUBERNETES_CLUSTERS_TOOL.name]: LIST_KUBERNETES_CLUSTERS_TOOL, [CREATE_KUBERNETES_CLUSTER_TOOL.name]: CREATE_KUBERNETES_CLUSTER_TOOL, [DELETE_KUBERNETES_CLUSTER_TOOL.name]: DELETE_KUBERNETES_CLUSTER_TOOL, [LIST_KUBERNETES_VERSIONS_TOOL.name]: LIST_KUBERNETES_VERSIONS_TOOL, },
- src/index.ts:113-117 (registration)ListToolsRequest handler returns registered tools list, including delete_kubernetes_clusterLIST_KUBERNETES_CLUSTERS_TOOL, CREATE_KUBERNETES_CLUSTER_TOOL, DELETE_KUBERNETES_CLUSTER_TOOL, LIST_KUBERNETES_VERSIONS_TOOL, ],