Skip to main content
Glama
ks6573
by ks6573

edit_file

Edit files by replacing exact text with new content. Specify the unique text to find and its replacement, or enable replace_all for multiple occurrences.

Instructions

Make targeted edits to a file using find-and-replace. Provide the exact text to find (old_string) and its replacement (new_string). By default, old_string must appear exactly once (fails if ambiguous). Set replace_all=true to replace all occurrences. ALWAYS read the file first to get the exact text to replace. Requires allow_file_write in ~/.syscontrol/config.json.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute or home-relative path to the file to edit.
new_stringYesReplacement text. Use empty string to delete the matched text.
old_stringYesExact text to find in the file. Must be unique unless replace_all=true.
replace_allNoReplace all occurrences instead of requiring uniqueness (default false).
Behavior4/5

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

Beyond annotations (which provide no safety hints), the description discloses that old_string must be unique and the tool fails if ambiguous, that replace_all changes this, and that allow_file_write permission is required. It stops short of detailing error handling for not-found text or return format.

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?

Four sentences, front-loaded with the action, and every sentence earns its place by conveying usage, requirements, or failure modes. No redundant or fluff content.

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 complexity and the absence of an output schema, the description covers the core editing workflow, prerequisites, and a key failure mode. Minor gaps remain around return values and what happens when old_string is not found, but it's sufficient for typical invocation.

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 already covers all four parameters, but the description adds meaningful nuance: 'fails if ambiguous' for old_string and 'By default' for uniqueness behavior. It also reinforces the role of replace_all, adding error behavior not present in schema.

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?

Clearly states the tool performs targeted find-and-replace edits on files, distinguishing it from sibling tools like write_file or delete_file. The verb 'Make' plus 'targeted edits' and resource 'file' are specific.

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?

Provides explicit instruction to ALWAYS read the file first to get exact text, and explains the uniqueness requirement and replace_all behavior. Does not explicitly name alternative tools or exclusions, but the context makes the appropriate use case clear.

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/ks6573/SysControl'

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