davsclaus opened a new pull request, #27982: URL: https://github.com/apache/camel/pull/27982
Fifteenth batch of [CAMEL-23688](https://issues.apache.org/jira/browse/CAMEL-23688) (test coverage of the CLI commands): the runtime tools of `ToolRegistry` (49% line coverage before), which `camel ask` and the MCP servers give an AI. Only the catalog tools and the tool metadata were tested; the tools that ask a running integration were not. ### Tests - `FakeIntegration` (new test helper): an integration that answers the actions the CLI writes, as the CLI connector does, with what the test gives for each action, and keeps the actions it took. `EvalInTheIntegrationTest` (#27979) uses it now. - `RuntimeToolsTest` (new): what each tool asks the integration for and what it answers: the source, dump and structure of the routes, the top processors, the topology, the tracing (`enable`, `disable`, `dump`, an unknown action), browsing an endpoint, the spans, the startup steps, the thread dump and heap histogram, a heap dump, a SQL query, stopping and starting a route (and a route the integration does not have), a message with headers, the circuit breakers of each kind, the sections of the status (metrics, datasources), the errors and the history, and the analysis tools. ### Bugs the tests found - **The headers of `send_message`** (`camel ask`) **and `tui_send_message`** (`camel tui --mcp`), given as `key=value` lines as their description says, were put in the action as one text. The `send` action of the CLI connector reads a list of keys and values (`root.getCollection("headers")`), so a message with headers failed in the integration with a `ClassCastException`. `RuntimeHelper.sendMessage` sends the list now; a line that is not `key=value` is an error of the tool. - **`get_circuit_breakers`** left out the calls of the fallback, the calls that timed out and the calls a full bulkhead rejected, which `camel get circuit-breaker` shows. - **`get_route_analysis`, `get_eip_stats` and `detect_config_drift`** put the answers of the integration in their answer as JSON text (escaped, `"routeStructure": "{\"routes\":...}"`), instead of as JSON, which an AI then reads as a string. The user-visible changes are in the 4.24 upgrade guide. `mvn test` of the runtime tools, eval, tool registry, ask tools and expression evaluator tests of camel-jbang-core: all pass. The new tests were checked against the code before the fixes: the 4 tests of the bugs fail (the message with headers with the `ClassCastException` the integration had). _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DDRLJAyf8cDXSg8iX785My -- 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]
