gnodet-bot commented on code in PR #29722:
URL: https://github.com/apache/camel/pull/29722#discussion_r4561083622


##########
components/camel-ai/camel-mcp-server-api/src/main/java/org/apache/camel/component/mcp/server/McpServerBridge.java:
##########
@@ -453,8 +569,8 @@ private McpResourceReadResult read(AiResourceSpec spec) {
                 return McpResourceReadResult.blob(binary.value());
             } else {
                 AiResourceResult.ExecutionError error = 
(AiResourceResult.ExecutionError) result;
-                // never leak raw route exception messages to remote MCP 
clients
-                LOG.warn("MCP resource '{}' read failed: {}", spec.getUri(), 
error.message(), error.cause());
+                // Keep details in the server-side log; the MCP client still 
receives a generic error.
+                LOG.warn("MCP resource '{}' read failed: {}", spec.getName(), 
error.message());

Review Comment:
   ⚠️ **Missing `error.cause()` as SLF4J throwable arg — stack trace is lost**
   
   The old line passed `error.cause()` as the third SLF4J argument after the 
two `{}` placeholders. SLF4J treats a trailing `Throwable` as the exception to 
log with its full stack trace. The new line omits it, so conversion errors 
(`"produced no content"`, `"cannot be converted to String"`) and 
type-conversion failures are logged with only the message — the stack trace and 
cause chain are silently discarded.
   
   For a route exception, `AiResourceExecutor` already logs the full stack 
trace at ERROR, so the bridge WARN line there is intentionally terse. But for 
the `ExecutionError` branch (which covers `convertBody` failures), the bridge 
is the only log site — without the cause, the operator sees `"MCP resource 
'my_resource' read failed: Resource 'my_resource' produced a body that cannot 
be converted to String"` with no indication of where the type conversion failed.
   
   ```suggestion
                   LOG.warn("MCP resource '{}' read failed: {}", 
spec.getName(), error.message(), error.cause());
   ```



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