Skip to main content
Glama

pvc_create

Create PersistentVolumeClaims in Kubernetes namespaces to allocate storage for applications using specified size, access modes, and storage class.

Instructions

Create a PersistentVolumeClaim in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The PersistentVolumeClaim name storage: The storage size (e.g., "10Gi") access_modes: List of access modes (e.g., ["ReadWriteOnce"]) storage_class: The storage class name (optional)

Returns: Status of the creation operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
storageYes
access_modesYes
storage_classNo

Implementation Reference

  • The pvc_create function implements the core logic of the tool: it constructs a V1PersistentVolumeClaim object using the provided parameters and uses the Kubernetes CoreV1Api to create it in the specified namespace.
    def pvc_create(context_name: str, namespace: str, name: str, storage: str, access_modes: list, storage_class: str = None): """ Create a PersistentVolumeClaim in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The PersistentVolumeClaim name storage: The storage size (e.g., "10Gi") access_modes: List of access modes (e.g., ["ReadWriteOnce"]) storage_class: The storage class name (optional) Returns: Status of the creation operation """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] pvc = V1PersistentVolumeClaim( metadata=V1ObjectMeta(name=name), spec=V1PersistentVolumeClaimSpec( access_modes=access_modes, resources=V1ResourceRequirements(requests={"storage": storage}), storage_class_name=storage_class ) ) created_pvc = core_v1.create_namespaced_persistent_volume_claim(namespace=namespace, body=pvc) return {"name": created_pvc.metadata.name, "status": "Created"}
  • tools/pvc.py:27-27 (registration)
    The @mcp.tool() decorator registers the pvc_create function as an MCP tool.
    @mcp.tool()
  • The @check_readonly_permission decorator ensures appropriate permissions for the tool.
    @check_readonly_permission
  • The @use_current_context decorator provides the current context for the tool.
    @use_current_context

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