insert_into_file
Insert content into a file at a specified line position using the MCP File Editor Server. Choose to insert before or after a target line, or append to the end, with content verification for precise file modifications.
Instructions
Insert content into a file at a specific line position.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
contents | Yes | Content to insert | |
file_path | Yes | Absolute path to the file | |
line_contents | Yes | Expected content of the target line (used for verification) | |
line_number | Yes | Line number to insert at (1-based). Use 0 to append to end. | |
where | Yes | Whether to insert before or after the target line |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"contents": {
"description": "Content to insert",
"type": "string"
},
"file_path": {
"description": "Absolute path to the file",
"type": "string"
},
"line_contents": {
"description": "Expected content of the target line (used for verification)",
"type": "string"
},
"line_number": {
"description": "Line number to insert at (1-based). Use 0 to append to end.",
"minimum": 0,
"type": "integer"
},
"where": {
"description": "Whether to insert before or after the target line",
"enum": [
"before",
"after"
],
"type": "string"
}
},
"required": [
"file_path",
"line_number",
"line_contents",
"where",
"contents"
],
"type": "object"
}