Skip to content

CAMEL-23638: camel-jbang - Add CLI meta-tools to camel ask#23600

Open
gnodet wants to merge 1 commit into
apache:mainfrom
gnodet:CAMEL-23638-ask-cli-meta-tools
Open

CAMEL-23638: camel-jbang - Add CLI meta-tools to camel ask#23600
gnodet wants to merge 1 commit into
apache:mainfrom
gnodet:CAMEL-23638-ask-cli-meta-tools

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented May 28, 2026

CAMEL-23638

Summary

Currently camel ask has ~26 hardcoded tool definitions. New CLI features (like camel get error --diagram) are not automatically available to the LLM. This adds 3 CLI meta-tools that give the LLM progressive access to the entire 126-command CLI:

  • cli_list_commands(filter?) — discover available commands from the auto-generated camel-jbang-commands-metadata.json
  • cli_command_help(command) — get detailed help for a specific command (options, types, defaults, subcommands)
  • cli_exec(command) — execute any CLI command in-process and return captured output

The existing curated tools are preserved for common operations (they're faster — one tool call vs three). The meta-tools serve as an escape hatch for everything else.

How the LLM uses it

Example flow for camel get error --diagram:

  1. User asks "why did my message fail?"
  2. LLM calls cli_list_commands("error") → sees get error: Get captured routing errors...
  3. LLM calls cli_command_help("get error") → sees --diagram, --detail, --last, etc.
  4. LLM calls cli_exec("get error --diagram") → gets the diagram + error details

Design decisions

  • Metadata loaded from the auto-generated JSON already on the classpath — no code generation needed
  • Execution via CamelJBangMain.getCommandLine().execute() in-process (no subprocess)
  • Output captured by temporarily swapping the Printer on CamelJBangMain
  • New CLI commands are automatically available without code changes to Ask.java

Test plan

  • Verify cli_list_commands returns all 126 commands from metadata
  • Verify cli_list_commands with filter narrows results correctly
  • Verify cli_command_help("get error") returns all 16 options
  • Verify cli_exec("catalog component --filter=kafka") returns output
  • Verify existing curated tools still work unchanged
  • Test in interactive chat mode with an LLM

Claude Code on behalf of Guillaume Nodet

Add 3 CLI meta-tools that give camel ask access to the entire CLI
via progressive discovery instead of hardcoded tool definitions:

- cli_list_commands: discover commands from auto-generated metadata
- cli_command_help: get options/types/defaults for a specific command
- cli_exec: execute any CLI command in-process with captured output

The existing curated tools are preserved for common operations.
The meta-tools serve as an escape hatch for the full 126-command CLI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet gnodet requested review from Croway and davsclaus May 28, 2026 13:30
@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 github-actions Bot added the dsl label May 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • dsl/camel-jbang/camel-jbang-core

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

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

💡 Manual integration tests recommended:

You modified dsl/camel-jbang/camel-jbang-core. The related integration tests in dsl/camel-jbang/camel-jbang-it are excluded from CI. Consider running them manually:

mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
All tested modules (6 modules)
  • Camel :: JBang :: Core
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Launcher :: Container

⚙️ View full build and test results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants