davsclaus opened a new pull request, #31389: URL: https://github.com/apache/camel/pull/31389
## Why In a local-model benchmark night with `qwen4:35b-a3b-nvfp4` (new set: 10 examples, 8 rounds), 54 of the 72 failed steps ended at the 25 tool calls of the step without a single write. The model read one doc answer after another and never wrote the file. Three things in the camel-jbang-mcp server's catalog tools made this worse: 1. `camel_catalog_doc` with `docPage` ignored the argument for an EIP without a word: the answer was the options again. 29 of the 61 looping steps asked for sections of an EIP page this way (`split` 228 calls, `rest` 169, `onException` 61). `split-eip.adoc` has the sections; the EIP branch never looked. 2. The note for a repeated call needs identical arguments. The model changed a small thing each time (`optionsFilter`, `includeDoc`), so the note came only now and then. 3. The model added a `camelVersion` nobody gave it in 192 calls (4.14.0, 4.17.0, 4.10.0) and got the options of an old release without being told. 4.17.0 is the example in the `ToolArgDocs.CAMEL_VERSION` description. ## Changes - **EIP doc sections:** `camel_catalog_doc` `docPage` returns a section of an EIP page, as for a component. When there is no such section, the answer says so and lists the sections, or says the EIP has no doc page with sections. For `rest` it also names the component page, which has them. - **Many reads without a write:** from the 10th catalog answer in a row without a write (`camel_catalog_doc`, `camel_catalog_find`, `camel_catalog_sample`), each answer of the MCP server has a `nextStep` note: write the file now, the write checks the options. A write or edit, or any other deterministic tool such as `camel_validate_source`, starts the count again. The write and edit tools now get the `McpConnection` for this. In the steps that passed, 95% (qwen4) and 97% (qwen3.6) of the longest runs of reads without a write were shorter than 10, so normal work does not see the note. - **Foreign camelVersion:** `camel_catalog_doc` and `camel_catalog_find` add a `camelVersionNote` when the answer is for another version than the CLI's (or the selected integration's). The three camelVersion descriptions no longer give an example version, and say to leave the argument out unless the project runs another Camel version. `ToolContext.setCamelVersionOfCall` tells the version an MCP server applies for a call apart from the version of an integration. ## Tests - New: `CatalogDocsTest` (EIP section found / not found / EIP without sections), `RepeatedToolCallsTest` (read note, reset by a write, by another tool and by a new session), `AuthoringToolsVersionNoteTest`, and an MCP `AuthoringToolsTest` case for the note across connections and after a write. - camel-jbang-core `ai` package: 1125 run, 0 failures (1 skipped). camel-jbang-mcp: 495 run, 0 failures. - Checked on a running MCP server over HTTP: the split section, the rest answer, the 10th-read note, and the version note. A benchmark night with this change runs tonight; I will add the numbers here. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016Y4dDi5iQNgtHrDdz2NpwF -- 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]
