Skip to main content
Glama

Edit a project file (find & replace)

dreamagent_edit_file
Destructive

WRITE ACTION — make SMALL targeted changes to an EXISTING file in a DreamAgent project via exact search/replace. PREFERRED over dreamagent_write_file for editing existing files: you send only the changed fragments (never the whole file) — cheaper, immune to payload size/safety blocks in the calling client, and cannot corrupt unchanged code. Use dreamagent_write_file only to CREATE files or for full rewrites.

Read the file first (dreamagent_read_file) and copy each 'find' text EXACTLY as it appears — whitespace and indentation must match. All edits are validated BEFORE anything is saved; if any 'find' fails to match, the file is left untouched and the error tells you which edit and why.

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>",
      "file_path": "<file_path>",
      "edits": "<edits>"
    },
    "name": "dreamagent_edit_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
editsYeslist of edit objects: {"find": "<exact existing text>", "replace": "<new text>", "all": false} # optional: replace every occurrence
confirmNomust be true to execute.
file_pathYesproject-relative path of the EXISTING file to edit.
project_idYesproject containing the file.
auto_commitNocommit+push and record version history after saving (default true; pass false to batch several edit_file calls and finish with one dreamagent_commit_push).

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.7/5.0
Behavior5/5

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

Goes well beyond the annotations (readOnlyHint=false, destructiveHint=true) by disclosing the all-or-nothing validation model: edits are checked before saving, a single failed match leaves the file untouched, and the error identifies which edit failed and why. It also explains the motivation for fragments — cheaper, immune to client payload safety blocks, and unable to corrupt untouched code.

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?

Front-loaded with the action and the sibling comparison before prerequisites, which is the right order. Capitalized emphasis and multi-clause sentences make it denser and louder than strictly necessary, but no sentence is filler.

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 5-parameter destructive write tool with an output schema, the description covers prerequisites, exact-match semantics, atomicity, failure messaging, and the batching workflow. The only omission is the confirm=true execution gate, which the 100%-covered schema already documents.

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 100%, so the baseline is 3, but the description adds real meaning: the 'find' text must be copied byte-exact including whitespace, and auto_commit=true triggers commit+push and version history while false batches across calls. The confirm gate is left to the schema, which already documents 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 opens with a concrete verb and resource — 'make SMALL targeted changes to an EXISTING file ... via exact search/replace' — and immediately contrasts itself with dreamagent_write_file. An agent can distinguish this from every sibling without opening a schema.

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?

Explicit routing rules: this tool is PREFERRED for editing existing files, dreamagent_write_file is only for creating files or full rewrites, and dreamagent_read_file must be called first. It also states the alternative workflow for batching via auto_commit=false plus dreamagent_commit_push.

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.