insert_text
Replace or insert text at specific line ranges in files using line-number operations. Ideal for large files or precise edits without context-heavy processing.
Instructions
Insert or replace text at precise line ranges in files
Ideal for direct line-number operations (from code citations like 12:15:file.ts) and large files where context-heavy editing is inefficient.
TIP: Combine with read_symbol to edit any symbol anywhere without knowing its file or line range!
Input Schema
Name | Required | Description | Default |
---|---|---|---|
file_path | Yes | Path to the file | |
from_line | Yes | Starting line number (1-based) | |
text | Yes | Text to insert | |
to_line | No | Replace up to this line number (1-based, inclusive). If omitted only inserts |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"file_path": {
"description": "Path to the file",
"minLength": 1,
"type": "string"
},
"from_line": {
"description": "Starting line number (1-based)",
"minimum": 1,
"type": "integer"
},
"text": {
"description": "Text to insert",
"type": "string"
},
"to_line": {
"description": "Replace up to this line number (1-based, inclusive). If omitted only inserts",
"minimum": 1,
"type": "integer"
}
},
"required": [
"file_path",
"from_line",
"text"
],
"type": "object"
}