Skip to main content
Glama

Edit file (ToolAhead)

edit_file

Replace an exact string in a workspace text file with new text to fix errors or update content. Optionally replace all occurrences.

Instructions

Replace an exact string in a workspace text file. Use this ToolAhead edit after ToolAhead read_file; it follows the familiar file_path, old_string, new_string, and replace_all contract. Edits execute normally and are never prefetched, cached, or replayed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesAbsolute path or path relative to the workspace.
new_stringYesReplacement text.
old_stringYesExact text to replace; include context when it is not unique.
replace_allNoReplace every occurrence (default false).
Install Server

TDQS

A4.2/5.0
Behavior4/5

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

The description adds that edits 'execute normally and are never prefetched, cached, or replayed,' which is behavioral context beyond the annotations. The annotations already indicate non-read-only and non-idempotent, and the description is consistent, not contradictory.

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?

The description is two concise sentences with the core action upfront. Every clause adds value—purpose, usage sequence, and execution semantics—with no redundancy.

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?

Given full schema coverage, annotations, and no output schema, the description covers the essential how and when to use, plus execution behavior. It doesn't detail error cases or return values, but those are not strictly required for a simple edit tool.

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 the schema already documents all parameters. The description only names the parameters via 'familiar ... contract' without adding semantic details beyond the schema, hence a baseline score.

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 description explicitly states 'Replace an exact string in a workspace text file,' which is a specific verb and resource. It also names the contract parameters and positions itself relative to read_file, distinguishing it from sibling tools like read_file and write_file.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It instructs to 'Use this ToolAhead edit after ToolAhead read_file,' providing clear usage context. However, it doesn't explicitly state when not to use it or contrast with alternatives like write_file, so it falls short of full exclusions.

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

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/michael-ra/toolahead'

If you have feedback or need assistance with the MCP directory API, please join our Discord server