configmap_list
Retrieve and list all ConfigMap details in a specified Kubernetes namespace using context name. Enables efficient cluster resource management with the MCP server k8s-pilot.
Instructions
List all ConfigMaps in a given namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace
Returns: List of ConfigMap basic information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/configmap.py:8-24 (handler)The main handler function for the 'configmap_list' tool. It lists all ConfigMaps in the given namespace using the Kubernetes API. Registered via @mcp.tool() decorator.@mcp.tool() @use_current_context def configmap_list(context_name: str, namespace: str): """ List all ConfigMaps in a given namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace Returns: List of ConfigMap basic information """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] configmaps = core_v1.list_namespaced_config_map(namespace) result = [{"name": cm.metadata.name} for cm in configmaps.items] return result
- server/server.py:10-10 (registration)Import statement that loads the tools.configmap module, triggering the @mcp.tool() decorator to register the 'configmap_list' tool.import tools.configmap # noqa: F401