Skip to main content
Glama

patch

Apply unified diff patches to files with encoding awareness. Preview changes using dry_run to verify without modifying.

Instructions

Applies a unified diff patch to a file. Parses @@ hunk headers, verifies context lines, and applies changes. Encoding-aware: preserves original file encoding. Use dry_run=true to preview without modifying the file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathNoAbsolute path to the file to patch
pathNoAlias for file_path
patchYesUnified diff text (output of the diff tool)
dry_runNoPreview patch result without modifying the file: true or false. Default: false
Behavior3/5

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

With no annotations, the description must disclose behavior. It states the tool is encoding-aware and supports dry_run. However, it does not mention failure modes, conflict resolution, or whether the file is modified in-place. The transparency is adequate but incomplete.

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?

The description is concise at four sentences, with the purpose front-loaded. It efficiently conveys core functionality and a key usage tip. A slightly more structured format could improve readability, but it is already effective.

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?

Given the tool's complexity (applying patches, 4 parameters, no output schema), the description covers essential aspects: purpose, parsing behavior, encoding awareness, and dry_run option. However, it omits information about return values or error handling, leaving some gaps for an AI agent.

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?

The input schema covers all parameters with descriptions (100% coverage). The description adds minimal parameter-specific insight, only mentioning dry_run usage and implicitly indicating that file_path/path target the file. It does not significantly extend the schema's meaning.

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 clearly states 'Applies a unified diff patch to a file', providing a specific verb and resource. It further details the parsing of @@ hunk headers and context verification, making the tool's function unambiguous and distinct from siblings like diff or edit.

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 description offers limited guidance: it mentions using dry_run=true for previewing. However, it does not specify when to use this tool versus alternatives (e.g., edit or write), nor does it provide criteria for when not to use it. The handling of patch formats is implied but not explicitly advised.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/knewstimek/agent-tool'

If you have feedback or need assistance with the MCP directory API, please join our Discord server