davsclaus opened a new pull request, #29925:
URL: https://github.com/apache/camel/pull/29925

   Item 6 of [CAMEL-26932](https://issues.apache.org/jira/browse/CAMEL-26932).
   
   ## Problem
   
   `camel_edit_file` of the MCP server passes its arguments through 
`AuthoringTools.args()`, which leaves out blank strings, so a tool's default 
applies. A `replace` of only whitespace (`"\n"`, `"  "`, the indentation of a 
YAML line) was dropped, and the registry tool then replaced the found text with 
nothing: the text was deleted, and the answer said "edited". In YAML, 
whitespace is structure.
   
   ## Change
   
   `camel_edit_file` passes `replace` to the registry tool as it is, blank 
included, when the call gives it. The other arguments still go through 
`args()`. The registry tool already keeps a blank replace (`replace == null ? 
"" : replace`), and the `edits` list was not affected (`editsJson` keeps the 
values).
   
   `camel_write_file` with empty content is still refused. The JIRA mentions it 
too, but it refuses rather than destroying anything, so it stays as it is.
   
   ## Tests
   
   - `AuthoringToolsTest.aReplaceOfOnlyWhitespaceIsKept`: `TODO` in 
`greeting=hello TODO world` replaced by one space gives three spaces. Without 
the fix the test fails (the space is lost).
   - camel-jbang-mcp: 546 tests pass, built in a reactor with core.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to