Skip to main content
Glama

Edit part of a file

edit_file
Destructive

Replaces old_text with new_text in a file. old_text must match exactly once (include a little surrounding text to make it unique), unless replace_all is true. The change appears live in Manulyx for anyone with the file open. If tracking of your edits is on for this project (the default, or the owner requires tracking), it is recorded as a tracked change under the person's name and yours that can be accepted or rejected; otherwise it is applied directly and kept in History.

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": {
      "project_id": "<project_id>",
      "path": "<path>",
      "old_text": "<old_text>",
      "new_text": "<new_text>"
    },
    "name": "edit_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes
new_textYesThe replacement (may be empty to delete the passage).
old_textYesExact text to replace, as it is in the file now.
project_idYesThe project's id, from list_projects.
replace_allNoReplace every occurrence instead of requiring exactly one.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.8/5.0
Behavior4/5

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

Beyond the annotations (destructiveHint=true, readOnlyHint=false), the description adds substantial context: the change appears live to anyone with the file open, and edits may become tracked changes requiring accept/reject versus being applied directly and kept in History. It does not state what happens on a failed match or whether the operation is atomic, which keeps it from a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core action is front-loaded in the first sentence, followed by the matching constraint and then the collaboration/tracking effects. Three sentences, no filler, though the final sentence is long and packs two distinct behaviors together.

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, non-idempotent mutation on a collaborative document, the description covers the ambiguity constraint, the live-visibility side effect, and the tracking/History outcome. Missing pieces are modest: the error behavior when old_text does not match and how tracking mode is determined beyond the parenthetical.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 80%, so the baseline is 3. The description adds meaning the schema does not: the exactly-once matching requirement and the practical advice to include surrounding text for uniqueness, plus the replace_all escape hatch. That genuinely augments parameter understanding beyond the field descriptions.

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?

The first sentence gives a precise verb and resource: 'Replaces old_text with new_text in a file.' This is clearly a partial-content edit rather than a whole-file write, which implicitly separates it from write_file. It does not explicitly name the sibling boundary, so it stops short of a 5.

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?

Usage guidance is present but is really constraint guidance: old_text must match exactly once, and you should include surrounding text for uniqueness unless replace_all is true. There is no explicit statement about when to choose edit_file over write_file or how to handle a non-matching old_text, so the agent must infer the alternative.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources