Croway commented on code in PR #27812:
URL: https://github.com/apache/camel/pull/27812#discussion_r4271691502


##########
dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpSecurityInterceptor.java:
##########
@@ -128,7 +131,11 @@ private void sanitizeParameters(InvocationContext ctx) {
             if (params[i] instanceof String s) {
                 String clean = stripControlChars(s);
                 if (clean.length() > maxLen) {
-                    clean = clean.substring(0, maxLen);
+                    // rejected, never cut: a shortened file content or 
replacement would be written as if complete
+                    throw new ToolCallException(
+                            "Argument '" + parameterName(ctx.getMethod(), i) + 
"' is " + clean.length()
+                                                + " characters long, over the 
limit of " + maxLen
+                                                + " 
(camel.mcp.security.max-argument-length); nothing was done");

Review Comment:
   Done in c8c58f39c014: the error now ends with "nothing was done. Change a 
large file in parts with camel_edit_file, or raise 
camel.mcp.security.max-argument-length", and the test asserts the hint.
   
   _Claude Code on behalf of Croway_



-- 
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