secret_list
List all Kubernetes Secrets in a specified namespace to manage sensitive configuration data across clusters.
Instructions
List all Secrets in a given namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace
Returns: List of Secret basic information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/secret.py:11-25 (handler)The handler function for the 'secret_list' MCP tool. It lists all Kubernetes Secrets in the specified namespace using the CoreV1Api, returning a list of secret names and types.def secret_list(context_name: str, namespace: str): """ List all Secrets in a given namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace Returns: List of Secret basic information """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] secrets = core_v1.list_namespaced_secret(namespace) result = [{"name": secret.metadata.name, "type": secret.type} for secret in secrets.items] return result
- tools/secret.py:9-10 (registration)The @mcp.tool() decorator registers the secret_list function as an MCP tool, with @use_current_context decorator for context management.@mcp.tool() @use_current_context
- tools/secret.py:11-21 (schema)Type hints and docstring define the input schema (context_name: str, namespace: str) and output (list of dicts with name and type).def secret_list(context_name: str, namespace: str): """ List all Secrets in a given namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace Returns: List of Secret basic information """