Skip to main content
Glama

repo_apply_patch

Apply a validated unified text patch atomically to multiple repository files, preventing partial multi-file edits if validation fails.

Instructions

Atomically apply one validated unified text patch.

One patch may contain multiple repository text-file targets. All targets are validated before mutation and Git applies the patch as one locked operation, so a target failure does not leave a partial multi-file edit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patchYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
diffYes
branchYes
appliedYes
targetsYes
warningYes
truncatedYes
repositoryYes
result_hashYes
hidden_filesYes
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It goes beyond the schema by explaining atomicity ('Git applies the patch as one locked operation'), validation ('All targets are validated before mutation'), and the guarantee that a target failure does not leave a partial multi-file edit. This is substantial behavioral context, though it does not address side effects like staging or committing.

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?

The description is two sentences, front-loaded with the primary action ('Atomically apply...'). Every sentence adds value: the first defines the operation and format, the second elaborates on multi-file atomic behavior. No redundancy or filler.

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?

For a simple single-parameter tool with an output schema, the description is largely complete. It covers the core behavior (atomic apply), validation, and multi-file handling. It could mention prerequisites (e.g., patch must be relative to current HEAD) or explicit return behavior, but given the output schema exists, these omissions are acceptable.

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?

The schema has one parameter 'patch' with no description (0% coverage). The description compensates by explaining that the patch is a 'unified text patch' and can contain multiple repository text-file targets. It also implies validation semantics. While it doesn't give detailed syntax, it adds meaningful meaning beyond the bare schema definition.

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 the tool's function: 'Atomically apply one validated unified text patch.' It identifies the specific resource (repository text files) and distinguishes it from siblings like repo_git_diff (which shows diffs) and repo_git_commit (which commits changes). The phrase 'One patch may contain multiple repository text-file targets' further clarifies scope.

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 implies the use case: applying a unified patch to a repository. It does not explicitly name alternatives or state when NOT to use this tool. Given siblings like repo_git_commit and repo_run_test, there is no direct comparison or exclusion. The atomicity and multi-target details provide some context, but explicit when-to-use/alternatives guidance is missing.

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/cloud-Xolt/local-repo-mcp'

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