Skip to main content
Glama

Edit a draft's file

edit_file
Destructive

Replace the exact text old by new in a draft's file, or lines first_line to last_line, given with first_text and last_text, their whole text as read_file gave it.

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": {
      "app": "<app>",
      "path": "<path>",
      "new": "<new>"
    },
    "name": "edit_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
appYesThe app, as list_apps names it, such as sam/budget.
newYesEmpty removes `old` or the lines.
oldNo
pathYes
sizeNoThe file's size in bytes, from read_file.
last_lineNo
last_textNo
first_lineNo
first_textNo
replace_allNo

Schema Changelog

Changes observed during successful MCP inspections.

No schema history has been recorded yet.

TDQS

B3.3/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false and idempotentHint=false, so the safety profile is known. The description adds real value beyond that by explaining exact-match replacement and that an empty `new` deletes the matched text or lines, which is a deletion semantic the annotations do not convey. It does not disclose the size/staleness check or failure behavior when `old` is absent.

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

Conciseness3/5

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

It is a single compact sentence with no filler, which is good. But the trailing clause 'given with first_text and last_text, their whole text as read_file gave it' is grammatically tangled and forces re-reading, so brevity costs clarity rather than aiding it.

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

Completeness3/5

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

For a 10-parameter destructive mutation with no output schema, the description covers the core edit semantics reasonably but leaves the agent guessing about the size precondition, the replace_all behavior, and what happens when the target text is not found. It is adequate to attempt a call but not to call it confidently on the first try.

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?

With only 30% schema coverage across 10 parameters, the description carries weight and does explain the two edit modes and why first_text/last_text exist (they anchor the line range from the earlier read). However, `app`, `path`, `size`, and especially `replace_all` are left to the schema, and `size`'s role as a staleness guard is never spelled out, so it only partially compensates for the coverage gap.

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?

States a specific verb and resource: replace exact text `old` with `new` in a draft's file, with an alternative line-range mode. It references read_file as the source of the whole-text anchors, which helps distinguish the operation from a plain write. Scope (draft vs published file) is only implied by the word 'draft', 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 is implied rather than stated: the mention of first_text/last_text 'as read_file gave it' signals that a prior read is expected, and 'draft's file' suggests edits target drafts. But there is no explicit when-to-use vs write_file, no statement of what happens on a non-matching `old`, and no prerequisites for `size`.

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