Skip to main content
Glama
abhijeetka
by abhijeetka

remove_annotation

Remove annotations from Kubernetes resources like pods, services, or deployments to clean up metadata or modify configurations.

Instructions

Remove an annotation from a Kubernetes resource

Args:
    resource_type: Type of the resource (e.g., pod, service, deployment)
    resource_name: Name of the resource to remove the annotation from
    annotation_key: Key of the annotation to remove
    namespace: Namespace of the resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resource_typeYes
resource_nameYes
annotation_keyYes
namespaceNodefault

Implementation Reference

  • The core handler function for the 'remove_annotation' tool. It is decorated with @mcp.tool(), which registers it with the MCP server. The function executes kubectl annotate command with the annotation key suffixed by '-' to remove the annotation from the specified Kubernetes resource.
    @mcp.tool()
    async def remove_annotation(resource_type: str, resource_name: str, annotation_key: str, namespace: str = "default") -> dict:
        """Remove an annotation from a Kubernetes resource
    
        Args:
            resource_type: Type of the resource (e.g., pod, service, deployment)
            resource_name: Name of the resource to remove the annotation from
            annotation_key: Key of the annotation to remove
            namespace: Namespace of the resource
        """
        try:
            cmd = ["kubectl", "annotate", resource_type, resource_name, f"{annotation_key}-", "-n", namespace, "--overwrite"]
            result = subprocess.run(cmd, capture_output=True, text=True, check=True)
            return {"message": f"Annotation {annotation_key} removed from resource {resource_type}/{resource_name} in namespace {namespace}",
                    "details": result.stdout}
        except subprocess.CalledProcessError as e:
            return {"error": f"Failed to remove annotation: {str(e)}"}
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral context. It states this is a removal operation (implying mutation) but doesn't disclose permissions needed, whether changes are reversible, potential side effects, or what happens if the annotation doesn't exist. For a mutation tool with zero annotation coverage, this is inadequate.

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 efficiently structured with a clear purpose statement followed by parameter explanations. Each sentence serves a purpose, though the parameter explanations could be more detailed. The format is clean and easy to parse.

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?

For a mutation tool with 4 parameters, 0% schema coverage, no annotations, and no output schema, the description is insufficient. It covers basic parameter identification but lacks critical information about behavior, permissions, error conditions, and what constitutes successful execution.

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

Parameters3/5

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

With 0% schema description coverage, the description partially compensates by listing all 4 parameters with brief explanations. However, it doesn't provide format details (e.g., namespace defaults to 'default' as shown in schema), validation rules, or examples. The parameter explanations are minimal but cover the basics.

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 action ('Remove an annotation') and target ('from a Kubernetes resource'), making the purpose immediately understandable. It distinguishes from sibling 'remove_label' by specifying annotation removal rather than label removal, but doesn't explicitly contrast with other annotation-related tools like 'annotate_resource'.

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 sibling tools like 'annotate_resource' for adding annotations or 'delete_resource' for complete resource removal, nor does it specify prerequisites or appropriate contexts for annotation removal.

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