delete
Remove a specific Kubernetes resource like pods, deployments, or services from your cluster by specifying its type and name.
Instructions
Delete a Kubernetes resource
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"resource": "<resource>",
"name": "<name>"
},
"name": "delete"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resource | Yes | The resource type (pod, deployment, service, etc.) | |
| name | Yes | The name of the resource | |
| namespace | No | The namespace of the resource (optional, defaults to current context namespace) |
Implementation Reference
- server.js:1838-1849 (handler)The handler function for the 'delete' tool that executes the Kubernetes 'kubectl delete' command based on the provided resource type, name, and optional namespace.
case "delete": { const { resource, name, namespace } = args; const nsArg = namespace ? `-n ${namespace}` : ""; const cmd = `kubectl delete ${resource} ${name} ${nsArg}`; const { stdout } = await execAsync(cmd); return { content: [{ type: "text", text: stdout || `Deleted ${resource} ${name}` }] }; } - server.js:688-707 (schema)The input schema definition for the 'delete' tool, specifying parameters for resource type, name, and optional namespace.
name: "delete", description: "Delete a Kubernetes resource", inputSchema: { type: "object", properties: { resource: { type: "string", description: "The resource type (pod, deployment, service, etc.)" }, name: { type: "string", description: "The name of the resource" }, namespace: { type: "string", description: "The namespace of the resource (optional, defaults to current context namespace)" } }, required: ["resource", "name"] } - server.js:1392-1394 (registration)The ListTools request handler that returns the list of all tools, including 'delete', for tool discovery.
server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });