Skip to main content
Glama
abhijeetka
by abhijeetka

remove_label

Remove a label from a Kubernetes resource to manage metadata and organize cluster objects. Specify resource type, name, label key, and namespace.

Instructions

Remove a label 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 label from
    label_key: Key of the label to remove
    namespace: Namespace of the resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resource_typeYes
resource_nameYes
label_keyYes
namespaceNodefault

Implementation Reference

  • The main handler function for the 'remove_label' MCP tool. It uses kubectl to remove a label from a Kubernetes resource by running 'kubectl label <resource_type> <resource_name> <label_key>- --overwrite'. The @mcp.tool() decorator registers it as a tool in FastMCP, with the function signature providing the input schema via type hints and defaults.
    async def remove_label(resource_type: str, resource_name: str, label_key: str, namespace: str = "default") -> dict:
        """Remove a label 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 label from
            label_key: Key of the label to remove
            namespace: Namespace of the resource
        """
        try:
            cmd = ["kubectl", "label", resource_type, resource_name, f"{label_key}-", "-n", namespace, "--overwrite"]
            result = subprocess.run(cmd, capture_output=True, text=True, check=True)
            return {"message": f"Label {label_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 label: {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 for behavioral disclosure. It states this is a removal operation (implying mutation) but doesn't mention critical behavioral aspects: whether this requires specific permissions, if it's destructive (removing labels can affect resource selection), rate limits, error conditions, or what happens if the label doesn't exist. The description is minimal beyond stating the basic action.

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

Conciseness5/5

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

The description is perfectly structured and concise. The first sentence clearly states the purpose, followed by a well-organized parameter explanation. Every sentence earns its place with no redundant information. The formatting with clear parameter explanations makes it easy to parse.

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

Completeness3/5

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

Given this is a mutation tool with no annotations and no output schema, the description is incomplete. While it covers the basic action and parameters adequately, it lacks important context about behavioral implications, error handling, and what the tool returns. For a tool that modifies Kubernetes resources, more guidance about permissions and consequences would be valuable.

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 provides a helpful 'Args' section that explains each parameter's purpose, adding significant value beyond the schema which has 0% description coverage. It clarifies that 'namespace' defaults to 'default' (though this is also in the schema), and gives examples for 'resource_type'. However, it doesn't explain parameter constraints or provide examples for all parameters.

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 ('remove') and resource ('label from a Kubernetes resource'), making the purpose immediately understandable. It distinguishes from siblings like 'label_resource' (which adds labels) and 'remove_annotation' (which handles annotations rather than labels). However, it doesn't explicitly mention that this is a mutation operation or contrast with all similar tools.

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 proper permissions), when not to use it (e.g., for bulk operations), or direct alternatives like 'annotate_resource' or 'update_deployment' that might serve similar purposes in different contexts.

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