Describe the bug
The edit_file tool fails with "Cannot convert undefined or null to object" when newText parameter contains PowerShell expressions with dollar signs and parentheses, specifically $($null -eq $toolObject.Config).
To Reproduce
Steps to reproduce the behavior:
Use edit_file tool with newText containing PowerShell expression: $($null -eq $toolObject.Config)
Tool attempts to parse JSON parameter
Error occurs: "Cannot convert undefined or null to object"
Expected behavior
The edit_file tool should handle PowerShell code with dollar signs and complex expressions without JSON parsing errors, or provide clear documentation about required escaping.
Logs
Error executing code: Cannot convert undefined or null to object
Additional context
The error occurs during JSON parameter parsing in the MCP filesystem server's edit_file function when PowerShell variables and expressions are used in newText strings. Dollar signs in PowerShell code appear to interfere with JSON processing.
Describe the bug
The edit_file tool fails with "Cannot convert undefined or null to object" when newText parameter contains PowerShell expressions with dollar signs and parentheses, specifically $($null -eq $toolObject.Config).
To Reproduce
Steps to reproduce the behavior:
Use edit_file tool with newText containing PowerShell expression: $($null -eq $toolObject.Config)
Tool attempts to parse JSON parameter
Error occurs: "Cannot convert undefined or null to object"
Expected behavior
The edit_file tool should handle PowerShell code with dollar signs and complex expressions without JSON parsing errors, or provide clear documentation about required escaping.
Logs
Error executing code: Cannot convert undefined or null to object
Additional context
The error occurs during JSON parameter parsing in the MCP filesystem server's edit_file function when PowerShell variables and expressions are used in newText strings. Dollar signs in PowerShell code appear to interfere with JSON processing.