Save Context
cm_k8s_cluster_save_contextRegister a new Kubernetes context in the container-manager-mcp kubeconfig for later reuse, with token, mTLS, OIDC, import, or current-cluster capture options.
Instructions
Save context (cm_k8s_cluster). Manage Kubernetes cluster resources (nodes, contexts, CSRs, API resources, cluster info, admission plugins).
The save_context action registers a NEW Kubernetes environment into
the kubeconfig container-manager-mcp reads so it can be reused later
(via use_context / CONTAINER_MANAGER_KUBECONTEXT / K8S_CONTEXTS).
Four input modes, non-destructive (a context-name collision errors unless
overwrite): token (context_name + server + token +
ca_cert or insecure_skip_tls_verify), mTLS (context_name +
server + client_cert + client_key + ca_cert), oidc
(context_name + server + username + password +
oidc_issuer + oidc_client_id — drives an OIDC password-grant login
and embeds the id-token; the API server has no basic auth, so this REQUIRES
the OIDC params and fails clearly otherwise), and import (source_file/
source_yaml to merge an existing kubeconfig, or capture_current=True
to export the cluster you are currently on). namespace is optional. With
use it becomes current-context; with validate the saved context is
loaded and node count returned.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "cm_k8s_cluster_save_context"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| use | No | save_context: set current-context to the saved context | |
| token | No | save_context (explicit): bearer token for authentication | |
| server | No | save_context (explicit): API server URL, e.g. https://10.0.0.10:6443 | |
| ca_cert | No | save_context (explicit): cluster CA cert as a file path or PEM text | |
| password | No | save_context (oidc): password for the OIDC resource-owner password grant | |
| username | No | save_context (oidc): username for an OIDC-backed cluster (requires oidc_issuer + oidc_client_id; the API server has no basic auth) | |
| validate | No | save_context: after saving, load the context and list_nodes to validate reachability | |
| namespace | No | Target namespace for affinity operations | |
| overwrite | No | save_context: replace an existing context on name collision (default: error) | |
| client_key | No | save_context (explicit): client key as a file path or PEM text | |
| client_cert | No | save_context (explicit): client cert as a file path or PEM text | |
| oidc_issuer | No | save_context (oidc): OIDC issuer URL, e.g. https://keycloak/realms/<realm> | |
| source_file | No | save_context (import): path to an existing kubeconfig file to merge | |
| source_yaml | No | save_context (import): raw kubeconfig YAML to merge | |
| context_name | No | Context name | |
| oidc_client_id | No | save_context (oidc): OIDC client id used for the login | |
| capture_current | No | save_context (capture): export the cluster cm is currently on and save it under 'context_name' | |
| kubeconfig_path | No | save_context: target kubeconfig to write (default: $KUBECONFIG first entry, else ~/.kube/config) | |
| oidc_client_secret | No | save_context (oidc): OIDC client secret for confidential clients (optional) | |
| insecure_skip_tls_verify | No | save_context (explicit): skip TLS verification instead of pinning a CA |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |