Skip to main content
Glama

Save Context

cm_k8s_cluster_save_context

Register 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

NameRequiredDescriptionDefault
useNosave_context: set current-context to the saved context
tokenNosave_context (explicit): bearer token for authentication
serverNosave_context (explicit): API server URL, e.g. https://10.0.0.10:6443
ca_certNosave_context (explicit): cluster CA cert as a file path or PEM text
passwordNosave_context (oidc): password for the OIDC resource-owner password grant
usernameNosave_context (oidc): username for an OIDC-backed cluster (requires oidc_issuer + oidc_client_id; the API server has no basic auth)
validateNosave_context: after saving, load the context and list_nodes to validate reachability
namespaceNoTarget namespace for affinity operations
overwriteNosave_context: replace an existing context on name collision (default: error)
client_keyNosave_context (explicit): client key as a file path or PEM text
client_certNosave_context (explicit): client cert as a file path or PEM text
oidc_issuerNosave_context (oidc): OIDC issuer URL, e.g. https://keycloak/realms/<realm>
source_fileNosave_context (import): path to an existing kubeconfig file to merge
source_yamlNosave_context (import): raw kubeconfig YAML to merge
context_nameNoContext name
oidc_client_idNosave_context (oidc): OIDC client id used for the login
capture_currentNosave_context (capture): export the cluster cm is currently on and save it under 'context_name'
kubeconfig_pathNosave_context: target kubeconfig to write (default: $KUBECONFIG first entry, else ~/.kube/config)
oidc_client_secretNosave_context (oidc): OIDC client secret for confidential clients (optional)
insecure_skip_tls_verifyNosave_context (explicit): skip TLS verification instead of pinning a CA

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.4.2

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations it discloses that the operation is non-destructive with a collision error unless overwrite, that OIDC mode drives a password-grant login and fails clearly when OIDC params are absent, and that validate re-loads the context and returns a node count. Some of this restates destructiveHint=false, and it never warns that credentials get written into the target kubeconfig — a relevant gap for a secret-persisting write.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The actionable content is dense and front-loaded after a generic preamble, but the opening sentence 'Manage Kubernetes cluster resources (nodes, contexts, CSRs, API resources, cluster info, admission plugins)' is cluster-tool boilerplate that does not describe this action and only delays the useful information. The mode enumeration itself earns its length.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 20-parameter write tool with an output schema and full annotation coverage, the description covers all four modes, the validate/use side effects, and the overwrite default, which is close to complete. Remaining minor gaps are the plaintext-storage implication of writing credentials and how the default kubeconfig target is chosen.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description goes beyond per-parameter text by grouping the 20 parameters into four mutually exclusive combinations and stating which fields each mode requires. That combination logic is not expressible in the flat schema and directly reduces mis-invocation risk.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: it registers a NEW Kubernetes environment into the kubeconfig that container-manager-mcp reads. It then enumerates the four supported input modes (token, mTLS, oidc, import), which makes the tool's scope unambiguous and clearly distinct from the sibling that consumes the result (use_context).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explains the downstream purpose (reuse via use_context / CONTAINER_MANAGER_KUBECONTEXT / K8S_CONTEXTS) and the collision policy (errors unless overwrite), which tells the agent when this is the right tool versus switching contexts. It does not explicitly name a sibling tool to avoid or a 'do not use when' condition, so it stops short of full routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools