davsclaus commented on code in PR #27812:
URL: https://github.com/apache/camel/pull/27812#discussion_r4269511058
##########
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:
Optional: with the default limit of 10000, `camel_write_file` cannot write a
file larger than about 10 KB in one call while security is on. The agent only
learns that a limit exists. A hint on what to do next would help, for example:
"...; nothing was done. Change a large file in parts with camel_edit_file, or
raise camel.mcp.security.max-argument-length".
--
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]