Skip to main content
Glama

Edit File (Kilo-Kit Hard-Gated)

kilo_edit_file
Destructive

Perform exact target search-and-replace edits in an existing file, validating code syntax with an AST check before changes are applied.

Instructions

Perform exact targeted search-and-replace edit on an existing file with AST check. PROTOCOL HARD-GATE: Requires valid sessionId in 'ready' state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileNoAlias for filePath
pathNoAlias for filePath
formatNomarkdown
filePathNoRelative or absolute path to file
sessionIdYesActive Kilo-Kit session ID (must be in ready state)
allowMultipleNoAllow multiple replacements
targetContentYesExact content substring to replace
decision_narrationNoMANDATORY INTER-TOOL NARRATION: State what you just concluded, verified, or analyzed before calling this tool. Appears in terminal tool badge for full user observability.
replacementContentYesReplacement content
next_action_narrationNoMANDATORY: State what this tool will execute and what immediate action follows.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and idempotentHint=false, so the description's job is lighter. It adds valuable context by disclosing the AST-check behavior and a hard-gate protocol requirement that isn't captured by annotations, which helps an agent understand preconditions and verification.

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?

Two tightly focused sentences with no filler, and the critical gate condition is front-loaded in capitals. It is appropriately sized for a simple edit tool, though the all-caps gate phrasing is slightly stylized.

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?

No output schema exists, so the description need not explain return values. It covers the core operation, the AST check, and the session gate, which is sufficient for a 10-parameter but structurally simple tool. Minor gaps around replacement failure behavior remain but are not critical.

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 90%, so the schema already documents most parameters (targetContent, replacementContent, sessionId, aliases, narration fields). The description does not add parameter-level detail beyond what the schema provides, so baseline 3 applies.

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?

States a precise verb and resource ('exact targeted search-and-replace edit on an existing file') plus the AST verification mechanism. This clearly distinguishes it from siblings like kilo_write_file (whole-file writes) and kilo_read_file.

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 hard-gate condition (valid sessionId in 'ready' state) implies when the tool can be used, but there is no explicit guidance on when to prefer this edit tool over kilo_write_file or other editing alternatives. Usage is implied rather than stated.

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