This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new c8a22129ea9e CAMEL-27314: camel-openai - autoToolExecution and the
docs describe the tool loop for route tools too (#30607)
c8a22129ea9e is described below
commit c8a22129ea9e762ea913844c7025db4cad474b32
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 22 20:48:16 2026 +0100
CAMEL-27314: camel-openai - autoToolExecution and the docs describe the
tool loop for route tools too (#30607)
The tool loop runs MCP tools and route tools (tags, ai-tool routes), but
autoToolExecution, maxAgenticTokens, the body type text, the streaming
note and openai-mcp.adoc said MCP only. A model reading them could add an
MCP server it does not need. Add a Route Tools section with Java, XML and
YAML examples.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Claus Ibsen <[email protected]>
---
.../org/apache/camel/catalog/components/llm.json | 8 +--
.../apache/camel/catalog/components/openai.json | 8 +--
.../camel/catalog/docs/openai-component.adoc | 2 +-
.../org/apache/camel/catalog/docs/openai-mcp.adoc | 81 +++++++++++++++++++++-
.../org/apache/camel/component/openai/llm.json | 8 +--
.../org/apache/camel/component/openai/openai.json | 8 +--
.../src/main/docs/openai-component.adoc | 2 +-
.../camel-openai/src/main/docs/openai-mcp.adoc | 81 +++++++++++++++++++++-
.../component/openai/AgenticIterationTrace.java | 2 +-
.../openai/OpenAIAgenticLoopCompletedEvent.java | 2 +-
.../openai/OpenAIAgenticLoopStartedEvent.java | 2 +-
.../openai/OpenAIAgenticToolCallExecutedEvent.java | 2 +-
.../component/openai/OpenAIConfiguration.java | 10 +--
.../camel/component/openai/OpenAIEndpoint.java | 2 +-
.../camel/component/openai/OpenAIProducer.java | 2 +-
.../endpoint/dsl/OpenAIEndpointBuilderFactory.java | 66 ++++++++++--------
16 files changed, 227 insertions(+), 59 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/llm.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/llm.json
index daa5e0266f56..5c05da15f8b8 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/llm.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/llm.json
@@ -151,7 +151,7 @@
"consumerOut": { "carriers": [ "pojo" ], "javaType":
"com.openai.models.webhooks.UnwrapWebhookEvent", "description": "The event of
the webhook operation, verified with webhookSecret, such as a batch or a
background response that completed. The event type and the id of the object it
is about are in headers" },
"consumerReply": { "carriers": [ "any" ], "description": "The body at the
end of the route is not sent: OpenAI gets 200 without a body, or 500 when the
route fails, and then sends the event again" },
"producerIn": { "carriers": [ "any" ], "byOption": [ { "option":
"operation", "value": "decisions", "carriers": [ "pojo" ], "javaType":
"com.openai.models.decisions.DecisionCreateParams" }, { "option": "operation",
"value": "batch", "carriers": [ "map", "list", "text", "bytes", "stream",
"file" ] }, { "option": "operation", "value": "audio-transcription",
"carriers": [ "file", "bytes", "stream" ] }, { "option": "operation", "value":
"audio-translation", "carriers": [ "file", "bytes", [...]
- "producerOut": { "carriers": [ "text" ], "byOption": [ { "option":
"streaming", "value": "true", "carriers": [ "iterator" ] }, { "option":
"autoToolExecution", "value": "false", "carriers": [ "text", "pojo", "list" ]
}, { "option": "operation", "value": "decisions", "carriers": [ "pojo" ],
"javaType": "com.openai.models.decisions.Decision" }, { "option": "operation",
"value": "responses", "carriers": [ "text" ] }, { "option": "operation",
"value": "responses-retrieve", "carriers": [ [...]
+ "producerOut": { "carriers": [ "text" ], "byOption": [ { "option":
"streaming", "value": "true", "carriers": [ "iterator" ] }, { "option":
"autoToolExecution", "value": "false", "carriers": [ "text", "pojo", "list" ]
}, { "option": "operation", "value": "decisions", "carriers": [ "pojo" ],
"javaType": "com.openai.models.decisions.Decision" }, { "option": "operation",
"value": "responses", "carriers": [ "text" ] }, { "option": "operation",
"value": "responses-retrieve", "carriers": [ [...]
},
"properties": {
"operation": { "index": 0, "kind": "path", "displayName": "Operation",
"group": "common", "label": "", "required": true, "type": "enum", "javaType":
"org.apache.camel.component.openai.OpenAIOperations", "enum": [
"chat-completion", "decisions", "responses", "responses-retrieve",
"responses-cancel", "batch", "batch-retrieve", "batch-cancel", "batch-results",
"embeddings", "tool-execution", "audio-transcription", "audio-translation",
"audio-speech", "moderation", "image-generation", "i [...]
@@ -171,7 +171,7 @@
"audioResponseFormat": { "index": 14, "kind": "parameter", "displayName":
"Audio Response Format", "group": "common", "label": "", "required": false,
"type": "enum", "javaType": "java.lang.String", "enum": [ "json", "text",
"srt", "verbose_json", "vtt", "diarized_json" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "json",
"configurationClass": "org.apache.camel.component.openai.OpenAIConfiguration",
"configurationField": "configuration", "description": [...]
"audioTemperature": { "index": 15, "kind": "parameter", "displayName":
"Audio Temperature", "group": "common", "label": "", "required": false, "type":
"number", "javaType": "java.lang.Double", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Sampling temperature for transcription (0.0 to
1.0)" },
"audioTimestampGranularities": { "index": 16, "kind": "parameter",
"displayName": "Audio Timestamp Granularities", "group": "common", "label": "",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Comma-separated timestamp granularities:
'word', 'segment', or 'word,segment'. O [...]
- "autoToolExecution": { "index": 17, "kind": "parameter", "displayName":
"Auto Tool Execution", "group": "common", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When true and MCP servers are configured,
automatically execute tool calls and loop ba [...]
+ "autoToolExecution": { "index": 17, "kind": "parameter", "displayName":
"Auto Tool Execution", "group": "common", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When true, run the tool calls the model asks
for, both MCP tools (mcpServer.*) and rou [...]
"background": { "index": 18, "kind": "parameter", "displayName":
"Background", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Run the model response in the background
(Responses API only). The exchange completes as soon as the [...]
"baseUrl": { "index": 19, "kind": "parameter", "displayName": "Base Url",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "https:\/\/api.openai.com\/v1",
"configurationClass": "org.apache.camel.component.openai.OpenAIConfiguration",
"configurationField": "configuration", "description": "Base URL for OpenAI API.
Defaults to OpenAI's official endpoint. Can be u [...]
"batchEndpoint": { "index": 20, "kind": "parameter", "displayName": "Batch
Endpoint", "group": "common", "label": "", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "\/v1\/responses",
"\/v1\/chat\/completions", "\/v1\/embeddings", "\/v1\/completions",
"\/v1\/moderations", "\/v1\/images\/generations", "\/v1\/images\/edits",
"\/v1\/videos" ], "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.openai. [...]
@@ -202,7 +202,7 @@
"imageSize": { "index": 45, "kind": "parameter", "displayName": "Image
Size", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "The size of the generated image (e.g.,
1024x1024, 1536x1024, 1024x1536, auto). The accepted values depend on the
model." },
"imageStyle": { "index": 46, "kind": "parameter", "displayName": "Image
Style", "group": "common", "label": "", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "vivid", "natural" ], "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "The style of the generated image. A dall-e-3
option, so only useful with OpenAI-compa [...]
"jsonSchema": { "index": 47, "kind": "parameter", "displayName": "Json
Schema", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "supportFileReference": true, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "JSON schema for structured output validation"
},
- "maxAgenticTokens": { "index": 48, "kind": "parameter", "displayName":
"Max Agentic Tokens", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Maximum cumulative prompt plus completion
tokens allowed across the MCP agentic loop. When 0 o [...]
+ "maxAgenticTokens": { "index": 48, "kind": "parameter", "displayName":
"Max Agentic Tokens", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Maximum cumulative prompt plus completion
tokens allowed across the tool loop. When 0 or negat [...]
"maxHistoryMessages": { "index": 49, "kind": "parameter", "displayName":
"Max History Messages", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When conversationMemory is enabled, retain at
most this many messages in the exchange conve [...]
"maxHistoryTokens": { "index": 50, "kind": "parameter", "displayName":
"Max History Tokens", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When conversationMemory is enabled, trim
conversation history using a token estimate (character [...]
"maxRetries": { "index": 51, "kind": "parameter", "displayName": "Max
Retries", "group": "common", "label": "", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 2, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Maximum number of times the OpenAI SDK client
retries failed requests. The SDK retry is rate-limit aware (ho [...]
@@ -230,7 +230,7 @@
"streaming": { "index": 73, "kind": "parameter", "displayName":
"Streaming", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Enable streaming responses" },
"stripThinking": { "index": 74, "kind": "parameter", "displayName": "Strip
Thinking", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Strip ... blocks from model responses (used by
reasoning models like Qwen3, DeepSeek-R1). The [...]
"systemMessage": { "index": 75, "kind": "parameter", "displayName":
"System Message", "group": "common", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "System message to prepend. When set and
conversationMemory is enabled, the conversation history is reset." },
- "tags": { "index": 76, "kind": "parameter", "displayName": "Tags",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Comma-separated tags for discovering
route-based tools registered via the ai-tool component. When set, matching
tools from the s [...]
+ "tags": { "index": 76, "kind": "parameter", "displayName": "Tags",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Comma-separated tags for discovering
route-based tools registered via the ai-tool component. When set, matching
tools from the s [...]
"temperature": { "index": 77, "kind": "parameter", "displayName":
"Temperature", "group": "common", "label": "", "required": false, "type":
"number", "javaType": "java.lang.Double", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Temperature for response generation (0.0 to
2.0)" },
"toolExecutionErrorStrategy": { "index": 78, "kind": "parameter",
"displayName": "Tool Execution Error Strategy", "group": "common", "label": "",
"required": false, "type": "enum", "javaType":
"org.apache.camel.component.openai.ToolExecutionErrorStrategy", "enum": [
"failExchange", "repromptModel" ], "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "failExchange", "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationFie [...]
"toolSearch": { "index": 79, "kind": "parameter", "displayName": "Tool
Search", "group": "common", "label": "", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When true, route tools marked searchable and
remote MCP tools are omitted from the initial model req [...]
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/openai.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/openai.json
index 48e11976ace4..118e47718618 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/openai.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/openai.json
@@ -151,7 +151,7 @@
"consumerOut": { "carriers": [ "pojo" ], "javaType":
"com.openai.models.webhooks.UnwrapWebhookEvent", "description": "The event of
the webhook operation, verified with webhookSecret, such as a batch or a
background response that completed. The event type and the id of the object it
is about are in headers" },
"consumerReply": { "carriers": [ "any" ], "description": "The body at the
end of the route is not sent: OpenAI gets 200 without a body, or 500 when the
route fails, and then sends the event again" },
"producerIn": { "carriers": [ "any" ], "byOption": [ { "option":
"operation", "value": "decisions", "carriers": [ "pojo" ], "javaType":
"com.openai.models.decisions.DecisionCreateParams" }, { "option": "operation",
"value": "batch", "carriers": [ "map", "list", "text", "bytes", "stream",
"file" ] }, { "option": "operation", "value": "audio-transcription",
"carriers": [ "file", "bytes", "stream" ] }, { "option": "operation", "value":
"audio-translation", "carriers": [ "file", "bytes", [...]
- "producerOut": { "carriers": [ "text" ], "byOption": [ { "option":
"streaming", "value": "true", "carriers": [ "iterator" ] }, { "option":
"autoToolExecution", "value": "false", "carriers": [ "text", "pojo", "list" ]
}, { "option": "operation", "value": "decisions", "carriers": [ "pojo" ],
"javaType": "com.openai.models.decisions.Decision" }, { "option": "operation",
"value": "responses", "carriers": [ "text" ] }, { "option": "operation",
"value": "responses-retrieve", "carriers": [ [...]
+ "producerOut": { "carriers": [ "text" ], "byOption": [ { "option":
"streaming", "value": "true", "carriers": [ "iterator" ] }, { "option":
"autoToolExecution", "value": "false", "carriers": [ "text", "pojo", "list" ]
}, { "option": "operation", "value": "decisions", "carriers": [ "pojo" ],
"javaType": "com.openai.models.decisions.Decision" }, { "option": "operation",
"value": "responses", "carriers": [ "text" ] }, { "option": "operation",
"value": "responses-retrieve", "carriers": [ [...]
},
"properties": {
"operation": { "index": 0, "kind": "path", "displayName": "Operation",
"group": "common", "label": "", "required": true, "type": "enum", "javaType":
"org.apache.camel.component.openai.OpenAIOperations", "enum": [
"chat-completion", "decisions", "responses", "responses-retrieve",
"responses-cancel", "batch", "batch-retrieve", "batch-cancel", "batch-results",
"embeddings", "tool-execution", "audio-transcription", "audio-translation",
"audio-speech", "moderation", "image-generation", "i [...]
@@ -171,7 +171,7 @@
"audioResponseFormat": { "index": 14, "kind": "parameter", "displayName":
"Audio Response Format", "group": "common", "label": "", "required": false,
"type": "enum", "javaType": "java.lang.String", "enum": [ "json", "text",
"srt", "verbose_json", "vtt", "diarized_json" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "json",
"configurationClass": "org.apache.camel.component.openai.OpenAIConfiguration",
"configurationField": "configuration", "description": [...]
"audioTemperature": { "index": 15, "kind": "parameter", "displayName":
"Audio Temperature", "group": "common", "label": "", "required": false, "type":
"number", "javaType": "java.lang.Double", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Sampling temperature for transcription (0.0 to
1.0)" },
"audioTimestampGranularities": { "index": 16, "kind": "parameter",
"displayName": "Audio Timestamp Granularities", "group": "common", "label": "",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Comma-separated timestamp granularities:
'word', 'segment', or 'word,segment'. O [...]
- "autoToolExecution": { "index": 17, "kind": "parameter", "displayName":
"Auto Tool Execution", "group": "common", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When true and MCP servers are configured,
automatically execute tool calls and loop ba [...]
+ "autoToolExecution": { "index": 17, "kind": "parameter", "displayName":
"Auto Tool Execution", "group": "common", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When true, run the tool calls the model asks
for, both MCP tools (mcpServer.*) and rou [...]
"background": { "index": 18, "kind": "parameter", "displayName":
"Background", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Run the model response in the background
(Responses API only). The exchange completes as soon as the [...]
"baseUrl": { "index": 19, "kind": "parameter", "displayName": "Base Url",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "https:\/\/api.openai.com\/v1",
"configurationClass": "org.apache.camel.component.openai.OpenAIConfiguration",
"configurationField": "configuration", "description": "Base URL for OpenAI API.
Defaults to OpenAI's official endpoint. Can be u [...]
"batchEndpoint": { "index": 20, "kind": "parameter", "displayName": "Batch
Endpoint", "group": "common", "label": "", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "\/v1\/responses",
"\/v1\/chat\/completions", "\/v1\/embeddings", "\/v1\/completions",
"\/v1\/moderations", "\/v1\/images\/generations", "\/v1\/images\/edits",
"\/v1\/videos" ], "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.openai. [...]
@@ -202,7 +202,7 @@
"imageSize": { "index": 45, "kind": "parameter", "displayName": "Image
Size", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "The size of the generated image (e.g.,
1024x1024, 1536x1024, 1024x1536, auto). The accepted values depend on the
model." },
"imageStyle": { "index": 46, "kind": "parameter", "displayName": "Image
Style", "group": "common", "label": "", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "vivid", "natural" ], "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "The style of the generated image. A dall-e-3
option, so only useful with OpenAI-compa [...]
"jsonSchema": { "index": 47, "kind": "parameter", "displayName": "Json
Schema", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "supportFileReference": true, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "JSON schema for structured output validation"
},
- "maxAgenticTokens": { "index": 48, "kind": "parameter", "displayName":
"Max Agentic Tokens", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Maximum cumulative prompt plus completion
tokens allowed across the MCP agentic loop. When 0 o [...]
+ "maxAgenticTokens": { "index": 48, "kind": "parameter", "displayName":
"Max Agentic Tokens", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Maximum cumulative prompt plus completion
tokens allowed across the tool loop. When 0 or negat [...]
"maxHistoryMessages": { "index": 49, "kind": "parameter", "displayName":
"Max History Messages", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When conversationMemory is enabled, retain at
most this many messages in the exchange conve [...]
"maxHistoryTokens": { "index": 50, "kind": "parameter", "displayName":
"Max History Tokens", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When conversationMemory is enabled, trim
conversation history using a token estimate (character [...]
"maxRetries": { "index": 51, "kind": "parameter", "displayName": "Max
Retries", "group": "common", "label": "", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 2, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Maximum number of times the OpenAI SDK client
retries failed requests. The SDK retry is rate-limit aware (ho [...]
@@ -230,7 +230,7 @@
"streaming": { "index": 73, "kind": "parameter", "displayName":
"Streaming", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Enable streaming responses" },
"stripThinking": { "index": 74, "kind": "parameter", "displayName": "Strip
Thinking", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Strip ... blocks from model responses (used by
reasoning models like Qwen3, DeepSeek-R1). The [...]
"systemMessage": { "index": 75, "kind": "parameter", "displayName":
"System Message", "group": "common", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "System message to prepend. When set and
conversationMemory is enabled, the conversation history is reset." },
- "tags": { "index": 76, "kind": "parameter", "displayName": "Tags",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Comma-separated tags for discovering
route-based tools registered via the ai-tool component. When set, matching
tools from the s [...]
+ "tags": { "index": 76, "kind": "parameter", "displayName": "Tags",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Comma-separated tags for discovering
route-based tools registered via the ai-tool component. When set, matching
tools from the s [...]
"temperature": { "index": 77, "kind": "parameter", "displayName":
"Temperature", "group": "common", "label": "", "required": false, "type":
"number", "javaType": "java.lang.Double", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Temperature for response generation (0.0 to
2.0)" },
"toolExecutionErrorStrategy": { "index": 78, "kind": "parameter",
"displayName": "Tool Execution Error Strategy", "group": "common", "label": "",
"required": false, "type": "enum", "javaType":
"org.apache.camel.component.openai.ToolExecutionErrorStrategy", "enum": [
"failExchange", "repromptModel" ], "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "failExchange", "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationFie [...]
"toolSearch": { "index": 79, "kind": "parameter", "displayName": "Tool
Search", "group": "common", "label": "", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When true, route tools marked searchable and
remote MCP tools are omitted from the initial model req [...]
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openai-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openai-component.adoc
index a0d28d6b580f..1a43bbfda40b 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openai-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openai-component.adoc
@@ -1379,7 +1379,7 @@ The `streaming=true` option returns an
`Iterator<ChatCompletionChunk>` that can
For user-facing scenarios that require Server-Sent Events (SSE) or WebSocket
delivery to a browser, see
xref:ai-llm-integration-guide.adoc#_streaming_responses[LLM Integration Guide —
Streaming responses] for platform-http patterns and when to stream through
Camel vs. a dedicated handler.
-NOTE: When MCP tools with `autoToolExecution` are active, streaming
automatically falls back to non-streaming to allow the agentic tool-calling
loop to function. See xref:others:openai-mcp.adoc[MCP Tool Calling] for details.
+NOTE: When tools (MCP tools or route tools from `tags`) with
`autoToolExecution` are active, streaming automatically falls back to
non-streaming to allow the agentic tool-calling loop to function. See
xref:others:openai-mcp.adoc[MCP Tool Calling] for details.
== Sub-Pages
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openai-mcp.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openai-mcp.adoc
index cef6118bb38a..4f7fc9e7dfc2 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openai-mcp.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openai-mcp.adoc
@@ -7,6 +7,8 @@ xref:ROOT:openai-component.adoc[Back to OpenAI Component]
The component supports automatic tool calling via the
https://modelcontextprotocol.io[Model Context Protocol (MCP)]. When MCP servers
are configured, the component acts as an MCP client: it lists available tools,
converts them to OpenAI function-calling format, and runs an agentic loop — the
model requests tool calls, the component executes them via MCP, feeds results
back, and repeats until the model produces a final text answer.
+The same loop runs route tools: Camel routes that start with the
xref:components::ai-tool-component.adoc[ai-tool component] and are selected
with the `tags` option. Route tools need no MCP server, and an endpoint can use
both kinds of tools together. See <<_route_tools>>.
+
=== MCP Server Configuration
MCP servers are configured inline on the endpoint URI using the `mcpServer.`
prefix pattern. Each server is identified by a name, with sub-properties for
transport type, command/URL, and arguments.
@@ -239,7 +241,7 @@ tool set remains stable across connection recovery.
When the model responds with tool calls, the component automatically:
-1. Executes each tool call via the corresponding MCP server
+1. Executes each tool call via the corresponding MCP server, or the route of a
route tool
2. Sends the tool results back to the model
3. Repeats until the model produces a final text response
@@ -302,6 +304,81 @@ YAML::
----
====
+=== Route Tools
+
+A route that starts with `ai-tool:` is a tool the model can call. Set `tags`
on the OpenAI endpoint to the tags of
+the tools it may use: the component sends their definitions to the model, runs
the route when the model calls the
+tool, and sends the result back to the model in the same loop as MCP tools. No
`mcpServer.*` option is needed.
+
+The tool arguments of the model arrive on the tool route as headers. What the
route sets as the body is the result
+the model gets.
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("direct:ask")
+ .to("openai:chat-completion?model=gpt-4o-mini&tags=shop");
+
+from("ai-tool:stock?tags=shop&description=Get the number of items in stock for
a product" +
+ "¶meter.sku=string¶meter.sku.description=The product
SKU¶meter.sku.required=true")
+ .setBody(simple("12 items of ${header.sku} in stock"));
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+ <from uri="direct:ask"/>
+ <to uri="openai:chat-completion?model=gpt-4o-mini&tags=shop"/>
+</route>
+
+<route>
+ <from uri="ai-tool:stock?tags=shop&description=Get the number of items
in stock for a
product&parameter.sku=string&parameter.sku.description=The product
SKU&parameter.sku.required=true"/>
+ <setBody>
+ <simple>12 items of ${header.sku} in stock</simple>
+ </setBody>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:ask
+ steps:
+ - to:
+ uri: openai:chat-completion
+ parameters:
+ model: gpt-4o-mini
+ tags: shop
+- route:
+ from:
+ uri: ai-tool:stock
+ parameters:
+ tags: shop
+ description: Get the number of items in stock for a product
+ parameter.sku: string
+ parameter.sku.description: The product SKU
+ parameter.sku.required: true
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "12 items of ${header.sku} in stock"
+----
+====
+
+`maxToolIterations`, `maxAgenticTokens`, `parallelToolExecution`,
`returnDirect` and `autoToolExecution=false` with
+the `tool-execution` operation work the same for route tools as for MCP tools.
See the
+xref:components::ai-tool-component.adoc[ai-tool component] for the tool
parameters, argument schemas and tag-based
+discovery.
+
=== Parallel Tool Execution
A model can request several tool calls in a single response. By default, the
component executes them one after another,
@@ -785,5 +862,5 @@ Two endpoint options control what happens when a tool call
fails:
| MCP `CallToolResult.isError()` is true | Error content is sent as tool
result text to the model
| Tool name not found in any server | Governed by
`hallucinatedToolNameStrategy`: `failExchange` (default) throws
`IllegalStateException`; `repromptModel` sends a corrective tool result listing
available tools
| Max iterations exceeded | `IllegalStateException` is thrown with the tool
call log
-| Streaming + MCP tools with autoToolExecution | Falls back to non-streaming
(logged as INFO)
+| Streaming + MCP or route tools with autoToolExecution | Falls back to
non-streaming (logged as INFO)
|===
diff --git
a/components/camel-ai/camel-openai/src/generated/resources/META-INF/org/apache/camel/component/openai/llm.json
b/components/camel-ai/camel-openai/src/generated/resources/META-INF/org/apache/camel/component/openai/llm.json
index daa5e0266f56..5c05da15f8b8 100644
---
a/components/camel-ai/camel-openai/src/generated/resources/META-INF/org/apache/camel/component/openai/llm.json
+++
b/components/camel-ai/camel-openai/src/generated/resources/META-INF/org/apache/camel/component/openai/llm.json
@@ -151,7 +151,7 @@
"consumerOut": { "carriers": [ "pojo" ], "javaType":
"com.openai.models.webhooks.UnwrapWebhookEvent", "description": "The event of
the webhook operation, verified with webhookSecret, such as a batch or a
background response that completed. The event type and the id of the object it
is about are in headers" },
"consumerReply": { "carriers": [ "any" ], "description": "The body at the
end of the route is not sent: OpenAI gets 200 without a body, or 500 when the
route fails, and then sends the event again" },
"producerIn": { "carriers": [ "any" ], "byOption": [ { "option":
"operation", "value": "decisions", "carriers": [ "pojo" ], "javaType":
"com.openai.models.decisions.DecisionCreateParams" }, { "option": "operation",
"value": "batch", "carriers": [ "map", "list", "text", "bytes", "stream",
"file" ] }, { "option": "operation", "value": "audio-transcription",
"carriers": [ "file", "bytes", "stream" ] }, { "option": "operation", "value":
"audio-translation", "carriers": [ "file", "bytes", [...]
- "producerOut": { "carriers": [ "text" ], "byOption": [ { "option":
"streaming", "value": "true", "carriers": [ "iterator" ] }, { "option":
"autoToolExecution", "value": "false", "carriers": [ "text", "pojo", "list" ]
}, { "option": "operation", "value": "decisions", "carriers": [ "pojo" ],
"javaType": "com.openai.models.decisions.Decision" }, { "option": "operation",
"value": "responses", "carriers": [ "text" ] }, { "option": "operation",
"value": "responses-retrieve", "carriers": [ [...]
+ "producerOut": { "carriers": [ "text" ], "byOption": [ { "option":
"streaming", "value": "true", "carriers": [ "iterator" ] }, { "option":
"autoToolExecution", "value": "false", "carriers": [ "text", "pojo", "list" ]
}, { "option": "operation", "value": "decisions", "carriers": [ "pojo" ],
"javaType": "com.openai.models.decisions.Decision" }, { "option": "operation",
"value": "responses", "carriers": [ "text" ] }, { "option": "operation",
"value": "responses-retrieve", "carriers": [ [...]
},
"properties": {
"operation": { "index": 0, "kind": "path", "displayName": "Operation",
"group": "common", "label": "", "required": true, "type": "enum", "javaType":
"org.apache.camel.component.openai.OpenAIOperations", "enum": [
"chat-completion", "decisions", "responses", "responses-retrieve",
"responses-cancel", "batch", "batch-retrieve", "batch-cancel", "batch-results",
"embeddings", "tool-execution", "audio-transcription", "audio-translation",
"audio-speech", "moderation", "image-generation", "i [...]
@@ -171,7 +171,7 @@
"audioResponseFormat": { "index": 14, "kind": "parameter", "displayName":
"Audio Response Format", "group": "common", "label": "", "required": false,
"type": "enum", "javaType": "java.lang.String", "enum": [ "json", "text",
"srt", "verbose_json", "vtt", "diarized_json" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "json",
"configurationClass": "org.apache.camel.component.openai.OpenAIConfiguration",
"configurationField": "configuration", "description": [...]
"audioTemperature": { "index": 15, "kind": "parameter", "displayName":
"Audio Temperature", "group": "common", "label": "", "required": false, "type":
"number", "javaType": "java.lang.Double", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Sampling temperature for transcription (0.0 to
1.0)" },
"audioTimestampGranularities": { "index": 16, "kind": "parameter",
"displayName": "Audio Timestamp Granularities", "group": "common", "label": "",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Comma-separated timestamp granularities:
'word', 'segment', or 'word,segment'. O [...]
- "autoToolExecution": { "index": 17, "kind": "parameter", "displayName":
"Auto Tool Execution", "group": "common", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When true and MCP servers are configured,
automatically execute tool calls and loop ba [...]
+ "autoToolExecution": { "index": 17, "kind": "parameter", "displayName":
"Auto Tool Execution", "group": "common", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When true, run the tool calls the model asks
for, both MCP tools (mcpServer.*) and rou [...]
"background": { "index": 18, "kind": "parameter", "displayName":
"Background", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Run the model response in the background
(Responses API only). The exchange completes as soon as the [...]
"baseUrl": { "index": 19, "kind": "parameter", "displayName": "Base Url",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "https:\/\/api.openai.com\/v1",
"configurationClass": "org.apache.camel.component.openai.OpenAIConfiguration",
"configurationField": "configuration", "description": "Base URL for OpenAI API.
Defaults to OpenAI's official endpoint. Can be u [...]
"batchEndpoint": { "index": 20, "kind": "parameter", "displayName": "Batch
Endpoint", "group": "common", "label": "", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "\/v1\/responses",
"\/v1\/chat\/completions", "\/v1\/embeddings", "\/v1\/completions",
"\/v1\/moderations", "\/v1\/images\/generations", "\/v1\/images\/edits",
"\/v1\/videos" ], "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.openai. [...]
@@ -202,7 +202,7 @@
"imageSize": { "index": 45, "kind": "parameter", "displayName": "Image
Size", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "The size of the generated image (e.g.,
1024x1024, 1536x1024, 1024x1536, auto). The accepted values depend on the
model." },
"imageStyle": { "index": 46, "kind": "parameter", "displayName": "Image
Style", "group": "common", "label": "", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "vivid", "natural" ], "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "The style of the generated image. A dall-e-3
option, so only useful with OpenAI-compa [...]
"jsonSchema": { "index": 47, "kind": "parameter", "displayName": "Json
Schema", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "supportFileReference": true, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "JSON schema for structured output validation"
},
- "maxAgenticTokens": { "index": 48, "kind": "parameter", "displayName":
"Max Agentic Tokens", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Maximum cumulative prompt plus completion
tokens allowed across the MCP agentic loop. When 0 o [...]
+ "maxAgenticTokens": { "index": 48, "kind": "parameter", "displayName":
"Max Agentic Tokens", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Maximum cumulative prompt plus completion
tokens allowed across the tool loop. When 0 or negat [...]
"maxHistoryMessages": { "index": 49, "kind": "parameter", "displayName":
"Max History Messages", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When conversationMemory is enabled, retain at
most this many messages in the exchange conve [...]
"maxHistoryTokens": { "index": 50, "kind": "parameter", "displayName":
"Max History Tokens", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When conversationMemory is enabled, trim
conversation history using a token estimate (character [...]
"maxRetries": { "index": 51, "kind": "parameter", "displayName": "Max
Retries", "group": "common", "label": "", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 2, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Maximum number of times the OpenAI SDK client
retries failed requests. The SDK retry is rate-limit aware (ho [...]
@@ -230,7 +230,7 @@
"streaming": { "index": 73, "kind": "parameter", "displayName":
"Streaming", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Enable streaming responses" },
"stripThinking": { "index": 74, "kind": "parameter", "displayName": "Strip
Thinking", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Strip ... blocks from model responses (used by
reasoning models like Qwen3, DeepSeek-R1). The [...]
"systemMessage": { "index": 75, "kind": "parameter", "displayName":
"System Message", "group": "common", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "System message to prepend. When set and
conversationMemory is enabled, the conversation history is reset." },
- "tags": { "index": 76, "kind": "parameter", "displayName": "Tags",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Comma-separated tags for discovering
route-based tools registered via the ai-tool component. When set, matching
tools from the s [...]
+ "tags": { "index": 76, "kind": "parameter", "displayName": "Tags",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Comma-separated tags for discovering
route-based tools registered via the ai-tool component. When set, matching
tools from the s [...]
"temperature": { "index": 77, "kind": "parameter", "displayName":
"Temperature", "group": "common", "label": "", "required": false, "type":
"number", "javaType": "java.lang.Double", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Temperature for response generation (0.0 to
2.0)" },
"toolExecutionErrorStrategy": { "index": 78, "kind": "parameter",
"displayName": "Tool Execution Error Strategy", "group": "common", "label": "",
"required": false, "type": "enum", "javaType":
"org.apache.camel.component.openai.ToolExecutionErrorStrategy", "enum": [
"failExchange", "repromptModel" ], "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "failExchange", "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationFie [...]
"toolSearch": { "index": 79, "kind": "parameter", "displayName": "Tool
Search", "group": "common", "label": "", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When true, route tools marked searchable and
remote MCP tools are omitted from the initial model req [...]
diff --git
a/components/camel-ai/camel-openai/src/generated/resources/META-INF/org/apache/camel/component/openai/openai.json
b/components/camel-ai/camel-openai/src/generated/resources/META-INF/org/apache/camel/component/openai/openai.json
index 48e11976ace4..118e47718618 100644
---
a/components/camel-ai/camel-openai/src/generated/resources/META-INF/org/apache/camel/component/openai/openai.json
+++
b/components/camel-ai/camel-openai/src/generated/resources/META-INF/org/apache/camel/component/openai/openai.json
@@ -151,7 +151,7 @@
"consumerOut": { "carriers": [ "pojo" ], "javaType":
"com.openai.models.webhooks.UnwrapWebhookEvent", "description": "The event of
the webhook operation, verified with webhookSecret, such as a batch or a
background response that completed. The event type and the id of the object it
is about are in headers" },
"consumerReply": { "carriers": [ "any" ], "description": "The body at the
end of the route is not sent: OpenAI gets 200 without a body, or 500 when the
route fails, and then sends the event again" },
"producerIn": { "carriers": [ "any" ], "byOption": [ { "option":
"operation", "value": "decisions", "carriers": [ "pojo" ], "javaType":
"com.openai.models.decisions.DecisionCreateParams" }, { "option": "operation",
"value": "batch", "carriers": [ "map", "list", "text", "bytes", "stream",
"file" ] }, { "option": "operation", "value": "audio-transcription",
"carriers": [ "file", "bytes", "stream" ] }, { "option": "operation", "value":
"audio-translation", "carriers": [ "file", "bytes", [...]
- "producerOut": { "carriers": [ "text" ], "byOption": [ { "option":
"streaming", "value": "true", "carriers": [ "iterator" ] }, { "option":
"autoToolExecution", "value": "false", "carriers": [ "text", "pojo", "list" ]
}, { "option": "operation", "value": "decisions", "carriers": [ "pojo" ],
"javaType": "com.openai.models.decisions.Decision" }, { "option": "operation",
"value": "responses", "carriers": [ "text" ] }, { "option": "operation",
"value": "responses-retrieve", "carriers": [ [...]
+ "producerOut": { "carriers": [ "text" ], "byOption": [ { "option":
"streaming", "value": "true", "carriers": [ "iterator" ] }, { "option":
"autoToolExecution", "value": "false", "carriers": [ "text", "pojo", "list" ]
}, { "option": "operation", "value": "decisions", "carriers": [ "pojo" ],
"javaType": "com.openai.models.decisions.Decision" }, { "option": "operation",
"value": "responses", "carriers": [ "text" ] }, { "option": "operation",
"value": "responses-retrieve", "carriers": [ [...]
},
"properties": {
"operation": { "index": 0, "kind": "path", "displayName": "Operation",
"group": "common", "label": "", "required": true, "type": "enum", "javaType":
"org.apache.camel.component.openai.OpenAIOperations", "enum": [
"chat-completion", "decisions", "responses", "responses-retrieve",
"responses-cancel", "batch", "batch-retrieve", "batch-cancel", "batch-results",
"embeddings", "tool-execution", "audio-transcription", "audio-translation",
"audio-speech", "moderation", "image-generation", "i [...]
@@ -171,7 +171,7 @@
"audioResponseFormat": { "index": 14, "kind": "parameter", "displayName":
"Audio Response Format", "group": "common", "label": "", "required": false,
"type": "enum", "javaType": "java.lang.String", "enum": [ "json", "text",
"srt", "verbose_json", "vtt", "diarized_json" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "json",
"configurationClass": "org.apache.camel.component.openai.OpenAIConfiguration",
"configurationField": "configuration", "description": [...]
"audioTemperature": { "index": 15, "kind": "parameter", "displayName":
"Audio Temperature", "group": "common", "label": "", "required": false, "type":
"number", "javaType": "java.lang.Double", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Sampling temperature for transcription (0.0 to
1.0)" },
"audioTimestampGranularities": { "index": 16, "kind": "parameter",
"displayName": "Audio Timestamp Granularities", "group": "common", "label": "",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Comma-separated timestamp granularities:
'word', 'segment', or 'word,segment'. O [...]
- "autoToolExecution": { "index": 17, "kind": "parameter", "displayName":
"Auto Tool Execution", "group": "common", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When true and MCP servers are configured,
automatically execute tool calls and loop ba [...]
+ "autoToolExecution": { "index": 17, "kind": "parameter", "displayName":
"Auto Tool Execution", "group": "common", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When true, run the tool calls the model asks
for, both MCP tools (mcpServer.*) and rou [...]
"background": { "index": 18, "kind": "parameter", "displayName":
"Background", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Run the model response in the background
(Responses API only). The exchange completes as soon as the [...]
"baseUrl": { "index": 19, "kind": "parameter", "displayName": "Base Url",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "https:\/\/api.openai.com\/v1",
"configurationClass": "org.apache.camel.component.openai.OpenAIConfiguration",
"configurationField": "configuration", "description": "Base URL for OpenAI API.
Defaults to OpenAI's official endpoint. Can be u [...]
"batchEndpoint": { "index": 20, "kind": "parameter", "displayName": "Batch
Endpoint", "group": "common", "label": "", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "\/v1\/responses",
"\/v1\/chat\/completions", "\/v1\/embeddings", "\/v1\/completions",
"\/v1\/moderations", "\/v1\/images\/generations", "\/v1\/images\/edits",
"\/v1\/videos" ], "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.openai. [...]
@@ -202,7 +202,7 @@
"imageSize": { "index": 45, "kind": "parameter", "displayName": "Image
Size", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "The size of the generated image (e.g.,
1024x1024, 1536x1024, 1024x1536, auto). The accepted values depend on the
model." },
"imageStyle": { "index": 46, "kind": "parameter", "displayName": "Image
Style", "group": "common", "label": "", "required": false, "type": "enum",
"javaType": "java.lang.String", "enum": [ "vivid", "natural" ], "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "The style of the generated image. A dall-e-3
option, so only useful with OpenAI-compa [...]
"jsonSchema": { "index": 47, "kind": "parameter", "displayName": "Json
Schema", "group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "supportFileReference": true, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "JSON schema for structured output validation"
},
- "maxAgenticTokens": { "index": 48, "kind": "parameter", "displayName":
"Max Agentic Tokens", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Maximum cumulative prompt plus completion
tokens allowed across the MCP agentic loop. When 0 o [...]
+ "maxAgenticTokens": { "index": 48, "kind": "parameter", "displayName":
"Max Agentic Tokens", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "long", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Maximum cumulative prompt plus completion
tokens allowed across the tool loop. When 0 or negat [...]
"maxHistoryMessages": { "index": 49, "kind": "parameter", "displayName":
"Max History Messages", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When conversationMemory is enabled, retain at
most this many messages in the exchange conve [...]
"maxHistoryTokens": { "index": 50, "kind": "parameter", "displayName":
"Max History Tokens", "group": "common", "label": "", "required": false,
"type": "integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 0, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When conversationMemory is enabled, trim
conversation history using a token estimate (character [...]
"maxRetries": { "index": 51, "kind": "parameter", "displayName": "Max
Retries", "group": "common", "label": "", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": 2, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Maximum number of times the OpenAI SDK client
retries failed requests. The SDK retry is rate-limit aware (ho [...]
@@ -230,7 +230,7 @@
"streaming": { "index": 73, "kind": "parameter", "displayName":
"Streaming", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Enable streaming responses" },
"stripThinking": { "index": 74, "kind": "parameter", "displayName": "Strip
Thinking", "group": "common", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Strip ... blocks from model responses (used by
reasoning models like Qwen3, DeepSeek-R1). The [...]
"systemMessage": { "index": 75, "kind": "parameter", "displayName":
"System Message", "group": "common", "label": "", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "System message to prepend. When set and
conversationMemory is enabled, the conversation history is reset." },
- "tags": { "index": 76, "kind": "parameter", "displayName": "Tags",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Comma-separated tags for discovering
route-based tools registered via the ai-tool component. When set, matching
tools from the s [...]
+ "tags": { "index": 76, "kind": "parameter", "displayName": "Tags",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Comma-separated tags for discovering
route-based tools registered via the ai-tool component. When set, matching
tools from the s [...]
"temperature": { "index": 77, "kind": "parameter", "displayName":
"Temperature", "group": "common", "label": "", "required": false, "type":
"number", "javaType": "java.lang.Double", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "Temperature for response generation (0.0 to
2.0)" },
"toolExecutionErrorStrategy": { "index": 78, "kind": "parameter",
"displayName": "Tool Execution Error Strategy", "group": "common", "label": "",
"required": false, "type": "enum", "javaType":
"org.apache.camel.component.openai.ToolExecutionErrorStrategy", "enum": [
"failExchange", "repromptModel" ], "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "failExchange", "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationFie [...]
"toolSearch": { "index": 79, "kind": "parameter", "displayName": "Tool
Search", "group": "common", "label": "", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.openai.OpenAIConfiguration", "configurationField":
"configuration", "description": "When true, route tools marked searchable and
remote MCP tools are omitted from the initial model req [...]
diff --git
a/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
b/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
index a0d28d6b580f..1a43bbfda40b 100644
--- a/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
+++ b/components/camel-ai/camel-openai/src/main/docs/openai-component.adoc
@@ -1379,7 +1379,7 @@ The `streaming=true` option returns an
`Iterator<ChatCompletionChunk>` that can
For user-facing scenarios that require Server-Sent Events (SSE) or WebSocket
delivery to a browser, see
xref:ai-llm-integration-guide.adoc#_streaming_responses[LLM Integration Guide —
Streaming responses] for platform-http patterns and when to stream through
Camel vs. a dedicated handler.
-NOTE: When MCP tools with `autoToolExecution` are active, streaming
automatically falls back to non-streaming to allow the agentic tool-calling
loop to function. See xref:others:openai-mcp.adoc[MCP Tool Calling] for details.
+NOTE: When tools (MCP tools or route tools from `tags`) with
`autoToolExecution` are active, streaming automatically falls back to
non-streaming to allow the agentic tool-calling loop to function. See
xref:others:openai-mcp.adoc[MCP Tool Calling] for details.
== Sub-Pages
diff --git a/components/camel-ai/camel-openai/src/main/docs/openai-mcp.adoc
b/components/camel-ai/camel-openai/src/main/docs/openai-mcp.adoc
index cef6118bb38a..4f7fc9e7dfc2 100644
--- a/components/camel-ai/camel-openai/src/main/docs/openai-mcp.adoc
+++ b/components/camel-ai/camel-openai/src/main/docs/openai-mcp.adoc
@@ -7,6 +7,8 @@ xref:ROOT:openai-component.adoc[Back to OpenAI Component]
The component supports automatic tool calling via the
https://modelcontextprotocol.io[Model Context Protocol (MCP)]. When MCP servers
are configured, the component acts as an MCP client: it lists available tools,
converts them to OpenAI function-calling format, and runs an agentic loop — the
model requests tool calls, the component executes them via MCP, feeds results
back, and repeats until the model produces a final text answer.
+The same loop runs route tools: Camel routes that start with the
xref:components::ai-tool-component.adoc[ai-tool component] and are selected
with the `tags` option. Route tools need no MCP server, and an endpoint can use
both kinds of tools together. See <<_route_tools>>.
+
=== MCP Server Configuration
MCP servers are configured inline on the endpoint URI using the `mcpServer.`
prefix pattern. Each server is identified by a name, with sub-properties for
transport type, command/URL, and arguments.
@@ -239,7 +241,7 @@ tool set remains stable across connection recovery.
When the model responds with tool calls, the component automatically:
-1. Executes each tool call via the corresponding MCP server
+1. Executes each tool call via the corresponding MCP server, or the route of a
route tool
2. Sends the tool results back to the model
3. Repeats until the model produces a final text response
@@ -302,6 +304,81 @@ YAML::
----
====
+=== Route Tools
+
+A route that starts with `ai-tool:` is a tool the model can call. Set `tags`
on the OpenAI endpoint to the tags of
+the tools it may use: the component sends their definitions to the model, runs
the route when the model calls the
+tool, and sends the result back to the model in the same loop as MCP tools. No
`mcpServer.*` option is needed.
+
+The tool arguments of the model arrive on the tool route as headers. What the
route sets as the body is the result
+the model gets.
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("direct:ask")
+ .to("openai:chat-completion?model=gpt-4o-mini&tags=shop");
+
+from("ai-tool:stock?tags=shop&description=Get the number of items in stock for
a product" +
+ "¶meter.sku=string¶meter.sku.description=The product
SKU¶meter.sku.required=true")
+ .setBody(simple("12 items of ${header.sku} in stock"));
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+ <from uri="direct:ask"/>
+ <to uri="openai:chat-completion?model=gpt-4o-mini&tags=shop"/>
+</route>
+
+<route>
+ <from uri="ai-tool:stock?tags=shop&description=Get the number of items
in stock for a
product&parameter.sku=string&parameter.sku.description=The product
SKU&parameter.sku.required=true"/>
+ <setBody>
+ <simple>12 items of ${header.sku} in stock</simple>
+ </setBody>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:ask
+ steps:
+ - to:
+ uri: openai:chat-completion
+ parameters:
+ model: gpt-4o-mini
+ tags: shop
+- route:
+ from:
+ uri: ai-tool:stock
+ parameters:
+ tags: shop
+ description: Get the number of items in stock for a product
+ parameter.sku: string
+ parameter.sku.description: The product SKU
+ parameter.sku.required: true
+ steps:
+ - setBody:
+ expression:
+ simple:
+ expression: "12 items of ${header.sku} in stock"
+----
+====
+
+`maxToolIterations`, `maxAgenticTokens`, `parallelToolExecution`,
`returnDirect` and `autoToolExecution=false` with
+the `tool-execution` operation work the same for route tools as for MCP tools.
See the
+xref:components::ai-tool-component.adoc[ai-tool component] for the tool
parameters, argument schemas and tag-based
+discovery.
+
=== Parallel Tool Execution
A model can request several tool calls in a single response. By default, the
component executes them one after another,
@@ -785,5 +862,5 @@ Two endpoint options control what happens when a tool call
fails:
| MCP `CallToolResult.isError()` is true | Error content is sent as tool
result text to the model
| Tool name not found in any server | Governed by
`hallucinatedToolNameStrategy`: `failExchange` (default) throws
`IllegalStateException`; `repromptModel` sends a corrective tool result listing
available tools
| Max iterations exceeded | `IllegalStateException` is thrown with the tool
call log
-| Streaming + MCP tools with autoToolExecution | Falls back to non-streaming
(logged as INFO)
+| Streaming + MCP or route tools with autoToolExecution | Falls back to
non-streaming (logged as INFO)
|===
diff --git
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/AgenticIterationTrace.java
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/AgenticIterationTrace.java
index 36d9295c4d4e..5f6440ab2446 100644
---
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/AgenticIterationTrace.java
+++
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/AgenticIterationTrace.java
@@ -19,7 +19,7 @@ package org.apache.camel.component.openai;
import java.util.List;
/**
- * Trace entry for one iteration of the OpenAI MCP agentic loop.
+ * Trace entry for one iteration of the OpenAI agentic loop (MCP and route
tools).
*
* @param iteration 1-based sequence number for each model call in the
agentic loop
* @param toolCalls tool calls executed in this iteration, empty when
the model produced a final answer
diff --git
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAgenticLoopCompletedEvent.java
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAgenticLoopCompletedEvent.java
index 2e99e58b5778..db352d1c9485 100644
---
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAgenticLoopCompletedEvent.java
+++
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAgenticLoopCompletedEvent.java
@@ -22,7 +22,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.ai.AiEvent;
/**
- * Fired when an OpenAI MCP agentic loop completes on an exchange.
+ * Fired when an OpenAI agentic loop (MCP and route tools) completes on an
exchange.
*
* @since 4.23
*/
diff --git
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAgenticLoopStartedEvent.java
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAgenticLoopStartedEvent.java
index 597fa127aba5..52660915ecf5 100644
---
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAgenticLoopStartedEvent.java
+++
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAgenticLoopStartedEvent.java
@@ -22,7 +22,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.ai.AiEvent;
/**
- * Fired when an OpenAI MCP agentic loop starts on an exchange.
+ * Fired when an OpenAI agentic loop (MCP and route tools) starts on an
exchange.
*
* @since 4.23
*/
diff --git
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAgenticToolCallExecutedEvent.java
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAgenticToolCallExecutedEvent.java
index 01597c8a4549..ca8fc53dc153 100644
---
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAgenticToolCallExecutedEvent.java
+++
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIAgenticToolCallExecutedEvent.java
@@ -22,7 +22,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.ai.AiEvent;
/**
- * Fired after a single tool call completes during an OpenAI MCP agentic loop.
+ * Fired after a single tool call completes during an OpenAI agentic loop (MCP
and route tools).
*
* @since 4.23
*/
diff --git
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIConfiguration.java
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIConfiguration.java
index 4d2c2736fc96..a33345d166f8 100644
---
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIConfiguration.java
+++
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIConfiguration.java
@@ -261,7 +261,7 @@ public class OpenAIConfiguration implements Cloneable {
private int maxToolIterations = 50;
@UriParam(defaultValue = "0")
- @Metadata(description = "Maximum cumulative prompt plus completion tokens
allowed across the MCP agentic loop. "
+ @Metadata(description = "Maximum cumulative prompt plus completion tokens
allowed across the tool loop. "
+ "When 0 or negative, no token budget is
enforced. Enforcement runs after each API call "
+ "that requests further tool execution, so actual
spend may exceed the configured budget "
+ "by up to one call (typically the largest, as
the prompt grows each iteration). "
@@ -269,13 +269,15 @@ public class OpenAIConfiguration implements Cloneable {
private long maxAgenticTokens;
@UriParam(defaultValue = "true")
- @Metadata(description = "When true and MCP servers are configured,
automatically execute tool calls "
- + "and loop back to the model. When false, tool
calls are returned as the message body for manual handling.")
+ @Metadata(description = "When true, run the tool calls the model asks for,
both MCP tools (mcpServer.*) and route "
+ + "tools (tags), and send the results back to the
model until it answers. When false, the tool "
+ + "calls are returned as the message body for the
route to handle.")
private boolean autoToolExecution = true;
@UriParam
@Metadata(description = "Comma-separated tags for discovering route-based
tools registered via the ai-tool component. "
- + "When set, matching tools from the shared
AiToolRegistry are exposed to the model alongside MCP tools.")
+ + "When set, matching tools from the shared
AiToolRegistry are exposed to the model alongside MCP tools, "
+ + "and run in the same tool loop (see
autoToolExecution). No MCP server is needed for route tools.")
private String tags;
@UriParam
diff --git
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIEndpoint.java
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIEndpoint.java
index b69689115367..a2a9ba7e14fa 100644
---
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIEndpoint.java
+++
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIEndpoint.java
@@ -160,7 +160,7 @@ import org.slf4j.LoggerFactory;
carriers = {
Carrier.BYTES, Carrier.TEXT, Carrier.LIST }) },
description = "The answer of
chat-completion as text, also with outputClass or"
+ " jsonSchema, where it is
JSON text: unmarshal it to read its fields."
- + " With streaming, an
Iterator of the chunks (text when MCP tools run in"
+ + " With streaming, an
Iterator of the chunks (text when tools run in"
+ " a loop). With
autoToolExecution=false, the tool calls the model asks"
+ " for: an Optional of the
List of tool calls, or a List of the function"
+ " calls for responses.
embeddings gives a vector (a List of Float), or a"
diff --git
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIProducer.java
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIProducer.java
index 46f22c9f0076..62bb617ec497 100644
---
a/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIProducer.java
+++
b/components/camel-ai/camel-openai/src/main/java/org/apache/camel/component/openai/OpenAIProducer.java
@@ -241,7 +241,7 @@ public class OpenAIProducer extends DefaultAsyncProducer {
// Search installs a synthetic tool even when every real tool is
omitted, so the agentic loop still runs.
boolean agenticTools = toolSearchEnabled || hasMcpTools;
if (Boolean.TRUE.equals(streaming) && agenticTools &&
config.isAutoToolExecution()) {
- LOG.info("Streaming with MCP tools is not supported; falling
back to non-streaming for the agentic loop");
+ LOG.info("Streaming with tools is not supported; falling back
to non-streaming for the tool loop");
processNonStreaming(exchange, params, config);
} else if (Boolean.TRUE.equals(streaming)) {
processStreaming(exchange, params);
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpenAIEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpenAIEndpointBuilderFactory.java
index d4984088e846..d87f330ce662 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpenAIEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OpenAIEndpointBuilderFactory.java
@@ -379,9 +379,10 @@ public interface OpenAIEndpointBuilderFactory {
return this;
}
/**
- * When true and MCP servers are configured, automatically execute tool
- * calls and loop back to the model. When false, tool calls are
returned
- * as the message body for manual handling.
+ * When true, run the tool calls the model asks for, both MCP tools
+ * (mcpServer.*) and route tools (tags), and send the results back to
+ * the model until it answers. When false, the tool calls are returned
+ * as the message body for the route to handle.
*
* The option is a: <code>boolean</code> type.
*
@@ -396,9 +397,10 @@ public interface OpenAIEndpointBuilderFactory {
return this;
}
/**
- * When true and MCP servers are configured, automatically execute tool
- * calls and loop back to the model. When false, tool calls are
returned
- * as the message body for manual handling.
+ * When true, run the tool calls the model asks for, both MCP tools
+ * (mcpServer.*) and route tools (tags), and send the results back to
+ * the model until it answers. When false, the tool calls are returned
+ * as the message body for the route to handle.
*
* The option will be converted to a <code>boolean</code> type.
*
@@ -1057,7 +1059,7 @@ public interface OpenAIEndpointBuilderFactory {
}
/**
* Maximum cumulative prompt plus completion tokens allowed across the
- * MCP agentic loop. When 0 or negative, no token budget is enforced.
+ * tool loop. When 0 or negative, no token budget is enforced.
* Enforcement runs after each API call that requests further tool
* execution, so actual spend may exceed the configured budget by up to
* one call (typically the largest, as the prompt grows each
iteration).
@@ -1078,7 +1080,7 @@ public interface OpenAIEndpointBuilderFactory {
}
/**
* Maximum cumulative prompt plus completion tokens allowed across the
- * MCP agentic loop. When 0 or negative, no token budget is enforced.
+ * tool loop. When 0 or negative, no token budget is enforced.
* Enforcement runs after each API call that requests further tool
* execution, so actual spend may exceed the configured budget by up to
* one call (typically the largest, as the prompt grows each
iteration).
@@ -1873,7 +1875,9 @@ public interface OpenAIEndpointBuilderFactory {
/**
* Comma-separated tags for discovering route-based tools registered
via
* the ai-tool component. When set, matching tools from the shared
- * AiToolRegistry are exposed to the model alongside MCP tools.
+ * AiToolRegistry are exposed to the model alongside MCP tools, and run
+ * in the same tool loop (see autoToolExecution). No MCP server is
+ * needed for route tools.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -2941,9 +2945,10 @@ public interface OpenAIEndpointBuilderFactory {
return this;
}
/**
- * When true and MCP servers are configured, automatically execute tool
- * calls and loop back to the model. When false, tool calls are
returned
- * as the message body for manual handling.
+ * When true, run the tool calls the model asks for, both MCP tools
+ * (mcpServer.*) and route tools (tags), and send the results back to
+ * the model until it answers. When false, the tool calls are returned
+ * as the message body for the route to handle.
*
* The option is a: <code>boolean</code> type.
*
@@ -2958,9 +2963,10 @@ public interface OpenAIEndpointBuilderFactory {
return this;
}
/**
- * When true and MCP servers are configured, automatically execute tool
- * calls and loop back to the model. When false, tool calls are
returned
- * as the message body for manual handling.
+ * When true, run the tool calls the model asks for, both MCP tools
+ * (mcpServer.*) and route tools (tags), and send the results back to
+ * the model until it answers. When false, the tool calls are returned
+ * as the message body for the route to handle.
*
* The option will be converted to a <code>boolean</code> type.
*
@@ -3619,7 +3625,7 @@ public interface OpenAIEndpointBuilderFactory {
}
/**
* Maximum cumulative prompt plus completion tokens allowed across the
- * MCP agentic loop. When 0 or negative, no token budget is enforced.
+ * tool loop. When 0 or negative, no token budget is enforced.
* Enforcement runs after each API call that requests further tool
* execution, so actual spend may exceed the configured budget by up to
* one call (typically the largest, as the prompt grows each
iteration).
@@ -3640,7 +3646,7 @@ public interface OpenAIEndpointBuilderFactory {
}
/**
* Maximum cumulative prompt plus completion tokens allowed across the
- * MCP agentic loop. When 0 or negative, no token budget is enforced.
+ * tool loop. When 0 or negative, no token budget is enforced.
* Enforcement runs after each API call that requests further tool
* execution, so actual spend may exceed the configured budget by up to
* one call (typically the largest, as the prompt grows each
iteration).
@@ -4435,7 +4441,9 @@ public interface OpenAIEndpointBuilderFactory {
/**
* Comma-separated tags for discovering route-based tools registered
via
* the ai-tool component. When set, matching tools from the shared
- * AiToolRegistry are exposed to the model alongside MCP tools.
+ * AiToolRegistry are exposed to the model alongside MCP tools, and run
+ * in the same tool loop (see autoToolExecution). No MCP server is
+ * needed for route tools.
*
* The option is a: <code>java.lang.String</code> type.
*
@@ -5352,9 +5360,10 @@ public interface OpenAIEndpointBuilderFactory {
return this;
}
/**
- * When true and MCP servers are configured, automatically execute tool
- * calls and loop back to the model. When false, tool calls are
returned
- * as the message body for manual handling.
+ * When true, run the tool calls the model asks for, both MCP tools
+ * (mcpServer.*) and route tools (tags), and send the results back to
+ * the model until it answers. When false, the tool calls are returned
+ * as the message body for the route to handle.
*
* The option is a: <code>boolean</code> type.
*
@@ -5369,9 +5378,10 @@ public interface OpenAIEndpointBuilderFactory {
return this;
}
/**
- * When true and MCP servers are configured, automatically execute tool
- * calls and loop back to the model. When false, tool calls are
returned
- * as the message body for manual handling.
+ * When true, run the tool calls the model asks for, both MCP tools
+ * (mcpServer.*) and route tools (tags), and send the results back to
+ * the model until it answers. When false, the tool calls are returned
+ * as the message body for the route to handle.
*
* The option will be converted to a <code>boolean</code> type.
*
@@ -6030,7 +6040,7 @@ public interface OpenAIEndpointBuilderFactory {
}
/**
* Maximum cumulative prompt plus completion tokens allowed across the
- * MCP agentic loop. When 0 or negative, no token budget is enforced.
+ * tool loop. When 0 or negative, no token budget is enforced.
* Enforcement runs after each API call that requests further tool
* execution, so actual spend may exceed the configured budget by up to
* one call (typically the largest, as the prompt grows each
iteration).
@@ -6051,7 +6061,7 @@ public interface OpenAIEndpointBuilderFactory {
}
/**
* Maximum cumulative prompt plus completion tokens allowed across the
- * MCP agentic loop. When 0 or negative, no token budget is enforced.
+ * tool loop. When 0 or negative, no token budget is enforced.
* Enforcement runs after each API call that requests further tool
* execution, so actual spend may exceed the configured budget by up to
* one call (typically the largest, as the prompt grows each
iteration).
@@ -6846,7 +6856,9 @@ public interface OpenAIEndpointBuilderFactory {
/**
* Comma-separated tags for discovering route-based tools registered
via
* the ai-tool component. When set, matching tools from the shared
- * AiToolRegistry are exposed to the model alongside MCP tools.
+ * AiToolRegistry are exposed to the model alongside MCP tools, and run
+ * in the same tool loop (see autoToolExecution). No MCP server is
+ * needed for route tools.
*
* The option is a: <code>java.lang.String</code> type.
*