configmap_create
Create a ConfigMap in a specified Kubernetes namespace to store configuration data for applications running in your cluster.
Instructions
Create a ConfigMap in the specified namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ConfigMap name data: The data to store in the ConfigMap
Returns: Status of the creation operation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes | ||
| name | Yes | ||
| data | Yes |
Implementation Reference
- tools/configmap.py:30-51 (handler)The main handler function implementing the logic to create a Kubernetes ConfigMap using CoreV1Api after permission checks.def configmap_create(context_name: str, namespace: str, name: str, data: dict): """ Create a ConfigMap in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ConfigMap name data: The data to store in the ConfigMap Returns: Status of the creation operation """ from kubernetes.client import V1ConfigMap, V1ObjectMeta core_v1: CoreV1Api = get_api_clients(context_name)["core"] configmap = V1ConfigMap( metadata=V1ObjectMeta(name=name), data=data ) created_configmap = core_v1.create_namespaced_config_map(namespace=namespace, body=configmap) return {"name": created_configmap.metadata.name, "status": "Created"}
- tools/configmap.py:27-27 (registration)The @mcp.tool() decorator registers the configmap_create function with the MCP server.@mcp.tool()
- server/server.py:10-10 (registration)Import statement in load_modules() that loads the configmap module, triggering the tool registration via decorators.import tools.configmap # noqa: F401
- tools/configmap.py:30-42 (schema)Type annotations and docstring define the input schema (parameters) and output format for the tool.def configmap_create(context_name: str, namespace: str, name: str, data: dict): """ Create a ConfigMap in the specified namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ConfigMap name data: The data to store in the ConfigMap Returns: Status of the creation operation """