Skip to main content
Glama
kagan-sh

Kagan - AI Orchestration Layer

fs_edit_file

Apply text replacements in a file by specifying old and new text strings. Preserves original BOM and line endings.

Instructions

Apply one or more old→new text replacements to an existing file.

Preserves the file's original BOM and line-ending style (CRLF/LF). Each edit must supply "old_text" (unique substring) and "new_text".

Returns: {"path", "bytes_written", "bom_preserved", "eol_style"}.

Raises on: empty old_text, text not found, duplicate matches, overlapping edits, replacement produces identical content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
editsYes
Behavior4/5

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

No annotations are provided, so the description carries full responsibility. It discloses preservation of BOM and line-ending style, return fields, and error conditions (empty old_text, not found, duplicates, overlapping, identical content). This is thorough, though it could mention atomicity or permissions.

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 and front-loaded: the first sentence states the core purpose. Subsequent lines cover behavioral details, return value, and error conditions without redundancy. Every sentence adds value.

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 the tool's 2 required parameters (path, edits) and no output schema, the description adequately explains inputs, outputs, and errors. It could specify whether edits are applied sequentially or simultaneously, but this is a minor gap for an editing tool of moderate 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?

The input schema has 0% description coverage, leaving the tool's parameter semantics entirely to the description. The description adds meaning by specifying that edits must contain 'old_text' and 'new_text' fields (though schema shows additionalProperties: true) and that 'path' is required. It does not fully detail the structure of edits objects (e.g., data types), but compensates well for the schema gap.

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 applies one or more old→new text replacements to an existing file, with a specific verb and resource. It distinguishes from sibling tools like fs_read_file and fs_write_file which handle entire file content.

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?

The description explains that each edit must supply 'old_text' (unique substring) and 'new_text', providing clear usage guidance. However, it does not explicitly state when to use this tool over alternatives like fs_write_file for full file rewrites.

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

Install Server

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/kagan-sh/kagan'

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