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

   [CAMEL-25541](https://issues.apache.org/jira/browse/CAMEL-25541) (absorbs 
CAMEL-25540 and CAMEL-25542). In an evaluation of coding agents on 
Mule-to-Camel migrations, the component answer of `camel_catalog_doc` was 15-38 
K characters by default (clients rejected or spilled it to a file), an 
`optionsFilter` that matched nothing came back as an empty list that agents 
read as "not supported", and the page sections that decide correctness (xslt 
header parameters, mail `useHeader*`, `camel.server.*` for platform-http under 
`camel run`) were never in the answer.
   
   ### Changes
   
   **Bounded answer**
   - Without `optionsFilter` a component lists the required options first, then 
the endpoint options, then the component options, 20 in full (new `limit` 
argument changes it) and the rest by name in `moreOptions`, with `truncated: 
true`, `listedOptions`, the total in `matchedOptions` and a hint. A filtered 
call still lists every match in full, name matches first.
   - Every `camel_catalog_doc` answer is capped at 16 000 characters: page text 
(`includeDoc`, `docPage`) is cut at a line (keeping at least 8 000 characters) 
with a marker listing the sections left out; then the longest list is cut from 
its end (cut options move to `moreOptions`, other lists get a `truncatedNote`).
   - Default answer sizes: activemq 39 923 -> 12 450, file 37 344 -> 15 396, 
smtp 24 477 -> 10 832, http 20 440 -> 11 020, kafka 94 763 -> 13 156, activemq 
`includeOptions=all` 99 700 -> 14 078 characters.
   
   **When nothing matches**
   - `note: "no option matches '<filter>'"` plus `closestOptions` (name, group, 
scope) by edit distance over option names and their camelCase words, using the 
catalog's `EditDistanceSuggestionStrategy` (CAMEL-24666).
   - `prefixOptions`: the multi-value options with a prefix 
(`additionalJavaMailProperties` / `mail.` for smtp), always listed, also when 
the filter matched.
   
   **Page sections**
   - `sections`: the `==` to `====` titles of the component page, those whose 
own text contains the filter first (smtp + `tls` starts with "SSL support", 
xslt + `param` with "Getting Usable Parameters into the XSLT").
   - `docPage=<section title>` returns that section as text (by title ignoring 
case and punctuation, or the words of the title from one on). Sub-pages 
(`docPage=main`, `custom`, `streaming`) keep working and win over sections. For 
a language, `docPage` also finds a section of the page or of its sub-pages, so 
the cut marker of `simple`'s 73 K functions page leads somewhere.
   - smtp, imap and pop3 (and other alternative schemes) now get the 
documentation of their artifact's page (`mail-component.adoc`); before, they 
had no excerpt or sub-pages at all.
   
   **Name resolution**
   - A `-component`, `-dataformat`, `-language` or `-eip` suffix (the page 
names `camel_catalog_docs` returns) is stripped and sets the kind; component, 
data format, language and EIP names are also matched ignoring case (`WireTap`).
   - An EIP is found by its name, an alias or its whole title only, no longer 
by one word of the title: `retry` returned `optimisticLockRetryPolicy`. 
`retry`, `retries`, `redelivery`, `redeliver`, `backoff` answer not-found with 
`errorHandler`, `onException`, `redeliveryPolicy` first in the suggestions and 
an `errorHandling` line showing how redelivery is written (chosen over adding 
aliases, as aliases come from the model annotations in camel-core).
   - "Example not found" names were already fixed by CAMEL-25535.
   
   **Full keys**
   - `name=camel.server.port` (any full main key) answers the `camel.server` 
group with the key first (`matchedKey`); an unknown key in a known group 
(`camel.server.prot`) answers the group with an error and the closest keys. 
`camel.jbang.*` keys (and `jbang`) are answered from `catalog.jbangModel()` as 
`jbang-options`.
   - `platform-http` carries a `mainConfig` line (`camel.server.enabled=true`, 
`camel.server.port`, `camel run --port`), and with a filter the matching 
`camel.server.*` keys as `mainOptions`.
   - `platform-http-component.adoc`: the first section ("Platform HTTP 
Provider") now says how Camel Main / `camel run` enable the embedded server and 
links `xref:others:platform-http-main.adoc[Platform HTTP Main]`, so the excerpt 
carries it and `docPages` offers `docPage=main`. Catalog mirror regenerated.
   
   **`camel_component_properties` removed**
   - Its description said endpoint options "can be set as component-level 
defaults via the same prefix", which is false 
(`AbstractCamelCatalog.validateConfigurationProperty` checks 
`camel.component.<scheme>.*` against the component options only), so it emitted 
keys `camel run` and `camel_configuration_validate` reject. Each component 
option in the `camel_catalog_doc` answer now carries its key as `configKey`; 
endpoint options carry none. Upgrade guide 4.24 entry and the MCP tool table 
updated.
   
   Not in this PR: tool renames/consolidation (CAMEL-25639), a curated 
per-component `notes` list (the MCP server instructions already carry the mail 
and xslt rules), `camel.component.<scheme>.<option>` as a lookup name.
   
   ### Tests
   
   - New `CatalogDocComponentAnswerTest` (camel-jbang-core, AssertJ, 6 tests): 
activemq default answer under 16 000 characters with `truncated`, required 
option first and `moreOptions`, `includeOptions=all` still under the cap, 
`limit` lists more; smtp `subjct` note + closest option with group, smtp `tls` 
prefix option + "SSL support" first; xslt `param` note + section first, 
`docPage` section fetch, `docPage=main` sub-page, unknown section lists 
sections; suffix stripping, case, `retry` bare word, alias still resolves; 
`camel.server.port`, `camel.jbang.dependencies`, `camel.server.prot`, 
platform-http + `port` (mainConfig, mainOptions, excerpt); `configKey` only on 
the component option.
   - `CatalogDocsTest`: the `includeOptions=all` assertion accepts an option 
named in `moreOptions`. MCP `AuthoringToolsTest`: calls updated for the new 
`limit` argument. `ComponentPropertiesToolsTest` removed with the tool.
   - `mvnd -o test -pl dsl/camel-jbang/camel-jbang-core`: 1811 tests, 0 
failures, 2 skipped (1 flake on retry: 
`JbangDevMcpServerTest.exposesToolRegistryOnManagementServer`, server init, 
unrelated).
   - `mvnd -o test -pl 
dsl/camel-jbang/camel-jbang-core,dsl/camel-jbang/camel-jbang-mcp 
-Dtest='org.apache.camel.dsl.jbang.core.commands.mcp.**.*Test,CatalogDocComponentAnswerTest'`:
 camel-jbang-mcp 447 tests, 0 failures (all 40 test classes, including 
`McpSecuredToolClassesTest` and the descriptor/argument parity tests).
   
   _Claude Code on behalf of Croway_
   


-- 
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