Text Line-based Editing Toolset Documentation
This toolset provides tools for editing text-based files within the current directory using line-based operations to replace and insert text.
When using this toolset make sure to instruct the AI model to read text files with line numbers included.
str_insert_in_text_file
Insert text at a specific line-number location in a text file within the current directory.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path |
String | Yes | The relative path to the text file to modify. |
insert_line |
Integer | Yes | The line number after which to insert the text (0 for beginning of file, -1 to append at the end) |
insert_text |
String | Yes | The text to insert |
Notes
- Ensures the file is within the current directory and is a text file.
- Returns the modified contents of the file.
str_replace_lines_in_text_file
Replace a range of lines in a text file with given text. Ensures the file is within the current directory and is a text file.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path |
String | Yes | The relative path to the file where you want to perform the replacement. |
line_range |
Array | Yes | An array of two integers specifying the start and end line numbers. Line numbers are 1-indexed, and -1 for the end line means read to the end of the file. |
new_str |
String | Yes | The new text to insert in place of the replaced lines. |
Notes
- Ensures the file is within the current directory and is a text file.
- Returns a success or error message. Does not return the contents of the modified file.