Skip to main content
Glama

Amend file

amend_file
DestructiveIdempotent

Edits part of a small plain-text file (.md, .txt, .html, .json) without sending the whole file: replaces one piece of text with new text, saved as a new version in the file's history. find must occur exactly once - if it is missing or appears more than once, nothing changes and you are told so; add surrounding text to make it unique. base_version is required: pass the file's currentVersion exactly as read_file or list returned it, and if the file changed since, nothing is written and you get its current version. Does not work on pdf / doc / ppt / image / .csv / .xls / .xlsx or large files - use update_file or create_upload for those. To replace the whole text use update_file.

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>",
      "base_version": "<base_version>",
      "find": "<find>",
      "replace": "<replace>",
      "context": "<context>"
    },
    "name": "amend_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
findYesThe exact text to replace. It must occur exactly once in the file.
pathYesFull path of the file to amend, e.g. '/reports/q3.md'.
contextYesExplain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): "Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization."
replaceYesThe text to put in its place. An empty string deletes the found text.
base_versionYesThe file's currentVersion exactly as read_file or list returned it.
workspace_idNoWhich workspace to act in - a workspace id (whoami returns the id of your default workspace). Omit to use your default workspace.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Beyond annotations it discloses the unique-match contract for find, that a miss or duplicate is a no-op with a message, the optimistic-concurrency requirement on base_version and the stale-file outcome, and that the edit is preserved as a new version in file history. That last point materially softens the destructiveHint by showing prior content is recoverable, which annotations alone would not convey.

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?

Purpose and scope are front-loaded, then failure modes, then exclusions with alternatives. It is dense but nearly every sentence carries information; the closing 'to replace the whole text use update_file' is mildly duplicative of the earlier exclusions but cheap and useful as a tail instruction.

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 mutation tool with no output schema it explains failure paths (not unique, stale version) and where version data comes from, which is what an agent needs to call it correctly. It does not state what a success response contains (e.g. the new currentVersion to chain further edits), a minor remaining gap.

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 semantics: find must occur exactly once and you may extend surrounding text to disambiguate, and base_version must be the exact currentVersion as returned by read_file or list with stale values rejected. Those are behavioral constraints the schema text does not fully capture.

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 first sentence gives a specific verb and resource (edits part of a small plain-text file, replacing one piece of text with new text) and names the exact supported extensions. It also explicitly distinguishes itself from update_file (whole-file replacement) and create_upload, so an agent can pick it without opening a sibling 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?

It states when to use it (surgical edit of a small text file), when not to (pdf/doc/ppt/image/.csv/.xls/.xlsx and large files), and which alternatives to use in those cases (update_file, create_upload). Replacement-of-whole-file is routed to update_file, so exclusion and alternatives are both explicit.

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