Skip to main content
Glama
flafkus
by flafkus

edit_file

Destructive

Replace an exact substring in an Overleaf project file and upload the result, allowing precise text updates without rewriting the whole file. Supports replacing all occurrences or forcing overwrite when needed.

Instructions

Replace an exact substring in a project file and upload the result.

Fails if old is missing, or if it appears more than once and replace_all is false. Prefer this over write_file for a paragraph or sentence change.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
newYesReplacement text
oldYesExact text to find (must match once unless replace_all)
pathYesPath inside the project, e.g. main.tex
forceNoOverwrite even if the file changed since the last read
projectYesProject id (24-char hex) or exact name
replace_allNoReplace every occurrence if old appears more than once

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already flag destructive and non-idempotent behavior, so the bar is lower. The description adds useful behavioral detail by stating exact-match failure modes and the 'upload the result' side effect, though it does not elaborate on the force-overwrite implications beyond the schema.

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 sentences cover the core operation, edge-case failures, and sibling-tool guidance with no filler. Information is front-loaded and every sentence earns its place.

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?

With a rich schema, an output schema, and annotations, the description covers the remaining decision-relevant context: when to use this tool and how it behaves when matches are missing or ambiguous. Nothing critical is missing for an agent to call it correctly.

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?

Schema coverage is 100%, so the schema already documents all six parameters. The description reinforces the meaning of old/new and replace_all but adds little beyond the schema, which is acceptable given the baseline.

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?

Describes a specific operation: replacing an exact substring in a project file and uploading the result. The wording is concrete and the explicit comparison with write_file distinguishes it from its closest sibling.

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?

Explicitly instructs agents to prefer edit_file over write_file for paragraph or sentence changes, giving a clear decision rule. It also spells out failure conditions and when replace_all is necessary.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.