Skip to main content
Glama

Edit File

edit_file
Destructive

Apply precise line-based edits to text files, replacing exact line sequences with new content and returning a git-style diff. Works only within allowed directories.

Instructions

Make line-based edits to a text file. Each edit replaces exact line sequences with new content. Returns a git-style diff showing the changes made. Only works within allowed directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
editsYes
dryRunNoPreview changes using git-style diff format

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.0.1

TDQS

A4/5.0
Behavior4/5

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

The description goes beyond the annotations by revealing that the tool returns a git-style diff and is restricted to allowed directories. It confirms the destructive nature (edits) consistent with the destructiveHint annotation but adds useful behavioral context about the output and scope. It does not fully disclose edge-case behaviors (e.g., multiple matches, error handling), but the additional information is valuable.

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 concise, consisting of two short sentences. It packs essential information—purpose, mechanism, output, and constraint—without any redundant or fluff content. Every sentence adds value, and the structure is straightforward and easy to parse.

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 tool with three parameters and a nested edits array, the description provides sufficient context to understand the main functionality: line-based edits with exact matching and a diff result. It also covers the directory restriction. It omits details like error handling when oldText is not found, the exact format of the diff, and the behavior of dryRun, but these are not critical for a basic understanding. The description is complete enough for typical usage.

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?

The description explains the core semantics of the edits array by stating that each edit replaces exact line sequences (oldText) with new content (newText). It also indirectly describes the path via the allowed-directories constraint and mentions the diff output, which relates to the dryRun parameter (though not explicitly named). However, it does not clarify the dryRun flag's purpose or behavior, and path semantics are only implied, so coverage is partial given three parameters.

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 clearly states the tool's purpose: making line-based edits to a text file. It specifies the action (edits), the resource (text file), and the specific mechanism (replacing exact line sequences). It also distinguishes itself from sibling tools by mentioning the git-style diff output and the restriction to allowed directories, making its scope clear.

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 when to use the tool (for precise line-based changes) by explaining that it replaces exact line sequences and returns a diff, but it does not explicitly compare it to alternatives like write_file or search_files. The constraint 'Only works within allowed directories' is more of a limitation than a usage guideline, so the guidance is implicit rather than explicit.

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

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/TimurRakhmatullin86/mcp-drill'

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