Skip to main content
Glama

Apply patch

apply_patch
Destructive

Stage, validate, and atomically apply patch envelopes to code files, with dry-run support for safe verification before changes are committed.

Instructions

Stage, validate, and atomically apply a patch envelope. Example: *** Begin Patch *** Update File: app.py @@ -old +new *** End Patch

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patchYes
dry_runNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
errorNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.2

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already mark the tool as destructive and non-idempotent. The description adds a useful layer: it validates before applying and applies atomically, which tells the agent that a failed validation should not leave partial edits. It does not spell out failure output, but it enriches the behavioral contract beyond the annotations without contradicting them.

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

Conciseness5/5

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

One concise lead sentence states the key behavior, followed immediately by a compact example that demonstrates the exact envelope syntax. Every line earns its place; there is no filler.

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?

The presence of an output schema covers return-value expectations, and the example covers patch syntax. Still, the dry_run semantics and what happens when validation fails are left implicit, which are meaningful gaps for an agent deciding whether to perform a destructive write or a trial run.

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?

With 0% schema description coverage, the description must carry parameter meaning. It does teach the required patch envelope format through a concrete example, which is valuable. However, the dry_run parameter is never mentioned or explained; an agent must infer its behavior from the name and default value.

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 opens with a specific verb and resource: 'Stage, validate, and atomically apply a patch envelope.' This is far more informative than the title and clearly identifies a distinct file-modification capability among siblings like read_file and exec_command. The inline example pins down the exact input format, so an agent cannot confuse it with other tools.

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

Usage Guidelines3/5

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

The patch-envelope example implies that this is the intended mechanism for structured file edits, but the description never states when to prefer it over alternatives (e.g., exec_command or git apply) or when not to use it. It provides context but no explicit exclusions or alternative tool names.

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