delete_kubernetes_cluster
Remove a Kubernetes cluster from the Civo cloud platform by specifying the cluster ID and region identifier to decommission resources and stop billing.
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)Handler logic for the delete_kubernetes_cluster tool: validates input arguments and calls the deleteCluster API function.case '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 helper function that performs the actual DELETE request to the Civo API to delete the Kubernetes cluster.export 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 including name, description, and input validation schema.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:86-89 (registration)Registration of the Kubernetes tools, including delete_kubernetes_cluster, in the server capabilities.[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,