Skip to content

Fix filesystem edit_file literal dollar replacements#4225

Open
kgarg2468 wants to merge 1 commit into
modelcontextprotocol:mainfrom
kgarg2468:kgarg/fix-filesystem-literal-dollar-edits
Open

Fix filesystem edit_file literal dollar replacements#4225
kgarg2468 wants to merge 1 commit into
modelcontextprotocol:mainfrom
kgarg2468:kgarg/fix-filesystem-literal-dollar-edits

Conversation

@kgarg2468
Copy link
Copy Markdown

Fixes #4157

Summary

  • Treat edit_file replacement text literally when using the exact-match replacement path
  • Use the callback form of String.prototype.replace so $, $&, $\``, and $'` are not interpreted as replacement patterns
  • Add regression coverage for literal dollar replacement content

Tests

  • cd src/filesystem && npx vitest run __tests__/lib.test.ts
  • cd src/filesystem && npm run build
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

filesystem: edit_file newText interpreted as String.prototype.replace replacement-pattern (literal $ corrupted)

1 participant