pv_list
Retrieve and list all PersistentVolumes in a Kubernetes cluster by specifying the context name, enabling efficient management of storage resources across multiple clusters.
Instructions
List all PersistentVolumes in the cluster.
Args: context_name: The Kubernetes context name
Returns: List of PersistentVolume basic information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes |
Implementation Reference
- tools/pv.py:8-23 (handler)The handler function pv_list that implements the tool logic: lists PersistentVolumes in the Kubernetes cluster using CoreV1Api, decorated with @mcp.tool() for registration and @use_current_context.@mcp.tool() @use_current_context def pv_list(context_name: str): """ List all PersistentVolumes in the cluster. Args: context_name: The Kubernetes context name Returns: List of PersistentVolume basic information """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] pvs = core_v1.list_persistent_volume() result = [{"name": pv.metadata.name, "capacity": pv.spec.capacity, "access_modes": pv.spec.access_modes} for pv in pvs.items] return result
- server/server.py:17-17 (registration)Import of the tools.pv module within load_modules() function, which triggers the @mcp.tool() decorator to register the pv_list tool with the MCP server.import tools.pv # noqa: F401