Skip to main content
Glama

apply_patch

Apply a unified diff patch to a workspace while enforcing patch limits, ensuring controlled modifications for PR automation.

Instructions

Apply a unified diff patch and enforce patch limits.

The patch is written to a temporary file inside the sandbox and applied
using ``git apply``.  Patch limits are enforced before application.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
unified_diffYes
workspace_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior3/5

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

The description discloses several behavioral details: the patch is written to a temporary file, applied via git apply, and patch limits are enforced before application. However, with no annotations, it omits critical information for a mutation tool, such as reversibility, required permissions, failure handling, and whether changes are committed. The provided details add context but are not comprehensive.

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, immediately states the core purpose, and every sentence provides operational detail (temporary file, git apply, limits) without redundancy or fluff. It is appropriately sized and well-structured.

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 existence of an output schema, return values need not be explained. However, the description lacks specifics on workspace_id semantics, the nature of patch limits, and post-application effects (e.g., whether changes are staged or committed). It provides a moderate overview but leaves gaps for a potentially complex operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for parameter meanings. The 'unified_diff' parameter is implicitly explained by 'Apply a unified diff patch', but 'workspace_id' is not described at all, leaving its purpose and format unclear. The description adds minimal value for parameter understanding.

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 'Apply a unified diff patch and enforce patch limits' clearly identifies the tool's specific action (applying a patch) and resource (unified diff). It distinguishes itself from sibling tools like write_file (full-file rewrite) and repo_commit (git commit) by focusing on diff-based patching.

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?

The description does not provide explicit guidance on when to use this tool versus alternatives such as write_file or repo_commit. It mentions the mechanism (git apply) but gives no context on ideal use cases, exclusions, or scenarios where other tools are preferred. Usage is implied by the tool's name but not elaborated.

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/saakshigupta2002/PR_Orchestrator_MCP'

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