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

   Items 2 and 3 of 
[CAMEL-26932](https://issues.apache.org/jira/browse/CAMEL-26932).
   
   ## camel_version_list always failed
   
   ```
   Failed to list versions (java.lang.NullPointerException): Cannot invoke 
"...MavenResolverMixin.download()" because "this.mavenResolver" is null
   ```
   
   The tool creates `new VersionList(main)` itself. Since the aesh port, its 
`@Mixin` fields are only set when aesh parses a command line, so 
`mavenResolver` stayed null. `VersionList` now creates its option groups 
(`mavenResolver`, `quarkusExtensionRegistry`) in their field declarations, as 
`Run` already does. So the command works however it is created. The tool also 
said `openWorldHint=false`, although it downloads the release lists from Maven 
Central; it now says `true`.
   
   The existing `VersionListTest` set `mavenResolver` by hand, which hid the 
bug. A new test creates the command the way the MCP server does.
   
   ## camel_get_files returned a file of any size
   
   A 3.6 MB file gave a 4.5 MB answer, about a million tokens. 
`camel_get_files` now:
   
   - returns a small file whole and as it is (line endings, no newline at the 
end), as before;
   - returns a larger file in parts: at most 2000 lines and 256 KB, from line 
`offset` (from 1), up to `limit` lines. The answer has `lines`, `from`, `to` 
and a `message` such as "The content is lines 1 to 2000 of 5000; call 
camel_get_files with offset=2001 for the next lines";
   - cuts one line longer than 256 KB, and says so.
   
   `offset` and `limit` are new optional arguments of the MCP tool and the 
registry tool (`camel ask`, TUI). The docs row in `camel-jbang-mcp.adoc` 
describes them.
   
   `camel_validate_source` also reads an existing file whole, but its answer 
has the findings, not the file, so it is unchanged.
   
   ## Tests
   
   - `VersionListTest`: the command created without its command line has its 
option groups.
   - `AuthoringToolsTest`: a 5000-line file in parts, a window at the end, an 
offset past the end, a bad offset, a small CRLF file returned as it is, and a 
line longer than an answer.
   - End to end, over stdio, against the runner jar:
   
   | call | main | this PR |
   |---|---|---|
   | `camel_get_files` of a 4.2 MB, 50000-line file | 4,239,085 characters | 
167,228 characters (lines 1-2000) and the offset of the next part |
   | `camel_get_files` with `offset: 49999` | - | lines 49999-50000 of 50000 |
   | `camel_version_list {"limit":3}` | NullPointerException | 4.23.0, 4.22.2 
(LTS), ... |
   
   - camel-jbang-core: 3002 + 259 tests pass. `DependencyUpdateTest` failed 
once and passed on the rerun; it does the same on other branches.
   - camel-jbang-mcp: 545 tests pass, built in a reactor with this core.
   
   _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]

Reply via email to