This is an automated email from the ASF dual-hosted git repository.

oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new b865ecb9fe2d CAMEL-23473: camel-jbang-mcp - drop verbose description 
from catalog list responses and lower default limit (#23414)
b865ecb9fe2d is described below

commit b865ecb9fe2d2984995c2ed1d73fa9cbeda9e5f0
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu May 21 13:15:25 2026 +0200

    CAMEL-23473: camel-jbang-mcp - drop verbose description from catalog list 
responses and lower default limit (#23414)
    
    Slims down the four MCP catalog list tools (camel_catalog_components,
    camel_catalog_dataformats, camel_catalog_languages, camel_catalog_eips).
    Each list item previously carried a multi-sentence description and the
    default limit allowed up to 50 items; for the LLM consumer the description
    is rarely needed at list time (the matching *_doc tool already returns it)
    and a smaller page keeps the initial response lean.
    
    - ComponentInfo, DataFormatInfo, LanguageInfo, EipInfo: description field
      removed; mapping methods updated.
    - camel_catalog_components and camel_catalog_dataformats default limit
      lowered from 50 to 20. The languages and eips list tools did not expose
      a limit argument before and are unchanged.
    - camel_catalog_components tool description updated to point at
      camel_catalog_component_doc for descriptions.
    - Upgrade-guide entry added under camel-jbang-mcp in
      camel-4x-upgrade-guide-4_21.adoc.
    
    Two new tests guard the contract: listInfoRecordsCarryNoDescription
    (reflective across all four list records) and 
defaultLimitCapsResultsAtTwenty.
---
 .../ROOT/pages/camel-4x-upgrade-guide-4_21.adoc    |  7 ++++++
 .../dsl/jbang/core/commands/mcp/CatalogTools.java  | 29 ++++++++++------------
 .../jbang/core/commands/mcp/CatalogToolsTest.java  | 12 +++++++++
 .../commands/mcp/McpJsonSerializationTest.java     | 22 +++++++++++++++-
 4 files changed, 53 insertions(+), 17 deletions(-)

diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc
index 38c45e94bc31..3942a19cadca 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_21.adoc
@@ -111,6 +111,13 @@ The `groupId`, `artifactId`, and `version` fields have 
been removed from the `ca
 response. A new `camel_catalog_component_maven` tool returns just those Maven 
coordinates and should be
 called only when you actually need to add the component as a dependency.
 
+The list-style catalog tools — `camel_catalog_components`, 
`camel_catalog_dataformats`,
+`camel_catalog_languages`, and `camel_catalog_eips` — no longer return the 
verbose
+`description` field in their per-item entries. Callers that need the full 
description should call
+the matching `*_doc` tool. The default `limit` for `camel_catalog_components` 
and
+`camel_catalog_dataformats` is also lowered from 50 to 20; pass an explicit 
`limit` to restore the
+previous behaviour.
+
 ==== camel-jbang plugins
 
 Plugins are now loaded lazily. Built-in commands that do not consume plugins
diff --git 
a/dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/CatalogTools.java
 
b/dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/CatalogTools.java
index 3242c1beabe2..a1e9291964f9 100644
--- 
a/dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/CatalogTools.java
+++ 
b/dsl/camel-jbang/camel-jbang-mcp/src/main/java/org/apache/camel/dsl/jbang/core/commands/mcp/CatalogTools.java
@@ -47,18 +47,19 @@ public class CatalogTools {
      * Tool to list available Camel components.
      */
     @Tool(annotations = @Tool.Annotations(readOnlyHint = true, destructiveHint 
= false, openWorldHint = false),
-          description = "List available Camel components from the catalog. " +
-                        "Returns component name, description, and labels. " +
-                        "Use filter to search by name, label to filter by 
category.")
+          description = "List available Camel components from the catalog. "
+                        + "Returns component name, title, and labels (no 
description; call "
+                        + "camel_catalog_component_doc for that). "
+                        + "Use filter to search by name, label to filter by 
category.")
     public ComponentListResult camel_catalog_components(
             @ToolArg(description = "Filter components by name 
(case-insensitive substring match)") String filter,
             @ToolArg(description = "Filter by category label (e.g., cloud, 
messaging, database, file)") String label,
-            @ToolArg(description = "Maximum number of results to return 
(default: 50)") Integer limit,
+            @ToolArg(description = "Maximum number of results to return 
(default: 20)") Integer limit,
             @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
             @ToolArg(description = ToolArgDocs.VERSION_QUERY) String 
camelVersion,
             @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String 
platformBom) {
 
-        int maxResults = limit != null ? limit : 50;
+        int maxResults = limit != null ? limit : 20;
 
         try {
             CamelCatalog cat = catalogService.loadCatalog(runtime, 
camelVersion, platformBom);
@@ -194,12 +195,12 @@ public class CatalogTools {
                         "(e.g., json, xml, csv, avro, protobuf).")
     public DataFormatListResult camel_catalog_dataformats(
             @ToolArg(description = "Filter by name") String filter,
-            @ToolArg(description = "Maximum results (default: 50)") Integer 
limit,
+            @ToolArg(description = "Maximum results (default: 20)") Integer 
limit,
             @ToolArg(description = ToolArgDocs.RUNTIME) String runtime,
             @ToolArg(description = ToolArgDocs.CAMEL_VERSION) String 
camelVersion,
             @ToolArg(description = ToolArgDocs.PLATFORM_BOM) String 
platformBom) {
 
-        int maxResults = limit != null ? limit : 50;
+        int maxResults = limit != null ? limit : 20;
 
         try {
             CamelCatalog cat = catalogService.loadCatalog(runtime, 
camelVersion, platformBom);
@@ -416,7 +417,6 @@ public class CatalogTools {
         return new ComponentInfo(
                 model.getScheme(),
                 model.getTitle(),
-                model.getDescription(),
                 model.getLabel(),
                 model.isDeprecated(),
                 model.getSupportLevel() != null ? 
model.getSupportLevel().name() : null);
@@ -513,22 +513,19 @@ public class CatalogTools {
         return new DataFormatInfo(
                 model.getName(),
                 model.getTitle(),
-                model.getDescription(),
                 model.isDeprecated());
     }
 
     private LanguageInfo toLanguageInfo(LanguageModel model) {
         return new LanguageInfo(
                 model.getName(),
-                model.getTitle(),
-                model.getDescription());
+                model.getTitle());
     }
 
     private EipInfo toEipInfo(EipModel model) {
         return new EipInfo(
                 model.getName(),
                 model.getTitle(),
-                model.getDescription(),
                 model.getLabel());
     }
 
@@ -609,7 +606,7 @@ public class CatalogTools {
     public record ComponentListResult(int count, String camelVersion, 
List<ComponentInfo> components) {
     }
 
-    public record ComponentInfo(String name, String title, String description, 
String label,
+    public record ComponentInfo(String name, String title, String label,
             boolean deprecated, String supportLevel) {
     }
 
@@ -629,19 +626,19 @@ public class CatalogTools {
     public record DataFormatListResult(int count, List<DataFormatInfo> 
dataFormats) {
     }
 
-    public record DataFormatInfo(String name, String title, String 
description, boolean deprecated) {
+    public record DataFormatInfo(String name, String title, boolean 
deprecated) {
     }
 
     public record LanguageListResult(int count, List<LanguageInfo> languages) {
     }
 
-    public record LanguageInfo(String name, String title, String description) {
+    public record LanguageInfo(String name, String title) {
     }
 
     public record EipListResult(int count, List<EipInfo> eips) {
     }
 
-    public record EipInfo(String name, String title, String description, 
String label) {
+    public record EipInfo(String name, String title, String label) {
     }
 
     public record EipDetailResult(String name, String title, String 
description, String label,
diff --git 
a/dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/CatalogToolsTest.java
 
b/dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/CatalogToolsTest.java
index 4f2c3c3a19fd..b9c53ce47102 100644
--- 
a/dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/CatalogToolsTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/CatalogToolsTest.java
@@ -49,6 +49,18 @@ class CatalogToolsTest {
         assertThat(result.camelVersion()).isNotNull();
     }
 
+    @Test
+    void defaultLimitCapsResultsAtTwenty() {
+        // CAMEL-23473: default limit lowered from 50 to 20.
+        CatalogTools tools = createTools(null);
+
+        CatalogTools.ComponentListResult result = 
tools.camel_catalog_components(null, null, null, null, null, null);
+
+        assertThat(result.components().size())
+                .as("default limit should cap results at 20")
+                .isLessThanOrEqualTo(20);
+    }
+
     @Test
     void defaultCatalogWithEmptyRepos() {
         CatalogTools tools = createTools("");
diff --git 
a/dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpJsonSerializationTest.java
 
b/dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpJsonSerializationTest.java
index 196b5edfb8b6..e312f394e5e8 100644
--- 
a/dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpJsonSerializationTest.java
+++ 
b/dsl/camel-jbang/camel-jbang-mcp/src/test/java/org/apache/camel/dsl/jbang/core/commands/mcp/McpJsonSerializationTest.java
@@ -18,6 +18,8 @@ package org.apache.camel.dsl.jbang.core.commands.mcp;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.reflect.RecordComponent;
+import java.util.Arrays;
 import java.util.Properties;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
@@ -50,7 +52,7 @@ class McpJsonSerializationTest {
         ObjectMapper mapper = newConfiguredObjectMapper();
 
         CatalogTools.ComponentInfo info = new CatalogTools.ComponentInfo(
-                "timer", "Timer", null, null, false, null);
+                "timer", "Timer", null, false, null);
 
         String json = mapper.writeValueAsString(info);
 
@@ -96,6 +98,24 @@ class McpJsonSerializationTest {
         assertThat(json).doesNotContain("\"endpointOptions\"");
     }
 
+    @Test
+    void listInfoRecordsCarryNoDescription() {
+        // CAMEL-23473: list result records must omit the verbose 
'description' field. Callers
+        // that want the description should call the corresponding *_doc tool.
+        
assertThat(Arrays.stream(CatalogTools.ComponentInfo.class.getRecordComponents())
+                .map(RecordComponent::getName))
+                .doesNotContain("description");
+        
assertThat(Arrays.stream(CatalogTools.DataFormatInfo.class.getRecordComponents())
+                .map(RecordComponent::getName))
+                .doesNotContain("description");
+        
assertThat(Arrays.stream(CatalogTools.LanguageInfo.class.getRecordComponents())
+                .map(RecordComponent::getName))
+                .doesNotContain("description");
+        
assertThat(Arrays.stream(CatalogTools.EipInfo.class.getRecordComponents())
+                .map(RecordComponent::getName))
+                .doesNotContain("description");
+    }
+
     @Test
     void componentMavenResultSerializesNonNullFields() throws Exception {
         ObjectMapper mapper = newConfiguredObjectMapper();

Reply via email to