Skip to main content
Glama

apply_edit

Destructive

Applies a previewed edit by its id and keeps that id so undo can revert it. Fails if any file changed since the preview.

Instructions

Write a previewed edit (the id comes from a write tool's preview). The applied edit keeps that id, so undo_edit(id) reverts it. Fails if any file changed since the preview.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "id": "<id>"
    },
    "name": "apply_edit"
  }
}

Input Schema

NameRequiredDescriptionDefault
idYes
allow_largeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.0.4

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and non-idempotent, so the safety profile is covered. The description adds genuinely non-obvious behavior: the applied edit retains the preview id, undo_edit(id) reverts it, and the call fails on stale previews. That is real context beyond the annotations, though it says nothing about what allow_large changes or the failure response shape.

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 tight sentences, front-loaded with the action, then the id lifecycle, then the failure condition. No filler and each clause carries operational weight.

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?

For a destructive, non-idempotent write tool the core workflow (preview → apply → undo) and the staleness guard are well covered. The omission of `allow_large` semantics is a real gap, since that flag plausibly governs whether a large edit is permitted and an agent has no basis to set it.

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 carry all parameter meaning. It explains where `id` originates and that it persists, but never describes the expected format, and `allow_large` is not mentioned at all — leaving the agent to guess when to set it.

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 names a specific verb and resource — writing a *previewed* edit — and immediately ties it to a named sibling (undo_edit) for the reverse operation. An agent can distinguish this from a plain edit tool because the id must originate from a prior preview.

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

Usage Guidelines4/5

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

Usage context is explicit: the id comes from a write tool's preview, so this is the second step of a preview-then-apply flow. It also states the prerequisite condition ('fails if any file changed since the preview'), which effectively tells the agent when not to call it. It stops short of naming the exact sibling preview tool or alternatives like verify_changes.

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