Skip to main content
Glama

MCP Filesystem Server

MIT License
47
  • Apple
  • Linux

edit_file_at_line

Modify text files by editing specific lines with actions like replace, insert, or delete, enabling precise content changes while supporting verification, offsets, and dry runs for accuracy and control.

Instructions

Edit specific lines in a text file.

Args: path: Path to the file line_edits: List of edits to apply. Each edit is a dict with: - line_number: Line number to edit (0-based if relative_line_numbers=True, otherwise 1-based) - action: "replace", "insert_before", "insert_after", "delete" - content: New content for replace/insert operations (optional for delete) - expected_content: (Optional) Expected content of the line being edited for verification offset: Line offset (0-based) to start considering lines limit: Maximum number of lines to consider relative_line_numbers: Whether line numbers in edits are relative to offset abort_on_verification_failure: Whether to abort all edits if any verification fails encoding: Text encoding (default: utf-8) dry_run: If True, returns what would be changed without modifying the file ctx: MCP context Returns: Edit results summary

Input Schema

NameRequiredDescriptionDefault
abort_on_verification_failureNo
dry_runNo
encodingNoutf-8
limitNo
line_editsYes
offsetNo
pathYes
relative_line_numbersNo

Input Schema (JSON Schema)

{ "properties": { "abort_on_verification_failure": { "default": false, "title": "Abort On Verification Failure", "type": "boolean" }, "dry_run": { "default": false, "title": "Dry Run", "type": "boolean" }, "encoding": { "default": "utf-8", "title": "Encoding", "type": "string" }, "limit": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Limit" }, "line_edits": { "items": { "type": "object" }, "title": "Line Edits", "type": "array" }, "offset": { "default": 0, "title": "Offset", "type": "integer" }, "path": { "title": "Path", "type": "string" }, "relative_line_numbers": { "default": false, "title": "Relative Line Numbers", "type": "boolean" } }, "required": [ "path", "line_edits" ], "title": "edit_file_at_lineArguments", "type": "object" }

Other Tools from MCP Filesystem Server

Related Tools

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/safurrier/mcp-filesystem'

If you have feedback or need assistance with the MCP directory API, please join our Discord server