Skip to main content
Glama

Edit a file

edit_file

Replace an exact string in an Overleaf project file and save changes via Git or web mode. Requires a unique match unless replace_all is set.

Instructions

Replace an exact string in a project file and save it to Overleaf. old_string must match exactly once unless replace_all is set. Uses Git; falls back to the opt-in web mode if enabled.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath relative to the project root.
projectNoProject ID or Overleaf project URL (or project name in web mode). Defaults to OVERLEAF_PROJECT_ID.
new_stringYesReplacement text.
old_stringYesExact text to replace, including whitespace.
replace_allNoReplace every occurrence instead of requiring a unique match.
commit_messageNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It usefully discloses the storage mechanism (Git) and a fallback to an opt-in web mode, plus the unique-match precondition. It omits mutation-relevant context such as permission/auth requirements, what happens if the match fails, and whether the edit is reversible outside Git versioning.

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?

Three tight sentences with the core action front-loaded, followed by the matching constraint and the storage behavior. No filler; each sentence adds distinct information.

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 mutation tool with no annotations and no output schema, the description covers storage and fallback behavior but leaves gaps around failure modes, permissions, and what a successful/failed edit returns. Adequate but not complete given the complexity.

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 83%, so the schema already documents most parameters. The description adds genuine meaning beyond the schema by explaining the coupling between old_string and replace_all (exact unique match unless replace_all is set), which clarifies replace_all's purpose better than its bare property description.

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+resource ('Replace an exact string in a project file') and names the persistence target (Overleaf). It implicitly distinguishes itself from the sibling write_file by describing a targeted string replacement rather than a full overwrite, but never names that 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?

The description implies use (targeted edits rather than whole-file writes) and gives the matching precondition (old_string must match exactly once unless replace_all). However, it never states when to prefer this over write_file or write_markdown, so the routing guidance is only implied.

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