gnodet opened a new pull request, #23600:
URL: https://github.com/apache/camel/pull/23600

   [CAMEL-23638](https://issues.apache.org/jira/browse/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_


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