Skip to main content
Glama

Edit File

edit
Destructive

Apply targeted exact text replacement to a file while retaining its inode and metadata, then return a unified diff. Pass the SHA from read to reject stale edits from concurrent sessions.

Instructions

Apply a targeted exact text replacement while retaining the existing file inode and metadata. Returns a unified diff; pass the SHA from read to reject stale multi-session edits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path relative to workspace root.
new_textYesReplacement text.
old_textYesExact text to replace. Must match once unless replace_all=true.
replace_allNoReplace all occurrences. Default: false.
workspace_idNoWorkspace id from open_workspace. Omit to use the workspace selected for this MCP session.
expected_sha256NoOptional SHA-256 from read. Fails if another session changed the file.
expected_replacementsNoFail if actual replacement count differs.
Behavior5/5

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

Annotations already carry the destructiveHint, and the description discloses three additional behaviors: in-place modification (inode/metadata preserved), the unified-diff return value, and SHA-based stale-eidt rejection. These give the agent concrete side-effect expectations that the annotation flags alone do not provide.

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?

Two sentences, front-loaded: the first states the action and the key in-place invariant, the second covers the return value and concurrency safety. There is no filler and no repetition of schema content.

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 destructive 7-parameter mutation tool with no output schema, this is close to complete: it states the action, the return format (diff), and the stale-eidt safety mechanism (SHA). It stops short of 5 by not addressing the no-unique-match failure mode or explicit use-vs-sibling boundaries, though the schema's old_text description partially covers match uniqueness.

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 all seven parameters, and the description's SHA mention merely echoes the schema's expected_sha256 text ('Optional SHA-256 from read'). Baseline 3 applies; the description does not materially deepen parameter meaning.

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 action ('Apply a targeted exact text replacement') and a distinguishing invariant ('retaining the existing file inode and metadata'), which separates it from write (full overwrite) and apply_patch (patch-based). It goes well beyond the tautological title 'Edit File'.

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

Usage Guidelines3/5

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

The phrasing 'targeted exact text replacement' and the SHA-from-read workflow imply surgical edits performed after reading the file, but the description never explicitly states when to prefer edit over write, apply_patch, or bash. The when-to-use guidance is inferable rather than stated.

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