Skip to main content
Glama

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
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
dataYes

Implementation Reference

  • 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"}
  • 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
  • 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
        """

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