pvc_list
List PersistentVolumeClaims in a Kubernetes namespace to monitor storage resources and manage cluster storage allocation.
Instructions
List all PersistentVolumeClaims in a given namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace
Returns: List of PersistentVolumeClaim basic information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/pvc.py:8-24 (handler)The main handler function for the 'pvc_list' tool. It retrieves PersistentVolumeClaims (PVCs) from the specified Kubernetes namespace using the CoreV1Api and returns a list with name, status, and storage information.@mcp.tool() @use_current_context def pvc_list(context_name: str, namespace: str): """ List all PersistentVolumeClaims in a given namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace Returns: List of PersistentVolumeClaim basic information """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] pvcs = core_v1.list_namespaced_persistent_volume_claim(namespace) result = [{"name": pvc.metadata.name, "status": pvc.status.phase, "storage": pvc.spec.resources.requests.get("storage")} for pvc in pvcs.items] return result
- tools/pvc.py:8-8 (registration)The @mcp.tool() decorator registers the pvc_list function as an MCP tool.@mcp.tool()
- tools/pvc.py:10-20 (schema)Type hints and docstring define the input schema (context_name: str, namespace: str) and output (list of PVC info).def pvc_list(context_name: str, namespace: str): """ List all PersistentVolumeClaims in a given namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace Returns: List of PersistentVolumeClaim basic information """