Skip to main content
Glama

Apply Patch

apply_patch
Destructive

Apply unified diff patches to multiple files in the workspace, with path validation to avoid unsafe changes. Use for batch modifications across the repository.

Instructions

Apply one unified diff patch inside the workspace. Paths are validated before applying. Prefer edit for tiny replacements and apply_patch for multi-file diffs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patchYesUnified diff patch to apply. File paths must stay inside the workspace and avoid blocked paths.
workspace_idNoWorkspace id from open_workspace. Omit to use default workspace.
Behavior4/5

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

Annotations already cover destructiveHint=true, readOnlyHint=false, and idempotentHint=false. The description adds useful safety-relevant context beyond the annotations: paths are validated before applying, and the patch is confined to the workspace. There is no contradiction between the description and annotations.

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 three short sentences, each earning its place: it states the operation, mentions a key safety behavior, and gives tool-selection guidance. There is no redundant filler or repetition of schema contents.

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?

The tool has only two parameters, full schema coverage, and annotations that communicate destructive behavior. The description sufficiently covers scope, validation, and when to use it. Details like failure behavior or partial-apply semantics are not spelled out, but they are not necessary for selecting and invoking the tool correctly.

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 description coverage is 100%, so the schema already documents both patch and workspace_id. The description reinforces the path validation and workspace constraint, but it does not add meaningfully new parameter-level details such as patch formatting, defaults, or examples, so the baseline score applies.

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 opens with a specific verb and resource: 'Apply one unified diff patch inside the workspace.' It also distinguishes apply_patch from its nearest sibling edit by explicitly saying apply_patch is for multi-file diffs, so the agent can tell it apart without needing to inspect other tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives direct selection guidance: 'Prefer edit for tiny replacements and apply_patch for multi-file diffs.' This explicitly names the alternative and the condition for choosing each tool, leaving no ambiguity about when to use apply_patch.

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/Nippori709/AgentDock'

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