gnodet commented on code in PR #28513:
URL: https://github.com/apache/camel/pull/28513#discussion_r4376508158


##########
components/camel-ai/camel-mcp-server-api/src/main/java/org/apache/camel/component/mcp/server/McpServerBridge.java:
##########
@@ -236,8 +237,14 @@ private void publish(AiToolSpec spec) {
                         spec.getName());
                 return;
             }
+            try {
+                engine.toolAdded(createTool(spec));
+            } catch (McpServerRefusedException e) {
+                LOG.error("Refusing to expose MCP tool '{}': {}", 
spec.getName(), e.getMessage(), e.getCause());
+                return;

Review Comment:
   ```suggestion
                   LOG.error("Refusing to expose MCP tool '{}': {}", 
spec.getName(), e.getMessage(), e);
   ```
   `e.getCause()` is null here (the single-arg `McpServerRefusedException` 
constructor sets no cause), so no stack trace is attached to the log entry. 
Pass `e` directly instead.



##########
components/camel-ai/camel-mcp-server-api/src/main/java/org/apache/camel/component/mcp/server/McpServerBridge.java:
##########
@@ -284,8 +291,13 @@ private void publishResource(AiResourceSpec spec) {
                 }
                 return;
             }
+            try {
+                engine.resourceAdded(createResource(spec));
+            } catch (McpServerRefusedException e) {
+                LOG.error("Refusing to expose MCP resource '{}': {}", 
spec.getUri(), e.getMessage(), e.getCause());
+                return;

Review Comment:
   ```suggestion
                   LOG.error("Refusing to expose MCP resource '{}': {}", 
spec.getUri(), e.getMessage(), e);
   ```
   Same issue: `e.getCause()` is null, losing the stack trace. Pass `e` 
directly.



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