Skip to main content
Glama

pod_update

Update Kubernetes pod labels to modify metadata for existing pods, enabling resource organization and management within clusters.

Instructions

Update an existing pod's metadata (only labels can be updated for an existing pod).

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The pod name labels: New labels to apply to the pod

Returns: Information about the updated pod

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
labelsNo

Implementation Reference

  • The handler function implementing the pod_update tool logic. It reads the existing pod, updates its labels if provided, patches the pod via Kubernetes API, and returns the updated pod information.
    def pod_update(context_name: str, namespace: str, name: str, labels: Optional[Dict[str, str]] = None): """ Update an existing pod's metadata (only labels can be updated for an existing pod). Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The pod name labels: New labels to apply to the pod Returns: Information about the updated pod """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] # Get the current pod pod = core_v1.read_namespaced_pod(name=name, namespace=namespace) # Update pod labels if provided if labels: pod.metadata.labels = labels # Update the pod in Kubernetes updated_pod = core_v1.patch_namespaced_pod( name=name, namespace=namespace, body={"metadata": {"labels": labels}} ) result = { "name": updated_pod.metadata.name, "namespace": updated_pod.metadata.namespace, "status": updated_pod.status.phase, "labels": updated_pod.metadata.labels, } return result
  • tools/pod.py:243-243 (registration)
    The @mcp.tool() decorator registers the pod_update function as an MCP tool.
    @mcp.tool()
  • tools/pod.py:244-245 (registration)
    Decorators providing context and permission checks for the pod_update tool.
    @use_current_context @check_readonly_permission

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