Skip to main content
Glama

Apply patch

apply_patch
Destructive

Use this when you already have a unified diff with one or more hunks and want to apply it to one or several files. Do not use write_file for the same patch-shaped change, and prefer edit_block when the change is one exact text block rather than a diff.

Input Schema

NameRequiredDescriptionDefault
pathNoApply every hunk to this file, ignoring the patch headers.
patchYesUnified diff, including ---/+++ headers and @@ hunks.
deviceYesReMCP device id returned by list_devices. Required for every device operation.
dry_runNoReport the diff without writing. Default false.

Output Schema

NameRequiredDescriptionDefault
dataNoOptional structured result data for follow-up reasoning and tool calls.
textYesConcise human-readable result of the tool call.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. First observed

TDQS

A4.2/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false, so the write/destructive nature is covered. The description adds no extra behavioral context beyond saying it applies a patch, which is essentially the same as the annotation. It doesn't mention dry_run or failure modes, but those are in the schema. Thus it meets the minimum but adds little beyond annotations.

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?

Two concise sentences: the first states the primary use case, the second gives exclusions and alternatives. Every word earns its place, and the most important information is front-loaded.

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?

With a full schema (100% coverage) and an output schema present, the description does not need to repeat parameter details. It provides sufficient context for when to use the tool and its alternatives. The only slight gap is that it doesn't mention the destructive nature explicitly, but that's covered by annotations. Overall, an agent has everything needed to call it correctly.

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 parameters are already documented. The description doesn't add any additional meaning about parameters (e.g., the relationship between path and patch, or device requirement). It only reinforces the tool's purpose, so baseline 3 is appropriate.

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 action: applying a unified diff with one or more hunks to one or more files. It clearly distinguishes itself from write_file and edit_block, making it unambiguous.

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

Usage Guidelines5/5

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

It explicitly tells when to use this tool (when you have a unified diff) and when not to (not for patch-shaped changes via write_file, prefer edit_block for exact text blocks). This is exemplary guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources