Skip to content

feat: add FileInsertContent and FileDeleteContent MCP tools for line-based file operations#311

Merged
butschster merged 1 commit intomainfrom
issue/310
Jan 19, 2026
Merged

feat: add FileInsertContent and FileDeleteContent MCP tools for line-based file operations#311
butschster merged 1 commit intomainfrom
issue/310

Conversation

@butschster
Copy link
Copy Markdown
Collaborator

Add two new MCP file manipulation tools to complement the existing FileReplaceContent tool:

  • FileInsertContent: Insert content at specific line number(s) with automatic line offset calculation for batch operations
  • FileDeleteContent: Delete content at specific line number(s) with support for single lines and ranges

Key features:

  • Line-based operations when pattern matching is not ideal
  • Support for batch insertions/deletions with automatic offset tracking
  • Insert position control (before/after specified line)
  • Range deletion support (e.g., {"line": 5, "to": 10})
  • End-of-file insertion using line=-1

DTOs use typed arrays with #[Field] attributes for proper JSON schema generation:

  • InsertionItem: line (int) + content (string)
  • DeletionItem: line (int) + optional to (int) for ranges

Closes #310

…based file operations

Add two new MCP file manipulation tools to complement the existing FileReplaceContent tool:
  - FileInsertContent: Insert content at specific line number(s) with automatic
    line offset calculation for batch operations
  - FileDeleteContent: Delete content at specific line number(s) with support     for single lines and ranges

Key features:
  - Line-based operations when pattern matching is not ideal
  - Support for batch insertions/deletions with automatic offset tracking
  - Insert position control (before/after specified line)
  - Range deletion support (e.g., {"line": 5, "to": 10})
  - End-of-file insertion using line=-1

  DTOs use typed arrays with #[Field] attributes for proper JSON schema generation:
  - InsertionItem: line (int) + content (string)
  - DeletionItem: line (int) + optional to (int) for ranges

  Closes #310
@butschster butschster added this to the 1.34 milestone Jan 18, 2026
@butschster butschster self-assigned this Jan 18, 2026
@butschster butschster added mcp MCP server components mcp:action MCP server actions mcp:tools MCP server tools labels Jan 18, 2026
@butschster butschster merged commit 51de26b into main Jan 19, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mcp:action MCP server actions mcp:tools MCP server tools mcp MCP server components

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

FileInsertContent and FileDeleteContent Tools

1 participant