davsclaus opened a new pull request, #29962: URL: https://github.com/apache/camel/pull/29962
The rest of item 9 of [CAMEL-26932](https://issues.apache.org/jira/browse/CAMEL-26932), after the near-spelling suggestions of #29938. ## Problem A catalog lookup that finds nothing, such as `camel_catalog_doc name=kafak`, is answered as data: `{"error":"Artifact not found: kafak","suggestions":["kafka"]}`. From the third identical call `RepeatedToolCalls` answers with the repeat note instead, and for `camel_catalog_doc` that note starts with its hint: "Go on with the options the earlier answer gave: write the file with camel_write_file ...". For a miss there are no options to go on with, so the note sent the model to write a file with a component that does not exist. ## Decision A miss stays data and keeps counting. Making it an MCP error would take it out of the repeat count (only successful answers count), and that count is what stopped a small model from asking 11 or 12 more times for a sample that does not exist (r32, CAMEL-26875). ## Change `RepeatedToolCalls.recordSuccessfulAnswer` takes the answer. An answer with an `error` is remembered as a miss, and the note for repeating it says what the answer was and what to ask instead: ``` "note": "The answer was: Artifact not found: kafak. Use one of the suggestions instead: kafka. You asked this 3 times now with the same arguments, and the answer is the same each time.", "suggestions": ["kafka"] ``` Without suggestions it says "Ask with other arguments instead." A later answer without an error clears the miss. The MCP server passes the answer of the catalog and other deterministic tools, and of `camel_error_diagnose`. The MCP server of the TUI is not changed here. ## Tests - `RepeatedToolCallsTest`: a repeated miss with suggestions (the note, the count, no `camel_write_file`, the `suggestions`), and one without. - `AuthoringToolsTest` (MCP): three identical `camel_catalog_doc name=kafak` calls; the third gets the miss note with `kafka`. - camel-jbang-run: 319 pass. camel-jbang-core: 3071 + 264 pass (`DependencyUpdateTest` flaked once and passed on the rerun). camel-jbang-mcp: 546 pass. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
