Skip to main content
Glama

Applypatch

applyPatch

Apply a unified diff to one existing local file with GNU patch, using a configurable strip level and restricted options.

Instructions

Apply diff from stdin to one explicit local file using GNU patch.

pnum is GNU patch's -pNUM value. The target must be an existing regular file beneath the configured current directory. Additional options are restricted to a small allowlist that cannot select input/output files, another target, a directory, or a different strip value.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNo
diffYes
fileYes
pnumNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A3.9/5.0
Behavior4/5

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

No annotations are present, so the description carries the full burden, and it does disclose real behavior: the diff arrives via stdin, the target must be an existing regular file under the configured current directory, and extra options are allowlisted so they cannot redirect input/output, retarget, or change the strip value. It omits mutation semantics such as whether writes are atomic and what happens on failure, keeping it short of a 5.

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?

Front-loaded with the core action, then the pnum semantics, then the constraints. Every sentence carries information; no padding or restatement of the tool name.

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?

An output schema exists, so return values need no explanation, and the description covers the sandbox and target constraints well. Remaining gaps are failure/atomicity behavior for a mutation tool with no annotations, but overall it is sufficient to invoke correctly.

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 0%, so the description must compensate, and it does for most parameters: pnum is explained as GNU patch's -pNUM, diff is explained as coming from stdin, file as the target, and args as an allowlisted option channel. args is only covered indirectly, so it is not a full 5.

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?

The description names a specific verb+resource ('Apply diff from stdin to one explicit local file using GNU patch') and specifies the mechanism. It is clear and distinctive versus generic edits, though it never names a sibling (editFile, writeFile, cmdshell) to route against.

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?

Usage is implied by the stdin-diff mechanics and the requirement that the target be an existing regular file, which gently separates it from writeFile/editFile. However, no explicit when-to-use or when-not guidance is given despite many overlapping file-mutation siblings.

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