Skip to main content
Glama

Apply Patch

apply_patch
Destructive

Apply a unified diff patch to update multiple files in a workspace. Validates file paths before applying to ensure changes stay within allowed directories.

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 the workspace selected for this MCP session.
Behavior4/5

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

Path validation before applying is a concrete behavioral guarantee beyond the annotations. The destructiveHint annotation already signals that the operation can alter files, and the description adds a safety-relevant precondition. It does not elaborate on rollback or partial-failure behavior, but the annotation coverage lowers the burden.

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?

Three short sentences convey purpose, safety behavior, and routing guidance with no filler. The most important directive is front-loaded, and every sentence earns its place.

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 mutation tool with destructiveHint provided, the description covers purpose, safety validation, and sibling selection. The absence of an output schema is not a major gap because the main usage decision is clearly scoped. A minor omission is explicit failure semantics, but the description remains complete enough for correct invocation.

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%, with clear parameter descriptions for patch and workspace_id. The tool description adds little parameter-level detail beyond the schema, which matches the baseline of 3. No undocumented parameters need compensation.

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 the tool from the sibling edit tool by framing apply_patch as the multi-file diff option. This gives an agent a clear identity for selection.

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?

It explicitly states when to use which tool: 'Prefer edit for tiny replacements and apply_patch for multi-file diffs.' This direct alternative-selection guidance eliminates ambiguity between the two most similar siblings.

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/kaiserproger/agent-loom'

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