Skip to main content
Glama

Edit a project file (find & replace)

dreamagent_edit_file

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.

CONFIRM BEFORE CALLING — show the user the target file and each planned find→replace change, then call only with confirm=true.

Input Schema

TableJSON 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

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.9/5.0
Behavior5/5

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

Goes well beyond the annotations: it discloses atomic all-or-nothing validation ('if any find fails to match, the file is left untouched'), the exact-match whitespace requirement, the confirm=true gate, and the auto_commit batching guidance. The destructiveHint=false annotation is consistent with the described non-corrupting, validated behavior.

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?

Front-loaded with a capitalized action label, then segmented into clear paragraphs for behavior, prerequisites, and confirmation. Despite its length, every sentence carries operational information (cost/safety rationale, validation semantics, confirm gate); no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a write tool with an output schema present, the description covers what it need not (return format) and what it must: atomicity, exact-match requirements, confirmation, and the batching interaction with dreamagent_commit_push. Nothing an agent needs to invoke it correctly is missing.

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 already 100%, so baseline is 3, but the description meaningfully augments the critical 'edits' parameter by stressing that 'find' text must be copied EXACTLY including whitespace and indentation, and explains the confirm/auto_commit workflow implications. This adds real operational meaning beyond the schema text.

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?

States a specific verb (exact search/replace edits), resource (existing file in a DreamAgent project) and scope (small, targeted changes). It explicitly distinguishes itself from dreamagent_write_file, so an agent can route correctly without opening either 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?

Gives an explicit preference rule (PREFERRED over dreamagent_write_file for editing), names the exclusion (use write_file only to CREATE or fully rewrite), and prescribes a prerequisite (read the file first) plus a confirmation workflow. Nothing is left to inference.

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.