Skip to main content
Glama

Edit file

code_edit
Destructive

Change part of a text file: replace one exact string, leaving the rest as it is. oldString must occur exactly once unless replaceAll is set. Returns the change and the tree's problems after 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": {
      "path": "<path>",
      "oldString": "<oldString>",
      "newString": "<newString>",
      "org": "<org>"
    },
    "name": "code_edit"
  }
}

Input Schema

NameRequiredDescriptionDefault
orgYesslug of the organization whose trees and sites to use. Required on every call, even when only one organization is listed; a path never names it.
pathYesThe file's address, <tree>:<path>.
messageNoA brief note on the change.
newStringYesThe text to put in its place.
oldStringYesThe exact text to replace, copied from the file as read.
ifRevisionNoThe revisionId returned by code_read; refuse unless the file is still at it.
replaceAllNoReplace every occurrence.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false, so the safety profile is carried. The description still adds genuine behavior: the uniqueness rule for oldString, the replaceAll override that removes that safeguard, and a note that the response includes the change plus the tree's problems. It does not say what happens when the string is absent or the revision has moved, which would have pushed this higher.

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?

Three short sentences with the core action front-loaded, followed by the constraint and the return note. Nothing is redundant and no sentence could be dropped without losing information.

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 seven-parameter destructive mutation with no output schema, the description covers the core action, the key constraint, and the shape of the response. Remaining gaps—failure behavior on a missing match and the meaning of ifRevision—are partly mitigated by detailed schema descriptions.

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 each parameter is already documented individually. The description goes beyond that by explaining the interaction between oldString and replaceAll—a relational rule the schema does not state—which is real added meaning rather than a restatement.

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 description names a specific operation on a specific resource: replacing one exact string inside a text file while leaving the rest untouched. That wording distinguishes it in spirit from whole-file siblings like code_write, although it never names an alternative explicitly.

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: 'Change part of a text file' signals a partial edit, and 'oldString must occur exactly once unless replaceAll is set' is a real usage constraint. There is no explicit guidance on when to choose this over code_write, code_update, or wiki_edit, nor any mention of prerequisites such as reading the file first.

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