Skip to main content
Glama

edit_file

Replace exact text in an attached project file and push the update to Overleaf by providing the file path, old text, and replacement text.

Instructions

Replace exact text in a file of the attached project and push it to Overleaf.

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>",
      "old_text": "<old_text>",
      "new_text": "<new_text>"
    },
    "name": "edit_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesFile to edit, relative to the project root.
messageNoCommit message shown in Overleaf's history.
new_textYesReplacement text.
old_textYesExact text currently in the file, including whitespace and line breaks. Must be unique unless replace_all is true.
replace_allNoReplace every occurrence instead of requiring exactly one.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior4/5

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

Annotations declare readOnlyHint=false, destructiveHint=false and openWorldHint=true, so the safety profile is covered. The description adds the significant behavioral fact that the edit is immediately pushed to Overleaf, meaning changes go live remotely rather than staying local — context an agent would not get from other structured fields.

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?

A single front-loaded sentence with no wasted words; the core action comes first and the remote push is stated as a trailing clause. It could be marginally richer, but nothing is superfluous.

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 output schema, the definition covers purpose and the remote push, and the schema covers parameter semantics fully. It stops short of stating failure behavior (e.g., when old_text is absent or non-unique) or whether the push is immediate and unconditional, which an agent writing files would benefit from knowing.

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 description coverage is 100%, so path, old_text, new_text, message and replace_all are all documented in the schema, including the uniqueness requirement. The description adds no additional meaning about these parameters beyond the schema, which is the expected baseline when coverage is high.

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 verb ("Replace") and resource ("exact text in a file") plus scope ("of the attached project") and side effect ("push it to Overleaf"). It is clearly distinguishable from read_file/list_files, though it does not explicitly contrast with the closest siblings write_file or apply_edits.

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 only implied: "replace exact text" signals that the agent must already know the current file contents, which nudges toward read_file first, and the mention of the attached project scopes it. However, there is no explicit when-to-use versus write_file/apply_edits and no stated exclusions.

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