Skip to main content
Glama

Apply a unified diff

apply_patch
Read-onlyIdempotent

Apply a single-file unified diff (patch) to text and return the patched text, or applied:false if a hunk does not match. Optional fuzz 0-2.

Input Schema

NameRequiredDescriptionDefault
fuzzNo
textYes
patchYesUnified diff with @@ hunks.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.5/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, closed-world, so the safety profile is covered. The description goes beyond them by disclosing the failure mode ('applied:false if a hunk does not match') and the successful return value (patched text), which is exactly the behavior an agent needs to plan error handling.

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?

A single tight sentence with the core action first, followed by the failure mode and the optional tolerance. No filler, nothing that could be cut.

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?

Good that it states the return shape since there is no output schema, and the hunk-mismatch case is covered. But with 33% schema coverage and no explanation of fuzz behavior or how multi-file patches are rejected, an agent still has gaps before invoking it confidently.

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 coverage is 33%: only 'patch' is described in the schema. The description mentions 'text' as the target and 'fuzz 0-2', but the fuzz bounds merely restate the schema's minimum/maximum and it never explains what fuzz actually does (tolerated context mismatch), which is the one piece of semantics the schema cannot convey.

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?

Specific verb+resource: 'Apply a single-file unified diff (patch) to text', with the return value named. The 'single-file' qualifier bounds scope usefully. It does not name diff_text or text_similarity, so an agent must infer the contrast from the verb 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 reach for this tool versus diff_text or text_similarity, nor any precondition guidance (e.g., patch must target the supplied text). Only the implicit 'single-file' scope limit hints at usage limits.

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