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 9e155bba720f CAMEL-27405: camel-ai-tool - an argSchema without 
additionalProperties gets additionalProperties: false (#30617)
9e155bba720f is described below

commit 9e155bba720f11c3e7a1bb8b0f6c77329b05f058
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 22 21:56:13 2026 +0100

    CAMEL-27405: camel-ai-tool - an argSchema without additionalProperties gets 
additionalProperties: false (#30617)
    
    A tool with argSchema used the schema as written, so an MCP client could
    send undeclared arguments, which the executor then dropped with only a
    WARN. When the schema does not set additionalProperties, Camel now adds
    additionalProperties: false, as for the schema generated from parameter.*,
    so the MCP server (the SDK validates the input) refuses such a call. A
    schema that sets additionalProperties itself is kept as written.
    
    The docs of the CamelAiToolCallId header now say that it is set for
    in-process producers such as openai, and not for a call over MCP.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../apache/camel/catalog/components/ai-tool.json   |  6 +--
 .../camel/catalog/docs/ai-tool-component.adoc      |  5 +-
 .../apache/camel/component/ai/tool/ai-tool.json    |  6 +--
 .../src/main/docs/ai-tool-component.adoc           |  5 +-
 .../component/ai/tool/AiToolConfiguration.java     |  5 +-
 .../camel/component/ai/tool/AiToolConstants.java   |  4 +-
 .../component/ai/tool/AiToolParameterHelper.java   |  8 ++++
 .../ai/tool/AiToolParameterHelperTest.java         | 55 ++++++++++++++++++++++
 .../McpServerConformanceTestSupport.java           | 35 ++++++++++++++
 .../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc    |  9 ++++
 .../dsl/AiToolComponentBuilderFactory.java         |  5 +-
 .../endpoint/dsl/AiToolEndpointBuilderFactory.java | 11 +++--
 12 files changed, 138 insertions(+), 16 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/ai-tool.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/ai-tool.json
index 571edc189eed..a8f5e0c4968c 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/ai-tool.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/ai-tool.json
@@ -24,7 +24,7 @@
     "remote": false
   },
   "componentProperties": {
-    "argSchema": { "index": 0, "kind": "property", "displayName": "Arg 
Schema", "group": "consumer", "label": "consumer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "supportFileReference": true, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "Raw JSON Schema for tool input parameters. 
Supports inline JSON and resource r [...]
+    "argSchema": { "index": 0, "kind": "property", "displayName": "Arg 
Schema", "group": "consumer", "label": "consumer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "supportFileReference": true, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "Raw JSON Schema for tool input parameters. 
Supports inline JSON and resource r [...]
     "argumentsAsBody": { "index": 1, "kind": "property", "displayName": 
"Arguments As Body", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.ai.tool.AiToolConfiguration", 
"configurationField": "configuration", "description": "Whether to populate the 
message body with the tool arguments as a JSON string, e [...]
     "bridgeErrorHandler": { "index": 2, "kind": "property", "displayName": 
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, "description": 
"Allows for bridging the consumer to the Camel routing Error Handler, which 
mean any exceptions (if possible) occurred while the Camel consumer is trying 
to pickup incoming messages, or the like [...]
     "configuration": { "index": 3, "kind": "property", "displayName": 
"Configuration", "group": "consumer", "label": "", "required": false, "type": 
"object", "javaType": "org.apache.camel.component.ai.tool.AiToolConfiguration", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
component configuration" },
@@ -46,7 +46,7 @@
     "authorizationPolicy": { "index": 19, "kind": "property", "displayName": 
"Authorization Policy", "group": "security", "label": "consumer,security", 
"required": false, "type": "object", "javaType": 
"org.apache.camel.spi.AuthorizationPolicy", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "Reference to an 
org.apache.camel.spi.AuthorizationPoli [...]
   },
   "headers": {
-    "CamelAiToolCallId": { "index": 0, "kind": "header", "displayName": "", 
"group": "consumer", "label": "consumer", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The tool invocation identifier supplied by the calling 
framework. Absent when the framework does not supply one.", "constantName": 
"org.apache.camel.component.ai.tool.AiToolConstants#TOOL_CALL_ID" },
+    "CamelAiToolCallId": { "index": 0, "kind": "header", "displayName": "", 
"group": "consumer", "label": "consumer", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The tool invocation identifier supplied by the calling 
framework. Set when an in-process producer (such as openai or 
langchain4j-agent) calls the tool. Absent when the framework does not supply 
one, such as for a call over MCP, where the bridge has no tool ca [...]
     "CamelAiToolConversationId": { "index": 1, "kind": "header", 
"displayName": "", "group": "consumer", "label": "consumer", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The conversation identifier supplied by the calling framework. 
Absent when the framework does not supply one.", "constantName": 
"org.apache.camel.component.ai.tool.AiToolConstants#CONVERSATION_ID" }
   },
   "bodyTypes": {
@@ -55,7 +55,7 @@
   },
   "properties": {
     "toolName": { "index": 0, "kind": "path", "displayName": "Tool Name", 
"group": "consumer", "label": "", "required": true, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "The tool name. This is the name the LLM sees 
and uses to invoke the tool." },
-    "argSchema": { "index": 1, "kind": "parameter", "displayName": "Arg 
Schema", "group": "consumer", "label": "consumer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "supportFileReference": true, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "Raw JSON Schema for tool input parameters. 
Supports inline JSON and resource  [...]
+    "argSchema": { "index": 1, "kind": "parameter", "displayName": "Arg 
Schema", "group": "consumer", "label": "consumer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "supportFileReference": true, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "Raw JSON Schema for tool input parameters. 
Supports inline JSON and resource  [...]
     "argumentsAsBody": { "index": 2, "kind": "parameter", "displayName": 
"Arguments As Body", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.ai.tool.AiToolConfiguration", 
"configurationField": "configuration", "description": "Whether to populate the 
message body with the tool arguments as a JSON string,  [...]
     "description": { "index": 3, "kind": "parameter", "displayName": 
"Description", "group": "consumer", "label": "consumer", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "Human-readable description of what this tool 
does. Passed verbatim to the LLM; be precise and action-ori [...]
     "destructiveHint": { "index": 4, "kind": "parameter", "displayName": 
"Destructive Hint", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "MCP hint that the tool may perform destructive 
or irreversible updates. Advisory for MCP clie [...]
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ai-tool-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ai-tool-component.adoc
index 8dcca187f591..ef9326864c8f 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ai-tool-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ai-tool-component.adoc
@@ -196,7 +196,7 @@ Top-level schema properties are exposed as exchange 
headers. Nested values are p
 
 `argSchema` also supports Camel resource references such as 
`classpath:schemas/create-order.json`.
 
-The root schema must be a JSON Schema object with a top-level `properties` 
map. Camel always allowlists top-level property names when invoking the tool 
route, even if the schema sets `additionalProperties: true`. Nested fields are 
not flattened into headers; only top-level properties become exchange headers 
(Map/List/primitive values).
+The root schema must be a JSON Schema object with a top-level `properties` 
map. When the schema does not set `additionalProperties`, Camel adds 
`additionalProperties: false` to the schema it lists and validates. This is the 
same as for the schema generated from `+parameter.*+`. A client that validates 
the input, such as the MCP server, then refuses a call with an undeclared (for 
example misspelled) argument. Camel no longer drops that argument with a 
warning. A schema that sets `addition [...]
 
 === Structured Tool Output (outputSchema)
 
@@ -340,7 +340,8 @@ These headers are populated independently of 
`argumentsAsBody`. An unavailable i
 * OpenAI supplies the tool-call ID. The Responses API also supplies its 
resolved conversation ID
   (`CamelOpenAIConversationId` or the `conversationId` option); 
chat-completion callbacks omit it.
 * Spring AI Chat supplies the `CamelSpringAiChatConversationId` from the 
calling exchange. Its tool callback does not supply a call ID.
-* MCP server tool callbacks currently do not propagate these identifiers.
+* A call over MCP (`camel-mcp-server`) has neither: the MCP bridge has no tool 
call ID, so `CamelAiToolCallId` is not set.
+  `CamelAiToolCallId` is set only when an in-process producer such as `openai` 
or `langchain4j-agent` calls the tool.
 
 For example, use `${header.CamelAiToolCallId}` to correlate route processing 
with a particular tool invocation.
 Several calls in the same conversation can share `CamelAiToolConversationId` 
while having different call IDs.
diff --git 
a/components/camel-ai/camel-ai-tool/src/generated/resources/META-INF/org/apache/camel/component/ai/tool/ai-tool.json
 
b/components/camel-ai/camel-ai-tool/src/generated/resources/META-INF/org/apache/camel/component/ai/tool/ai-tool.json
index 571edc189eed..a8f5e0c4968c 100644
--- 
a/components/camel-ai/camel-ai-tool/src/generated/resources/META-INF/org/apache/camel/component/ai/tool/ai-tool.json
+++ 
b/components/camel-ai/camel-ai-tool/src/generated/resources/META-INF/org/apache/camel/component/ai/tool/ai-tool.json
@@ -24,7 +24,7 @@
     "remote": false
   },
   "componentProperties": {
-    "argSchema": { "index": 0, "kind": "property", "displayName": "Arg 
Schema", "group": "consumer", "label": "consumer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "supportFileReference": true, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "Raw JSON Schema for tool input parameters. 
Supports inline JSON and resource r [...]
+    "argSchema": { "index": 0, "kind": "property", "displayName": "Arg 
Schema", "group": "consumer", "label": "consumer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "supportFileReference": true, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "Raw JSON Schema for tool input parameters. 
Supports inline JSON and resource r [...]
     "argumentsAsBody": { "index": 1, "kind": "property", "displayName": 
"Arguments As Body", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.ai.tool.AiToolConfiguration", 
"configurationField": "configuration", "description": "Whether to populate the 
message body with the tool arguments as a JSON string, e [...]
     "bridgeErrorHandler": { "index": 2, "kind": "property", "displayName": 
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, "description": 
"Allows for bridging the consumer to the Camel routing Error Handler, which 
mean any exceptions (if possible) occurred while the Camel consumer is trying 
to pickup incoming messages, or the like [...]
     "configuration": { "index": 3, "kind": "property", "displayName": 
"Configuration", "group": "consumer", "label": "", "required": false, "type": 
"object", "javaType": "org.apache.camel.component.ai.tool.AiToolConfiguration", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
component configuration" },
@@ -46,7 +46,7 @@
     "authorizationPolicy": { "index": 19, "kind": "property", "displayName": 
"Authorization Policy", "group": "security", "label": "consumer,security", 
"required": false, "type": "object", "javaType": 
"org.apache.camel.spi.AuthorizationPolicy", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "Reference to an 
org.apache.camel.spi.AuthorizationPoli [...]
   },
   "headers": {
-    "CamelAiToolCallId": { "index": 0, "kind": "header", "displayName": "", 
"group": "consumer", "label": "consumer", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The tool invocation identifier supplied by the calling 
framework. Absent when the framework does not supply one.", "constantName": 
"org.apache.camel.component.ai.tool.AiToolConstants#TOOL_CALL_ID" },
+    "CamelAiToolCallId": { "index": 0, "kind": "header", "displayName": "", 
"group": "consumer", "label": "consumer", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The tool invocation identifier supplied by the calling 
framework. Set when an in-process producer (such as openai or 
langchain4j-agent) calls the tool. Absent when the framework does not supply 
one, such as for a call over MCP, where the bridge has no tool ca [...]
     "CamelAiToolConversationId": { "index": 1, "kind": "header", 
"displayName": "", "group": "consumer", "label": "consumer", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The conversation identifier supplied by the calling framework. 
Absent when the framework does not supply one.", "constantName": 
"org.apache.camel.component.ai.tool.AiToolConstants#CONVERSATION_ID" }
   },
   "bodyTypes": {
@@ -55,7 +55,7 @@
   },
   "properties": {
     "toolName": { "index": 0, "kind": "path", "displayName": "Tool Name", 
"group": "consumer", "label": "", "required": true, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "The tool name. This is the name the LLM sees 
and uses to invoke the tool." },
-    "argSchema": { "index": 1, "kind": "parameter", "displayName": "Arg 
Schema", "group": "consumer", "label": "consumer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "supportFileReference": true, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "Raw JSON Schema for tool input parameters. 
Supports inline JSON and resource  [...]
+    "argSchema": { "index": 1, "kind": "parameter", "displayName": "Arg 
Schema", "group": "consumer", "label": "consumer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "supportFileReference": true, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "Raw JSON Schema for tool input parameters. 
Supports inline JSON and resource  [...]
     "argumentsAsBody": { "index": 2, "kind": "parameter", "displayName": 
"Arguments As Body", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": "org.apache.camel.component.ai.tool.AiToolConfiguration", 
"configurationField": "configuration", "description": "Whether to populate the 
message body with the tool arguments as a JSON string,  [...]
     "description": { "index": 3, "kind": "parameter", "displayName": 
"Description", "group": "consumer", "label": "consumer", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "Human-readable description of what this tool 
does. Passed verbatim to the LLM; be precise and action-ori [...]
     "destructiveHint": { "index": 4, "kind": "parameter", "displayName": 
"Destructive Hint", "group": "consumer", "label": "consumer", "required": 
false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ai.tool.AiToolConfiguration", "configurationField": 
"configuration", "description": "MCP hint that the tool may perform destructive 
or irreversible updates. Advisory for MCP clie [...]
diff --git 
a/components/camel-ai/camel-ai-tool/src/main/docs/ai-tool-component.adoc 
b/components/camel-ai/camel-ai-tool/src/main/docs/ai-tool-component.adoc
index 8dcca187f591..ef9326864c8f 100644
--- a/components/camel-ai/camel-ai-tool/src/main/docs/ai-tool-component.adoc
+++ b/components/camel-ai/camel-ai-tool/src/main/docs/ai-tool-component.adoc
@@ -196,7 +196,7 @@ Top-level schema properties are exposed as exchange 
headers. Nested values are p
 
 `argSchema` also supports Camel resource references such as 
`classpath:schemas/create-order.json`.
 
-The root schema must be a JSON Schema object with a top-level `properties` 
map. Camel always allowlists top-level property names when invoking the tool 
route, even if the schema sets `additionalProperties: true`. Nested fields are 
not flattened into headers; only top-level properties become exchange headers 
(Map/List/primitive values).
+The root schema must be a JSON Schema object with a top-level `properties` 
map. When the schema does not set `additionalProperties`, Camel adds 
`additionalProperties: false` to the schema it lists and validates. This is the 
same as for the schema generated from `+parameter.*+`. A client that validates 
the input, such as the MCP server, then refuses a call with an undeclared (for 
example misspelled) argument. Camel no longer drops that argument with a 
warning. A schema that sets `addition [...]
 
 === Structured Tool Output (outputSchema)
 
@@ -340,7 +340,8 @@ These headers are populated independently of 
`argumentsAsBody`. An unavailable i
 * OpenAI supplies the tool-call ID. The Responses API also supplies its 
resolved conversation ID
   (`CamelOpenAIConversationId` or the `conversationId` option); 
chat-completion callbacks omit it.
 * Spring AI Chat supplies the `CamelSpringAiChatConversationId` from the 
calling exchange. Its tool callback does not supply a call ID.
-* MCP server tool callbacks currently do not propagate these identifiers.
+* A call over MCP (`camel-mcp-server`) has neither: the MCP bridge has no tool 
call ID, so `CamelAiToolCallId` is not set.
+  `CamelAiToolCallId` is set only when an in-process producer such as `openai` 
or `langchain4j-agent` calls the tool.
 
 For example, use `${header.CamelAiToolCallId}` to correlate route processing 
with a particular tool invocation.
 Several calls in the same conversation can share `CamelAiToolConversationId` 
while having different call IDs.
diff --git 
a/components/camel-ai/camel-ai-tool/src/main/java/org/apache/camel/component/ai/tool/AiToolConfiguration.java
 
b/components/camel-ai/camel-ai-tool/src/main/java/org/apache/camel/component/ai/tool/AiToolConfiguration.java
index 1144f27d9458..ebd668734883 100644
--- 
a/components/camel-ai/camel-ai-tool/src/main/java/org/apache/camel/component/ai/tool/AiToolConfiguration.java
+++ 
b/components/camel-ai/camel-ai-tool/src/main/java/org/apache/camel/component/ai/tool/AiToolConfiguration.java
@@ -61,7 +61,10 @@ public class AiToolConfiguration implements Cloneable {
 
     @UriParam(description = "Raw JSON Schema for tool input parameters. 
Supports inline JSON and resource "
                             + "references (classpath:, file:, resource:). 
Mutually exclusive with the parameter "
-                            + "multi-value options. Use for nested objects, 
arrays, oneOf, and other complex schemas.")
+                            + "multi-value options. Use for nested objects, 
arrays, oneOf, and other complex schemas. "
+                            + "When the schema does not set 
additionalProperties, Camel adds additionalProperties: false, "
+                            + "so a client that validates the input (such as 
the MCP server) refuses an undeclared "
+                            + "argument.")
     @Metadata(label = "consumer", supportFileReference = true, largeInput = 
true, inputLanguage = "json")
     private String argSchema;
 
diff --git 
a/components/camel-ai/camel-ai-tool/src/main/java/org/apache/camel/component/ai/tool/AiToolConstants.java
 
b/components/camel-ai/camel-ai-tool/src/main/java/org/apache/camel/component/ai/tool/AiToolConstants.java
index 4d1d191ec638..d4ef11058d0d 100644
--- 
a/components/camel-ai/camel-ai-tool/src/main/java/org/apache/camel/component/ai/tool/AiToolConstants.java
+++ 
b/components/camel-ai/camel-ai-tool/src/main/java/org/apache/camel/component/ai/tool/AiToolConstants.java
@@ -44,7 +44,9 @@ public final class AiToolConstants {
     public static final String SECURITY_PRINCIPAL_NAME_PROPERTY = 
"CamelAiToolSecurityPrincipalName";
 
     @Metadata(label = "consumer", description = "The tool invocation 
identifier supplied by the calling framework. "
-                                                + "Absent when the framework 
does not supply one.",
+                                                + "Set when an in-process 
producer (such as openai or langchain4j-agent) "
+                                                + "calls the tool. Absent when 
the framework does not supply one, "
+                                                + "such as for a call over 
MCP, where the bridge has no tool call id.",
               javaType = "String")
     public static final String TOOL_CALL_ID = "CamelAiToolCallId";
 
diff --git 
a/components/camel-ai/camel-ai-tool/src/main/java/org/apache/camel/component/ai/tool/AiToolParameterHelper.java
 
b/components/camel-ai/camel-ai-tool/src/main/java/org/apache/camel/component/ai/tool/AiToolParameterHelper.java
index f80b906305e3..4869fa0575ee 100644
--- 
a/components/camel-ai/camel-ai-tool/src/main/java/org/apache/camel/component/ai/tool/AiToolParameterHelper.java
+++ 
b/components/camel-ai/camel-ai-tool/src/main/java/org/apache/camel/component/ai/tool/AiToolParameterHelper.java
@@ -185,6 +185,11 @@ public final class AiToolParameterHelper {
 
     /**
      * Resolves, validates, and normalizes a raw JSON Schema for tool input.
+     * <p>
+     * When the schema does not set {@code additionalProperties}, {@code 
additionalProperties: false} is added, the same
+     * as the schema generated from {@code parameter.*}: the tool route 
receives only the declared top-level arguments,
+     * and a client that validates the input (such as the MCP server) refuses 
a call with an undeclared argument instead
+     * of having it dropped silently. A schema that sets {@code 
additionalProperties} itself is kept as written.
      */
     public static String resolveArgSchema(CamelContext camelContext, String 
argSchema) {
         if (argSchema == null || argSchema.isBlank()) {
@@ -199,6 +204,9 @@ public final class AiToolParameterHelper {
 
         JsonObject root = parseJsonObject(resolved, argSchema);
         validateRootSchemaObject(root);
+        if (!root.containsKey("additionalProperties")) {
+            root.put("additionalProperties", false);
+        }
         return root.toJson();
     }
 
diff --git 
a/components/camel-ai/camel-ai-tool/src/test/java/org/apache/camel/component/ai/tool/AiToolParameterHelperTest.java
 
b/components/camel-ai/camel-ai-tool/src/test/java/org/apache/camel/component/ai/tool/AiToolParameterHelperTest.java
index aa4c8ddbea79..38c76e4fc80b 100644
--- 
a/components/camel-ai/camel-ai-tool/src/test/java/org/apache/camel/component/ai/tool/AiToolParameterHelperTest.java
+++ 
b/components/camel-ai/camel-ai-tool/src/test/java/org/apache/camel/component/ai/tool/AiToolParameterHelperTest.java
@@ -312,6 +312,61 @@ public class AiToolParameterHelperTest {
                 .containsExactly("customer");
     }
 
+    @Test
+    void testResolveArgSchemaAddsAdditionalPropertiesFalseWhenNotSet() throws 
Exception {
+        String resolved = AiToolParameterHelper.resolveArgSchema(camelContext,
+                
"{\"type\":\"object\",\"properties\":{\"city\":{\"type\":\"string\"}},\"required\":[\"city\"]}");
+
+        JsonObject root = (JsonObject) Jsoner.deserialize(resolved);
+        assertThat(root.get("additionalProperties"))
+                .as("additionalProperties: false is added like for 
parameter.*")
+                .isEqualTo(false);
+        assertThat((JsonObject) 
root.get("properties")).containsOnlyKeys("city");
+        assertThat((JsonArray) root.get("required")).containsExactly("city");
+    }
+
+    @Test
+    void testResolveArgSchemaAddsAdditionalPropertiesFalseWithoutRootType() 
throws Exception {
+        String resolved = AiToolParameterHelper.resolveArgSchema(camelContext,
+                "{\"properties\":{\"city\":{\"type\":\"string\"}}}");
+
+        JsonObject root = (JsonObject) Jsoner.deserialize(resolved);
+        assertThat(root.get("additionalProperties")).isEqualTo(false);
+    }
+
+    @Test
+    void testResolveArgSchemaKeepsAdditionalPropertiesTrue() throws Exception {
+        String resolved = AiToolParameterHelper.resolveArgSchema(camelContext,
+                
"{\"type\":\"object\",\"properties\":{\"city\":{\"type\":\"string\"}},\"additionalProperties\":true}");
+
+        JsonObject root = (JsonObject) Jsoner.deserialize(resolved);
+        assertThat(root.get("additionalProperties"))
+                .as("a schema that sets additionalProperties is kept as 
written")
+                .isEqualTo(true);
+    }
+
+    @Test
+    void testResolveArgSchemaKeepsSchemaValuedAdditionalProperties() throws 
Exception {
+        String resolved = AiToolParameterHelper.resolveArgSchema(camelContext,
+                
"{\"type\":\"object\",\"properties\":{\"city\":{\"type\":\"string\"}},"
+                                                                               
+ "\"additionalProperties\":{\"type\":\"string\"}}");
+
+        JsonObject root = (JsonObject) Jsoner.deserialize(resolved);
+        assertThat((JsonObject) 
root.get("additionalProperties")).containsEntry("type", "string");
+    }
+
+    @Test
+    void testResolveArgSchemaDoesNotChangeNestedObjects() throws Exception {
+        String resolved = AiToolParameterHelper.resolveArgSchema(camelContext,
+                
"{\"type\":\"object\",\"properties\":{\"customer\":{\"type\":\"object\","
+                                                                               
+ "\"properties\":{\"id\":{\"type\":\"string\"}}}}}");
+
+        JsonObject root = (JsonObject) Jsoner.deserialize(resolved);
+        JsonObject customer = (JsonObject) ((JsonObject) 
root.get("properties")).get("customer");
+        assertThat(customer).doesNotContainKey("additionalProperties");
+        assertThat(root.get("additionalProperties")).isEqualTo(false);
+    }
+
     @Test
     void testResolveArgSchemaRejectsJsonNull() {
         assertThatThrownBy(() -> 
AiToolParameterHelper.resolveArgSchema(camelContext, "null"))
diff --git 
a/components/camel-ai/camel-mcp-server-api/src/test/java/org/apache/camel/component/mcp/server/conformance/McpServerConformanceTestSupport.java
 
b/components/camel-ai/camel-mcp-server-api/src/test/java/org/apache/camel/component/mcp/server/conformance/McpServerConformanceTestSupport.java
index cefe60cbda61..62a99f53638f 100644
--- 
a/components/camel-ai/camel-mcp-server-api/src/test/java/org/apache/camel/component/mcp/server/conformance/McpServerConformanceTestSupport.java
+++ 
b/components/camel-ai/camel-mcp-server-api/src/test/java/org/apache/camel/component/mcp/server/conformance/McpServerConformanceTestSupport.java
@@ -94,6 +94,12 @@ public abstract class McpServerConformanceTestSupport 
extends CamelTestSupport {
                         .routeId("say-hello-route")
                         .setBody(simple("Hello ${header.name}"));
 
+                from("ai-tool:schema_tool?tags=" + CONFORMANCE_TAG + 
"&description=Tool with an argSchema"
+                     + 
"&argSchema=RAW({\"type\":\"object\",\"properties\":{\"city\":{\"type\":\"string\"}},"
+                     + "\"required\":[\"city\"]})")
+                        .routeId("schema-tool-route")
+                        .setBody(simple("Weather in ${header.city}"));
+
                 from("ai-tool:fail_tool?tags=" + CONFORMANCE_TAG + 
"&description=Always fails")
                         .routeId("fail-tool-route")
                         .process(e -> {
@@ -164,6 +170,35 @@ public abstract class McpServerConformanceTestSupport 
extends CamelTestSupport {
         assertThat(textOf(result)).contains("name");
     }
 
+    @Test
+    void testCallToolUndeclaredArgumentIsRefused() {
+        McpSchema.CallToolResult result = client().callTool(
+                new McpSchema.CallToolRequest("say_hello", Map.of("name", 
"World", "nmae", "typo")));
+
+        assertThat(result.isError()).isEqualTo(Boolean.TRUE);
+    }
+
+    @Test
+    void testListToolsArgSchemaWithoutAdditionalPropertiesRefusesOthers() {
+        McpSchema.Tool tool = client().listTools().tools().stream()
+                .filter(t -> 
"schema_tool".equals(t.name())).findFirst().orElseThrow();
+
+        assertThat(tool.inputSchema()).containsEntry("additionalProperties", 
false);
+    }
+
+    @Test
+    void testCallToolArgSchemaUndeclaredArgumentIsRefused() {
+        McpSchema.CallToolResult ok
+                = client().callTool(new 
McpSchema.CallToolRequest("schema_tool", Map.of("city", "Paris")));
+        assertThat(ok.isError()).isNotEqualTo(Boolean.TRUE);
+        assertThat(textOf(ok)).isEqualTo("Weather in Paris");
+
+        McpSchema.CallToolResult result = client().callTool(
+                new McpSchema.CallToolRequest("schema_tool", Map.of("city", 
"Paris", "cty", "typo")));
+
+        assertThat(result.isError()).isEqualTo(Boolean.TRUE);
+    }
+
     @Test
     void testCallToolExecutionErrorIsSanitized() {
         McpSchema.CallToolResult result = client().callTool(new 
McpSchema.CallToolRequest("fail_tool", Map.of()));
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index b25a539dad26..79ee07c2e407 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -704,6 +704,15 @@ An `AiToolConfiguration` bean given as the `configuration` 
option no longer repl
   `allowedRoles`. Previously the bean replaced the options of the endpoint and 
the values of the component. The bean
   itself is no longer changed by the options of the endpoints that use it.
 
+=== camel-ai-tool - an argSchema without additionalProperties gets 
additionalProperties: false
+
+When the `argSchema` of an `ai-tool` endpoint does not set 
`additionalProperties`, Camel now adds
+`additionalProperties: false` to the schema that it lists to clients and 
validates. This is the same as for the
+schema generated from `+parameter.*+`. A client that validates the input, such 
as the MCP server, now refuses a call with an
+undeclared argument; previously Camel accepted the call and dropped the 
argument with a WARN. To accept other
+arguments, set `additionalProperties` in the schema yourself; the route still 
receives only the declared top-level
+arguments.
+
 === camel-docling - the CamelDoclingOutputFilePath header is a relative path 
unless outputBaseDirectory is set
 
 When the `outputBaseDirectory` option is not set, the 
`CamelDoclingOutputFilePath` header must now be a relative
diff --git 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AiToolComponentBuilderFactory.java
 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AiToolComponentBuilderFactory.java
index 79712352bbc6..e4dec819e98a 100644
--- 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AiToolComponentBuilderFactory.java
+++ 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AiToolComponentBuilderFactory.java
@@ -56,7 +56,10 @@ public interface AiToolComponentBuilderFactory {
          * Raw JSON Schema for tool input parameters. Supports inline JSON and
          * resource references (classpath:, file:, resource:). Mutually
          * exclusive with the parameter multi-value options. Use for nested
-         * objects, arrays, oneOf, and other complex schemas.
+         * objects, arrays, oneOf, and other complex schemas. When the schema
+         * does not set additionalProperties, Camel adds additionalProperties:
+         * false, so a client that validates the input (such as the MCP server)
+         * refuses an undeclared argument.
          * 
          * This option can also be loaded from an existing file, by prefixing
          * with file: or classpath: followed by the location of the file.
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AiToolEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AiToolEndpointBuilderFactory.java
index bd25013aab9c..38b11d4a1238 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AiToolEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AiToolEndpointBuilderFactory.java
@@ -49,7 +49,10 @@ public interface AiToolEndpointBuilderFactory {
          * Raw JSON Schema for tool input parameters. Supports inline JSON and
          * resource references (classpath:, file:, resource:). Mutually
          * exclusive with the parameter multi-value options. Use for nested
-         * objects, arrays, oneOf, and other complex schemas.
+         * objects, arrays, oneOf, and other complex schemas. When the schema
+         * does not set additionalProperties, Camel adds additionalProperties:
+         * false, so a client that validates the input (such as the MCP server)
+         * refuses an undeclared argument.
          * 
          * This option can also be loaded from an existing file, by prefixing
          * with file: or classpath: followed by the location of the file.
@@ -767,8 +770,10 @@ public interface AiToolEndpointBuilderFactory {
         public static final AiToolHeaderNameBuilder INSTANCE = new 
AiToolHeaderNameBuilder();
 
         /**
-         * The tool invocation identifier supplied by the calling framework.
-         * Absent when the framework does not supply one.
+         * The tool invocation identifier supplied by the calling framework. 
Set
+         * when an in-process producer (such as openai or langchain4j-agent)
+         * calls the tool. Absent when the framework does not supply one, such
+         * as for a call over MCP, where the bridge has no tool call id.
          * 
          * The option is a: {@code String} type.
          * 

Reply via email to