Skip to main content
Glama
abhijeetka
by abhijeetka

delete_resource

Remove a Kubernetes resource from a cluster by specifying its type, name, and namespace to manage cluster resources effectively.

Instructions

Delete a Kubernetes resource

Args:
    resource_type: Type of the resource (e.g., pod, service, deployment,configmap,secret,ingress,statefulset,replicaset,damonset,newtorkpolicy,rolebinding,role,serviceaccount,job,cronjob)
    resource_name: Name of the resource to delete
    namespace: Namespace of the resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resource_typeYes
resource_nameYes
namespaceNodefault

Implementation Reference

  • The handler function for the 'delete_resource' tool. It executes 'kubectl delete' command to remove the specified Kubernetes resource. Registered via the @mcp.tool() decorator immediately above the function definition.
    @mcp.tool()
    async def delete_resource(resource_type: str, resource_name: str, namespace: str = "default") -> dict:
        """Delete a Kubernetes resource
    
        Args:
            resource_type: Type of the resource (e.g., pod, service, deployment,configmap,secret,ingress,statefulset,replicaset,damonset,newtorkpolicy,rolebinding,role,serviceaccount,job,cronjob)
            resource_name: Name of the resource to delete
            namespace: Namespace of the resource
        """
        try:
            cmd = ["kubectl", "delete", resource_type, resource_name, "-n", namespace]
            result = subprocess.run(cmd, capture_output=True, text=True, check=True)
            return {"message": f"Resource {resource_type}/{resource_name} deleted successfully in namespace {namespace}",
                    "details": result.stdout}
        except subprocess.CalledProcessError as e:
            return {"error": f"Failed to delete resource: {str(e)}"}
  • kubernetes.py:353-353 (registration)
    The @mcp.tool() decorator registers the delete_resource function as an MCP tool.
    @mcp.tool()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the destructive action ('Delete') but doesn't mention critical behaviors like whether deletion is permanent, requires confirmation, has side effects (e.g., cascading deletions), or what happens on success/failure. This leaves significant gaps for a destructive operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the core purpose followed by parameter explanations. Each sentence adds value, with no redundant information. However, the parameter list could be slightly more structured (e.g., bullet points) for better readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (destructive operation with 3 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects like error handling, return values, or safety considerations, which are crucial for a deletion tool in a Kubernetes context with many sibling alternatives.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds substantial value beyond the input schema, which has 0% description coverage. It explains each parameter's purpose: 'resource_type' with examples (e.g., pod, service), 'resource_name' as the target, and 'namespace' with context. This compensates well for the schema's lack of documentation, though it doesn't cover format details like case sensitivity.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Delete') and resource ('a Kubernetes resource'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'remove_annotation' or 'remove_label', which might also involve deletion operations on specific resource aspects rather than entire resources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing appropriate permissions), when not to use it (e.g., for partial deletions), or refer to sibling tools like 'remove_annotation' for more specific operations. The usage context is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/abhijeetka/mcp-k8s-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server