Skip to main content
Glama
mcp-server-kubernetes
by Flux159

kubectl_patch

Destructive

Update specific fields of a Kubernetes resource using strategic merge, JSON merge, or JSON patch, with optional dry-run validation before applying changes.

Instructions

Update field(s) of a resource using strategic merge patch, JSON merge patch, or JSON patch

Input Schema

NameRequiredDescriptionDefault
nameYesName of the resource to patch
dryRunNoIf true, only validate the resource, don't actually execute the operation
contextNoKubeconfig Context to use for the command (optional - defaults to null)
namespaceNoKubernetes namespacedefault
patchDataNoPatch data: a JSON object for 'strategic' and 'merge' patches, or an array of JSON Patch operations for patchType 'json'
patchFileNoPath to a file containing the patch data (alternative to patchData). The path is read on the machine running the MCP server, so it is rejected when the server runs over a remote (SSE/Streamable HTTP) transport; use 'patchData' to pass the patch contents instead.
patchTypeNoType of patch to applystrategic
resourceTypeYesType of resource to patch (e.g., pods, deployments, services)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv4.2.1
    • changedInput schema / properties / patchData / description
      Previous value: -"Patch data as a JSON object"New value: +"Patch data: a JSON object for 'strategic' and 'merge' patches, or an array of JSON Patch operations for patchType 'json'"
    • changedInput schema / properties / patchData / type
      Previous value: -"object"New value: +[
      +  "object",
      +  "array"
      +]
  2. Changed1 schema field changedv4.1.1
    • changedInput schema / properties / patchFile / description
      Previous value: -"Path to a file containing the patch data (alternative to patchData)"New value: +"Path to a file containing the patch data (alternative to patchData). The path is read on the machine running the MCP server, so it is rejected when the server runs over a remote (SSE/Streamable HTTP) transport; use 'patchData' to pass the patch contents instead."
  3. Addedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

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

The only annotation is destructiveHint=true, and the description adds nothing on top of it — no mention that this mutates live cluster state, that strategic merge can delete list entries not present in the patch, or that dryRun exists as a validation escape hatch. The sentence is essentially the kubectl CLI synopsis, so it carries no behavioral context beyond what the schema and annotation already say.

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

Conciseness4/5

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

A single front-loaded sentence with no filler; the operative verb and the three supported modes come first. It is efficient but so terse that the brevity shades into under-specification rather than tight writing.

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

Completeness3/5

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

For an 8-parameter destructive mutation with no output schema, the schema fully covers the inputs and the annotation flags the risk, so an agent can technically invoke it correctly. What is missing is the decision context — patch versus apply, and what a patch response or conflict looks like — which matters given the sibling set.

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

Parameters3/5

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

Schema description coverage is 100%, so all 8 parameters including dryRun, context, patchData vs patchFile, and the patchType enum are documented in the schema itself. The description merely restates the three patch modes already enumerated in the patchType enum and adds no syntax, format, or trade-off detail.

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

Purpose4/5

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

Names a specific verb (update) and resource (Kubernetes resource fields) and enumerates the three patch strategies the tool supports, which is more specific than a bare name restatement. It does not, however, distinguish itself from kubectl_apply or kubectl_create, both of which also mutate resource fields, so an agent cannot pick between them from this sentence alone.

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

Usage Guidelines2/5

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

There is no statement of when to prefer patch over kubectl_apply, when patchType 'json' is required versus 'strategic', or what happens on conflicting field ownership. The agent is left to infer the entire selection logic from Kubernetes background knowledge.

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