Croway opened a new pull request, #2086:
URL: https://github.com/apache/camel-spring-boot/pull/2086

   ## Summary
   
   [CAMEL-26782](https://issues.apache.org/jira/browse/CAMEL-26782) option C 
for `camel-spring-boot-4.22.x`: with `camel-ai-tool-starter`, a tool whose 
route sets no MCP hints is no longer published with `readOnlyHint`, 
`destructiveHint`, `idempotentHint` and `openWorldHint` set to `false`.
   
   ## Why only the ai-tool starter
   
   On 4.22.x, `CamelPropertiesHelper.copyConfigurationProperties` copies every 
option of the generated configuration class onto the component. 
`AiToolComponentConfiguration` initializes the four hints and `returnDirect` to 
the catalog default `false`, so every tool got explicit `false` annotations in 
MCP `tools/list`.
   
   `main` fixed this through CAMEL-24501 (#1951), which copies only the options 
the application configured, plus #2079 for the regression that change caused. 
Neither is backported here:
   - #1951 changes how every starter copies its options, which is too broad for 
a patch release.
   - #2079 only makes sense on top of #1951.
   
   So, as the JIRA proposes, only the ai-tool starter changes.
   
   ## Change
   
   `AiToolUnsetHintsAutoConfiguration` registers a `BeanPostProcessor` that 
clears these five options on `AiToolComponentConfiguration` after Spring Boot 
binds it, unless they are configured. The generated customizer then skips them, 
since it copies only non-null options. The fix keeps:
   - explicit external configuration, including an explicit `false`
   - values set on a user's own `ai-tool` component bean
   - values set by a user `ComponentCustomizer`
   
   `returnDirect` is cleared too. The ai-tool component leaves it `null` by 
default, as on `main`, and `AiToolAnnotations.isReturnDirect()` treats `null` 
and `false` the same.
   
   This ports the downstream fix by @smongiar; the commit keeps their 
authorship.
   
   ## Tests
   
   - New ai-tool starter tests cover unset hints, explicit hints (an explicit 
`false` is kept), a user component bean and a user customizer: 6 tests pass.
   - `camel-mcp-server-starter` gets `camel-ai-tool-starter` as a test 
dependency, so the existing 
`SpringBootMcpServerTest.testToolWithoutHintsHasNoAnnotations` checks the 
`tools/list` output end to end: 13 tests pass.
   - Control: with the post-processor turned into a no-op, all four ai-tool 
test classes fail (`expected: <null> but was: <false>`), and so does 
`testToolWithoutHintsHasNoAnnotations`.
   
   ## Release note
   
   Tools configured with `camel-ai-tool-starter` no longer advertise `false` 
for MCP hints they don't set, and `returnDirect` stays unset as well. Under the 
MCP specification, an omitted `destructiveHint` or `openWorldHint` means 
`true`, so clients may now treat such tools as destructive and open-world. To 
keep advertising a tool as read-only or non-destructive, configure the hint on 
the endpoint (`ai-tool:myTool?destructiveHint=false`) or for all tools 
(`camel.component.ai-tool.destructive-hint=false`).
   
   
   _Claude Code on behalf of Federico Mariani_
   


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