Skip to main content
Glama

edit_file

Destructive

Replace a unique file snippet safely—preview the diff without confirm, then confirm to apply; it backs up first.

Instructions

Replace one unique snippet of a file. Without confirm=true it only returns the diff. Backs up first.

Input Schema

NameRequiredDescriptionDefault
newYes
oldYes
pathYes
confirmNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.2

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 readOnlyHint=false, so the safety profile is known; the description still adds real context beyond them: the default is a non-mutating dry-run that returns a diff, and a backup is taken before the write. It leaves open what happens when the snippet is not unique (error vs. abort) and where the backup lives.

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, zero filler, with the core action and the dry-run default front-loaded before the backup note. Every sentence carries information an agent needs.

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?

An output schema exists, so the diff/return shape needs no explanation, and annotations cover the destructive profile. The remaining gap is failure behavior on a non-unique snippet and backup recoverability, which matters for a destructive edit tool but is partially offset by "Backs up first."

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 0%, so the description carries the burden and does explain the critical `confirm` flag plus the uniqueness constraint on `old`. However `path` is never addressed (file vs. directory, relative vs. absolute) and `new` semantics are only implied, leaving half the parameters unelaborated.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

"Replace one unique snippet of a file" names a specific verb and resource and implicitly separates this from the sibling write_file (whole-file write) by scoping it to a single snippet. It stops short of naming the sibling or stating the uniqueness failure mode explicitly, so an agent must infer the boundary.

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?

The sentence "Without confirm=true it only returns the diff" gives an actionable workflow: call without confirm to preview, then call with confirm to apply. There is no explicit exclusion or comparison against write_file for full-file rewrites, which keeps it from a 5.

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