Skip to content

CAMEL-23475: camel-jbang-mcp - make ComponentDetailResult lean by default with option filtering#23359

Merged
oscerd merged 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-23475
May 20, 2026
Merged

CAMEL-23475: camel-jbang-mcp - make ComponentDetailResult lean by default with option filtering#23359
oscerd merged 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-23475

Conversation

@oscerd
Copy link
Copy Markdown
Contributor

@oscerd oscerd commented May 20, 2026

Summary

Reduces the token cost of camel_catalog_component_doc (MCP) — part of the
ongoing token-reduction effort for camel-jbang-mcp (CAMEL-23475).

Two new arguments and a small follow-up tool:

  • optionsFilter — case-insensitive substring match on option name.
  • includeOptions — one of required | common | all, default common
    (excludes deprecated and advanced options).
  • ComponentDetailResult no longer carries groupId / artifactId /
    version. Callers that actually need maven coordinates now call the new
    camel_catalog_component_maven tool.

Behaviour numbers (Kafka)

Measured locally against the in-bundle catalog (estimating ~4 chars / token):

Scope Endpoint opts Component opts JSON chars Est. tokens
all 121 129 92,866 ~23,200
common 112 117 82,882 ~20,700
required 1 0 515 ~130

The default common scope (excluding deprecated + advanced, per the ticket
definition) is a modest improvement over the previous all-options response.
To hit the ticket's ≤ 2K token acceptance target the LLM must combine the
default scope with a non-trivial optionsFilter (or call required first)
— the docs and tool description nudge it to do so.

Changes

  • CatalogTools.camel_catalog_component_doc: added optionsFilter and
    includeOptions args; updated tool description.
  • CatalogTools.camel_catalog_component_maven: new tool returning name,
    groupId, artifactId, version.
  • ComponentDetailResult: removed groupId/artifactId/version fields.
  • ComponentMavenResult: new record.
  • OptionScope: internal enum implementing the filter predicates.
  • Docs: added the new tool to camel-jbang-mcp.adoc, bumped tool count
    from 27 to 28, added an upgrade-guide entry under camel-jbang-mcp.

Test plan

  • mvn -DskipTests install in dsl/camel-jbang/camel-jbang-mcp (formats + builds)
  • mvn test in dsl/camel-jbang/camel-jbang-mcp — 250 tests pass, including 6 new ones
  • mvn clean install -DskipTests from repository root — full reactor build green, no
    uncommitted regenerated files
  • McpJsonSerializationTest updated for the new ComponentDetailResult shape

Tests added:

  • componentDocDefaultsToCommonScope
  • componentDocRequiredScopeOnlyReturnsRequiredOptions
  • componentDocOptionsFilterByName
  • componentDocInvalidIncludeOptionsThrows
  • componentMavenReturnsCoordinates
  • componentMavenUnknownComponentThrows
  • componentMavenResultSerializesNonNullFields

Claude Code on behalf of Andrea Cosentino

…ault with option filtering

Add option filtering to camel_catalog_component_doc and split out a
small camel_catalog_component_maven tool so callers only pay the
maven-coordinate token cost when they actually need it.

* optionsFilter: case-insensitive substring match on option name.
* includeOptions: required | common | all (default: common, which
  excludes deprecated and advanced options).
* ComponentDetailResult no longer carries groupId/artifactId/version;
  use camel_catalog_component_maven for those.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
@oscerd oscerd requested review from davsclaus and gnodet May 20, 2026 09:03
@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions
Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • docs
  • dsl/camel-jbang/camel-jbang-mcp

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • dsl/camel-jbang/camel-jbang-mcp: 1 test(s) disabled on GitHub Actions

⚙️ View full build and test results

@oscerd oscerd merged commit 7047210 into apache:main May 20, 2026
7 checks passed
@oscerd oscerd deleted the fix/CAMEL-23475 branch May 21, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants