Skip to main content
Glama

pvc_update

Modify labels and metadata of an existing PersistentVolumeClaim in Kubernetes clusters. Requires context name, namespace, PVC name, and new labels for precise updates.

Instructions

Update an existing PersistentVolumeClaim's metadata (e.g., labels).

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

Returns: Status of the update operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
labelsYes
nameYes
namespaceYes

Implementation Reference

  • The main handler function for the 'pvc_update' tool. It is decorated with @mcp.tool() which registers it as an MCP tool. The function updates the labels on a specified PersistentVolumeClaim (PVC) in the given namespace using the Kubernetes CoreV1 API.
    @mcp.tool() @use_current_context @check_readonly_permission def pvc_update(context_name: str, namespace: str, name: str, labels: dict): """ Update an existing PersistentVolumeClaim's metadata (e.g., labels). Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The PersistentVolumeClaim name labels: New labels to apply to the PersistentVolumeClaim Returns: Status of the update operation """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] pvc = core_v1.read_namespaced_persistent_volume_claim(name=name, namespace=namespace) pvc.metadata.labels = labels updated_pvc = core_v1.patch_namespaced_persistent_volume_claim(name=name, namespace=namespace, body={"metadata": {"labels": labels}}) return {"name": updated_pvc.metadata.name, "status": "Updated", "labels": updated_pvc.metadata.labels}

Other Tools

Related 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