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

   Backport of apache/camel#26856 
([CAMEL-25000](https://issues.apache.org/jira/browse/CAMEL-25000)) to 
`camel-4.22.x`. Should be merged after #26856.
   
   ## Problem
   
   `ai-tool` routes register in `AiToolRegistry` only when their consumer 
starts. A route declared earlier whose consumer produces immediately (e.g. 
`stream:in -> openai:chat-completion?tags=...`) calls the LLM before later tool 
routes are registered: the request silently carries some tools, or none. 
`camel-mcp-server` can publish a partial `tools/list` the same way. Reproduced 
with Camel JBang 4.22.1.
   
   ## Fix
   
   - `AiToolEndpoint` registers its consumer's tool in `doStart()`, during 
route warm-up (Camel warms up all routes before starting any route consumer), 
only for routes that start automatically. Consumer start/stop/suspend/resume 
behaviour is unchanged.
   - The auto-startup decision is extracted from `RouteService.isAutoStartup()` 
into `CamelContextHelper.isAutoStartup(Route)`, shared by both.
   
   Differences from upstream: the `camel-ai-resource` changes are dropped (the 
module does not exist on 4.22.x), and `McpServerBridgeStartupOrderTest` checks 
tools only.
   
   ## Tests
   
   - `AiToolStartupOrderTest` (fails without the fix, passes with it), 
`McpServerBridgeStartupOrderTest`, `CamelContextHelperAutoStartupTest`.
   - camel-ai-tool (103), camel-mcp-server-api (13) and the camel-core 
auto-startup / startup-order / route-controller tests (43) pass on 
`camel-4.22.x`.
   
   _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