Skip to main content
Glama

remove_node_label

Remove specific labels from Kubernetes nodes to manage resource organization and configuration across clusters. Specify context, node name, and label key for targeted label removal.

Instructions

Remove a label from a node.

Args: context_name: The Kubernetes context name node_name: The name of the node to modify label_key: The label key to remove

Returns: JSON string containing the updated node labels

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
node_nameYes
label_keyYes

Implementation Reference

  • The handler function for the 'remove_node_label' tool. It removes the specified label from the given Kubernetes node by patching the node's metadata.labels using the Kubernetes CoreV1 API. Includes decorators for registration (@mcp.tool()) and context (@use_current_context). Returns JSON with updated labels or a message if label not found.
    @mcp.tool()
    @use_current_context
    def remove_node_label(context_name: str, node_name: str, label_key: str):
        """
        Remove a label from a node.
    
        Args:
            context_name: The Kubernetes context name
            node_name: The name of the node to modify
            label_key: The label key to remove
    
        Returns:
            JSON string containing the updated node labels
        """
        core_v1: CoreV1Api = get_api_clients(context_name)["core"]
    
        # Get the current node
        node = core_v1.read_node(node_name)
    
        # Check if the node has labels
        if not node.metadata.labels or label_key not in node.metadata.labels:
            result = {
                "name": node_name,
                "labels": node.metadata.labels,
                "message": f"Label '{label_key}' not found on node"
            }
            return json.dumps(result)
    
        # Update the labels
        labels = dict(node.metadata.labels)
        del labels[label_key]
    
        # Apply the patch
        body = {
            "metadata": {
                "labels": labels
            }
        }
    
        patched_node = core_v1.patch_node(node_name, body)
    
        result = {
            "name": patched_node.metadata.name,
            "labels": patched_node.metadata.labels
        }
    
        return json.dumps(result)
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 the tool modifies a node and returns JSON with updated labels, but doesn't disclose critical details like required permissions, whether this is a destructive/mutating operation, potential side effects, error conditions, or rate limits. For a Kubernetes mutation tool, this leaves significant gaps.

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 and return value sections. Every sentence serves a purpose with minimal redundancy. The only minor improvement would be integrating the purpose more seamlessly with the parameter explanations.

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?

For a 3-parameter mutation tool with no annotations and no output schema, the description provides basic but incomplete coverage. It explains what the tool does and documents parameters, but lacks crucial behavioral context (permissions, side effects) and detailed return value explanation beyond 'JSON string'. Given the complexity of Kubernetes operations, this leaves the agent with significant uncertainty.

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?

The description lists all three parameters with brief explanations ('The Kubernetes context name', 'The name of the node to modify', 'The label key to remove'), which adds meaningful context beyond the schema's 0% coverage. However, it doesn't provide format examples, validation rules, or explain relationships between parameters, leaving some semantic gaps.

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 a label from a node') with specific resource ('node') and operation ('remove label'), making the purpose immediately understandable. It distinguishes from siblings like 'add_node_label' by specifying removal rather than addition, though it doesn't explicitly contrast with 'remove_namespace_label' or other node operations.

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 when label removal is appropriate versus other node modifications (like taint removal or cordoning), nor does it reference sibling tools like 'add_node_label' or 'remove_node_taint' for context. The agent must infer usage from the tool name alone.

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/bourbonkk/k8s-pilot'

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