davsclaus opened a new pull request, #27318: URL: https://github.com/apache/camel/pull/27318
[CAMEL-24834](https://issues.apache.org/jira/browse/CAMEL-24834). The plan is in the Jira comment of 2026-10-03. **Draft, for review of the design.** Two commits: the first version had read-only SQL for local models; the second removes it ("a developer tool, not for production databases"). A local model gets the small core tool set to keep its prompt short. This adds tool **groups** chosen from what the selected integration has, never by the model. In September the model never asked for a tool on its own. ### What changes | Group | Loads when the status shows | MCP tools | AI panel | |---|---|---|---| | sql | a datasource, sql/sql-stored/jdbc/spring-jdbc/jpa endpoints, or traced SQL | `camel_runtime_sql`, `camel_runtime_datasources`, `camel_runtime_sql_trace` | `tui_execute_sql`, `tui_update_row` | | tracing | OpenTelemetry on, or message tracing on | `camel_runtime_trace` (+ `camel_runtime_spans` with OpenTelemetry, `camel_runtime_metrics` with Micrometer) | guidance only (`tui_get_spans` is core) | | resilience | a `circuitBreaker` in the routes, or breaker state reported | `camel_runtime_circuit_breakers` | guidance only (`tui_get_table` tab) | - **Guidance:** each group adds one line, e.g. "SQL: datasource(s) orders (HikariCP), used by sql endpoints. Table names come from the SQL trace; don't guess a schema." - **camel-jbang-core** (`AppFeatures.fromStatus`, `ToolGroup`, `ToolGroups.select`): - The rules are read from `~/.camel/<pid>-status.json`, one local file read. - A pure function, tolerant of older status files. - The fingerprint changes only when the groups or datasources change. - **MCP:** new `camel_runtime_tool_groups(nameOrPid)` returns the core tools, the groups with their tools and guidance, the fingerprint and the signals. Any client can then apply the same selection. `tools/list_changed` was considered and left out: the server has no selected app, and many clients ignore the notification. - **AI panel, core mode only** (full mode unchanged): - The groups are recomputed only when another integration is selected or the selected one reloads, and they only grow for the same integration. The tools and prompt stay byte-identical between questions, so the prompt cache survives. - The guidance lines go at the end of the system prompt. - `/tools` shows the loaded groups. - **Prompt budget:** core about 4,663 tokens, core + all three groups about 5,180. A new `CORE_WITH_GROUPS_BUDGET_TOKENS = 5_500` covers the second case. - **Docs:** TUI local models, TUI AI, camel-jbang-mcp. ### Tests - New: `AppFeaturesTest` (status fixtures), `ToolGroupsTest`, `AiPanelToolGroupsTest`. - Extended: `ToolRegistryTest`, `RuntimeToolsTest`, `AiPanelPromptBudgetTest` (core + groups budget; the guidance only names tools in the active set). - Module suites: camel-jbang-core 1460, camel-jbang-mcp 427, camel-jbang-plugin-tui 1724, all pass. - Live through the MCP server: an integration with a circuit breaker returns the resilience group, with signals `routes.processors: circuitBreaker in stock-check` and `resilience4j: 1 circuit breaker(s)`. ### Local-model benchmark qwen3.6 35b-a3b, 64k context, 5 runs per example. The harness asks `camel_runtime_tool_groups` before each step and adds the group's tools and guidance when the fingerprint changes. | Example | Without groups | With groups | |---|---|---| | connect-service-sql | 9/15 (steps 2/2/5) | 9/15 (steps 0/4/5) | | fail-well-circuit-breaker | 13/15 | 13/15, peak prompt 43.9k vs 65.5k | - **sql:** the model now uses the tools (sql 11 calls, sql_trace 6, datasources 2), mostly to read the table before reporting on it (step 2 up from 2/5 to 4/5). - **sql step 1** still fails on the model's own route SQL (named parameters, upsert syntax), not on tool access. - **circuit-breaker:** the breaker tool was called 4 times once its group loaded. Phase 2, not here: groups from the project sources before the integration runs, a `/sql` command, aggregator state. Note: `main` is currently red after CAMEL-24649 (#26203). That change left `eip-samples.json` stale and broke `CatalogSamplesTest.restOpenApiShowsTheConsumerEndpointAndTheContractFirstRest`, so CI here will fail on those too. See #27317. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m -- 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]
