Edit File (Lines)
fc_edit_fileEdit files by line: replace, insert, or delete specific lines using 1-based line numbers, enabling precise text changes without rewriting the whole file.
Instructions
Edits a file line-based: replace, insert, or delete.
Args:
path (string): Path to the file
operation (string): "replace" | "insert" | "delete"
start_line (number): Start line (1-based)
end_line (number, optional): End line for replace/delete
content (string, optional): New content for replace/insert
Examples:
Replace lines 5-10: operation="replace", start_line=5, end_line=10, content="new text"
Insert after line 3: operation="insert", start_line=3, content="new line"
Delete lines 7-9: operation="delete", start_line=7, end_line=9
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>",
"operation": "<operation>",
"start_line": "<start_line>"
},
"name": "fc_edit_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the file | |
| content | No | New content | |
| end_line | No | End line | |
| operation | Yes | Operation | |
| start_line | Yes | Start line (1-based) |