This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new 3d7bd7fc97b ai-tool: add missing tests
3d7bd7fc97b is described below
commit 3d7bd7fc97b3aa72295b8e6fdbded180896b8414
Author: Jiří Ondrušek <[email protected]>
AuthorDate: Mon Nov 23 08:28:06 2026 +0100
ai-tool: add missing tests
* ai-tool: test security and extension logic
- Camel*-prefixed and undeclared tool arguments never become headers
- AI service without @CamelAiTools receives all tools
- invalid JSON arguments and sanitized tool failure text
- @CamelAiTools("") build error and missing-dependency warnings
- wrong-tag test also checks the service gets its own tools;
rename a misnamed admin service test
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* ai-tool: test remaining endpoint options and lifecycle
Several tags, default description, parameter types and descriptions,
hints, null body, inline and classpath argSchema, invalid configurations,
duplicate tool names, producer rejection, suspend/resume with registry
listener events and tool registration before route consumers start.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* ai-tool: test tools defined in YAML and XML routes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* ai-tool: drop log-warning, DSL and upstream-only tests
Remove CamelAiToolsWithoutQuarkusLangchain4jTest and
CamelAiToolsWithoutLangchain4jAgentTest, the YAML/XML DSL routes with their
dependencies, and AiToolTest cases that only cover upstream camel-ai-tool
behaviour, together with the fixtures used only by them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: jiriOndrusek-agent <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
extensions/ai-tool/deployment/pom.xml | 22 +++++++
.../tool/deployment/CamelAiToolsBlankTagTest.java | 59 +++++++++++++++++
.../ai/tool/deployment/OptionalDependencies.java | 41 ++++++++++++
.../langchain4j/it/AiToolLangchain4jResource.java | 12 ++++
.../langchain4j/it/AiToolLangchain4jRoutes.java | 3 +
.../langchain4j/it/model/ScriptedChatModel.java | 77 ++++++++++++++++++++++
.../it/model/WrongTagToolCallingChatModel.java | 9 ++-
.../langchain4j/it/service/AllToolsAiService.java | 32 +++++++++
.../tool/langchain4j/it/AiToolLangchain4jTest.java | 36 +++++++++-
.../quarkus/component/ai/tool/it/AiToolRoutes.java | 23 +++++++
.../src/main/resources/ai-tool/search-schema.json | 10 +++
.../src/main/resources/application.properties | 17 +++++
.../quarkus/component/ai/tool/it/AiToolTest.java | 77 ++++++++++++++++++++++
13 files changed, 415 insertions(+), 3 deletions(-)
diff --git a/extensions/ai-tool/deployment/pom.xml
b/extensions/ai-tool/deployment/pom.xml
index 6b2abaab60e..aca9bd9d02e 100644
--- a/extensions/ai-tool/deployment/pom.xml
+++ b/extensions/ai-tool/deployment/pom.xml
@@ -38,6 +38,17 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-ai-tool</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit-internal</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>dev.langchain4j</groupId>
+ <artifactId>langchain4j</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -55,6 +66,17 @@
</annotationProcessorPaths>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <!-- versions of the optional dependencies the tests
add with setForcedDependencies -->
+ <camel.version>${camel.version}</camel.version>
+
<quarkiverse-langchain4j.version>${quarkiverse-langchain4j.version}</quarkiverse-langchain4j.version>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
</plugins>
</build>
diff --git
a/extensions/ai-tool/deployment/src/test/java/org/apache/camel/quarkus/component/ai/tool/deployment/CamelAiToolsBlankTagTest.java
b/extensions/ai-tool/deployment/src/test/java/org/apache/camel/quarkus/component/ai/tool/deployment/CamelAiToolsBlankTagTest.java
new file mode 100644
index 00000000000..12c5c866540
--- /dev/null
+++
b/extensions/ai-tool/deployment/src/test/java/org/apache/camel/quarkus/component/ai/tool/deployment/CamelAiToolsBlankTagTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.ai.tool.deployment;
+
+import java.util.List;
+
+import io.quarkus.test.QuarkusExtensionTest;
+import org.apache.camel.quarkus.component.ai.tool.CamelAiTools;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+/**
+ * A {@code @CamelAiTools("")} interface (blank tag) must fail the build with
"<class> has no tag". The assertion is in
+ * {@code assertException} of the static extension; the test method is only
reached if the build wrongly succeeds.
+ */
+class CamelAiToolsBlankTagTest {
+
+ @RegisterExtension
+ static final QuarkusExtensionTest TEST = new QuarkusExtensionTest()
+ .withApplicationRoot(jar -> jar.addClasses(BlankTagService.class,
OptionalDependencies.class))
+ .setForcedDependencies(
+ List.of(OptionalDependencies.QUARKUS_LANGCHAIN4J,
OptionalDependencies.CAMEL_LANGCHAIN4J_AGENT))
+ .assertException(t ->
assertTrue(rootMessages(t).contains(BlankTagService.class.getName() + " has no
tag"),
+ "Unexpected build failure: " + rootMessages(t)));
+
+ @Test
+ void blankTagFailsTheBuild() {
+ fail("The build must fail");
+ }
+
+ private static String rootMessages(Throwable t) {
+ StringBuilder messages = new StringBuilder();
+ for (Throwable cause = t; cause != null; cause = cause.getCause()) {
+ messages.append(cause.getMessage()).append('\n');
+ }
+ return messages.toString();
+ }
+
+ @CamelAiTools("")
+ public interface BlankTagService {
+ }
+}
diff --git
a/extensions/ai-tool/deployment/src/test/java/org/apache/camel/quarkus/component/ai/tool/deployment/OptionalDependencies.java
b/extensions/ai-tool/deployment/src/test/java/org/apache/camel/quarkus/component/ai/tool/deployment/OptionalDependencies.java
new file mode 100644
index 00000000000..947623e0343
--- /dev/null
+++
b/extensions/ai-tool/deployment/src/test/java/org/apache/camel/quarkus/component/ai/tool/deployment/OptionalDependencies.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.ai.tool.deployment;
+
+import dev.langchain4j.model.chat.ChatModel;
+import io.quarkus.maven.dependency.Dependency;
+import jakarta.enterprise.inject.Produces;
+import jakarta.inject.Singleton;
+
+/**
+ * The optional dependencies of the Camel AI tool bridge, added per test, and
a {@link ChatModel} bean that Quarkus
+ * LangChain4j requires once it is present.
+ */
+@Singleton
+public class OptionalDependencies {
+
+ static final Dependency QUARKUS_LANGCHAIN4J =
Dependency.of("io.quarkiverse.langchain4j", "quarkus-langchain4j-core",
+ System.getProperty("quarkiverse-langchain4j.version"));
+ static final Dependency CAMEL_LANGCHAIN4J_AGENT =
Dependency.of("org.apache.camel", "camel-langchain4j-agent",
+ System.getProperty("camel.version"));
+
+ @Produces
+ ChatModel chatModel() {
+ return new ChatModel() {
+ };
+ }
+}
diff --git
a/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/AiToolLangchain4jResource.java
b/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/AiToolLangchain4jResource.java
index 82770665ac2..b7243e6036e 100644
---
a/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/AiToolLangchain4jResource.java
+++
b/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/AiToolLangchain4jResource.java
@@ -32,6 +32,7 @@ import org.apache.camel.CamelContext;
import org.apache.camel.component.ai.tool.AiToolRegistry;
import org.apache.camel.component.ai.tool.AiToolSpec;
import
org.apache.camel.quarkus.component.ai.tool.langchain4j.it.service.AdminAiService;
+import
org.apache.camel.quarkus.component.ai.tool.langchain4j.it.service.AllToolsAiService;
import
org.apache.camel.quarkus.component.ai.tool.langchain4j.it.service.WeatherAiService;
import
org.apache.camel.quarkus.component.ai.tool.langchain4j.it.service.WeatherAiServiceWrongTag;
@@ -51,6 +52,9 @@ public class AiToolLangchain4jResource {
@Inject
WeatherAiServiceWrongTag weatherAiServiceWrongTag;
+ @Inject
+ AllToolsAiService allToolsAiService;
+
@Path("/weather/chat")
@POST
@Consumes(MediaType.TEXT_PLAIN)
@@ -75,6 +79,14 @@ public class AiToolLangchain4jResource {
return weatherAiServiceWrongTag.chat(message);
}
+ @Path("/all-tools/chat")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public String allToolsChat(String message) {
+ return allToolsAiService.chat(message);
+ }
+
@Path("/tools/{tag}")
@GET
@Produces(MediaType.TEXT_PLAIN)
diff --git
a/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/AiToolLangchain4jRoutes.java
b/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/AiToolLangchain4jRoutes.java
index 8f8b45acf66..198fe55251c 100644
---
a/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/AiToolLangchain4jRoutes.java
+++
b/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/AiToolLangchain4jRoutes.java
@@ -36,5 +36,8 @@ public class AiToolLangchain4jRoutes extends RouteBuilder {
+ "¶meter.topic.required=true"
+ "¶meter.topic.description=The news topic")
.setBody(simple("Latest news about ${header.topic}"));
+
+ from("ai-tool:failingTool?tags=failTag&description=A tool that always
fails")
+ .throwException(new IllegalStateException("Internal failure
detail"));
}
}
diff --git
a/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/model/ScriptedChatModel.java
b/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/model/ScriptedChatModel.java
new file mode 100644
index 00000000000..75d5bca0891
--- /dev/null
+++
b/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/model/ScriptedChatModel.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.ai.tool.langchain4j.it.model;
+
+import java.util.List;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+
+import dev.langchain4j.agent.tool.ToolExecutionRequest;
+import dev.langchain4j.agent.tool.ToolSpecification;
+import dev.langchain4j.data.message.AiMessage;
+import dev.langchain4j.data.message.ChatMessage;
+import dev.langchain4j.data.message.ToolExecutionResultMessage;
+import dev.langchain4j.data.message.UserMessage;
+import dev.langchain4j.model.chat.ChatModel;
+import dev.langchain4j.model.chat.request.ChatRequest;
+import dev.langchain4j.model.chat.response.ChatResponse;
+
+/**
+ * Mock model driven by the user message: {@code list} answers with the names
of the offered tools (or
+ * {@code none}), {@code call <tool> <arguments>} calls the tool and answers
with its result.
+ */
+public class ScriptedChatModel implements Supplier<ChatModel> {
+
+ @Override
+ public ChatModel get() {
+ return new ChatModel() {
+ @Override
+ public ChatResponse doChat(ChatRequest chatRequest) {
+ List<ChatMessage> messages = chatRequest.messages();
+ for (ChatMessage message : messages) {
+ if (message instanceof ToolExecutionResultMessage result) {
+ return answer(result.text());
+ }
+ }
+
+ String text = messages.stream()
+ .filter(UserMessage.class::isInstance)
+ .map(m -> ((UserMessage) m).singleText())
+ .reduce((first, last) -> last)
+ .orElse("");
+ if (text.startsWith("call ")) {
+ String[] parts = text.split(" ", 3);
+ ToolExecutionRequest request =
ToolExecutionRequest.builder()
+ .id("call_scripted")
+ .name(parts[1])
+ .arguments(parts[2])
+ .build();
+ return
ChatResponse.builder().aiMessage(AiMessage.from(request)).build();
+ }
+
+ List<ToolSpecification> tools =
chatRequest.toolSpecifications();
+ return answer(tools == null || tools.isEmpty()
+ ? "none"
+ :
tools.stream().map(ToolSpecification::name).sorted().collect(Collectors.joining(",")));
+ }
+ };
+ }
+
+ private static ChatResponse answer(String text) {
+ return ChatResponse.builder().aiMessage(AiMessage.from(text)).build();
+ }
+}
diff --git
a/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/model/WrongTagToolCallingChatModel.java
b/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/model/WrongTagToolCallingChatModel.java
index a4c1803a46e..1a565161bda 100644
---
a/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/model/WrongTagToolCallingChatModel.java
+++
b/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/model/WrongTagToolCallingChatModel.java
@@ -18,8 +18,10 @@ package
org.apache.camel.quarkus.component.ai.tool.langchain4j.it.model;
import java.util.List;
import java.util.function.Supplier;
+import java.util.stream.Collectors;
import dev.langchain4j.agent.tool.ToolExecutionRequest;
+import dev.langchain4j.agent.tool.ToolSpecification;
import dev.langchain4j.data.message.AiMessage;
import dev.langchain4j.data.message.ChatMessage;
import dev.langchain4j.data.message.ToolExecutionResultMessage;
@@ -59,8 +61,13 @@ public class WrongTagToolCallingChatModel implements
Supplier<ChatModel> {
.build();
}
+ String offered = chatRequest.toolSpecifications() == null
+ ? ""
+ : chatRequest.toolSpecifications().stream()
+ .map(ToolSpecification::name)
+ .collect(Collectors.joining(","));
return ChatResponse.builder()
- .aiMessage(new AiMessage("No weather tool
available"))
+ .aiMessage(new AiMessage("No weather tool
available, offered tools: " + offered))
.build();
}
diff --git
a/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/service/AllToolsAiService.java
b/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/service/AllToolsAiService.java
new file mode 100644
index 00000000000..f69c5698d75
--- /dev/null
+++
b/integration-tests/ai-tool-langchain4j/src/main/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/service/AllToolsAiService.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.ai.tool.langchain4j.it.service;
+
+import dev.langchain4j.service.UserMessage;
+import io.quarkiverse.langchain4j.RegisterAiService;
+import jakarta.enterprise.context.ApplicationScoped;
+import
org.apache.camel.quarkus.component.ai.tool.langchain4j.it.model.ScriptedChatModel;
+
+/**
+ * No {@code @CamelAiTools}: receives every registered Camel AI tool.
+ */
+@ApplicationScoped
+@RegisterAiService(chatLanguageModelSupplier = ScriptedChatModel.class)
+public interface AllToolsAiService {
+
+ String chat(@UserMessage String message);
+}
diff --git
a/integration-tests/ai-tool-langchain4j/src/test/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/AiToolLangchain4jTest.java
b/integration-tests/ai-tool-langchain4j/src/test/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/AiToolLangchain4jTest.java
index 2b7cf401a67..6369ee30fdd 100644
---
a/integration-tests/ai-tool-langchain4j/src/test/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/AiToolLangchain4jTest.java
+++
b/integration-tests/ai-tool-langchain4j/src/test/java/org/apache/camel/quarkus/component/ai/tool/langchain4j/it/AiToolLangchain4jTest.java
@@ -18,10 +18,13 @@ package
org.apache.camel.quarkus.component.ai.tool.langchain4j.it;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
+import io.restassured.response.ValidatableResponse;
import org.junit.jupiter.api.Test;
import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.startsWith;
@QuarkusTest
class AiToolLangchain4jTest {
@@ -38,7 +41,7 @@ class AiToolLangchain4jTest {
}
@Test
- void weatherServiceTestWithWrongTag() {
+ void adminServiceCallsNewsToolForAnyQuestion() {
RestAssured.given()
.contentType("text/plain")
.body("What is the weather in Prague?")
@@ -91,7 +94,36 @@ class AiToolLangchain4jTest {
.post("/ai-tool-langchain4j/weather-wrong-tag/chat")
.then()
.statusCode(200)
- .body(not(containsString("1111")));
+ .body(not(containsString("1111")))
+ // the service still receives the tools of its own tag
+ .body(containsString("offered tools: getNews"));
+ }
+
+ @Test
+ void serviceWithoutCamelAiToolsReceivesAllTools() {
+ chat("all-tools", "list")
+ .body(is("failingTool,getNews,getWeather"));
+ }
+
+ @Test
+ void invalidJsonArgumentsAreReportedToModel() {
+ chat("all-tools", "call getWeather {not json")
+ .body(startsWith("Invalid arguments: could not parse the
provided JSON arguments"));
+ }
+
+ @Test
+ void toolFailureIsSanitized() {
+ chat("all-tools", "call failingTool {}")
+ .body(is("Tool execution failed"));
+ }
+
+ private static ValidatableResponse chat(String service, String message) {
+ return RestAssured.given()
+ .contentType("text/plain")
+ .body(message)
+ .post("/ai-tool-langchain4j/" + service + "/chat")
+ .then()
+ .statusCode(200);
}
}
diff --git
a/integration-tests/ai-tool/src/main/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolRoutes.java
b/integration-tests/ai-tool/src/main/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolRoutes.java
index 8ea55e49784..68f38bc6f13 100644
---
a/integration-tests/ai-tool/src/main/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolRoutes.java
+++
b/integration-tests/ai-tool/src/main/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolRoutes.java
@@ -70,5 +70,28 @@ public class AiToolRoutes extends RouteBuilder {
from("ai-tool:failingTool?tags=test"
+ "&description=A tool that always fails")
.throwException(new IllegalStateException("Intentional
failure"));
+
+ // CamelOverride is declared, but argument names starting with "Camel"
must never become headers;
+ // "extra" is not declared, so it must be dropped
+ from("ai-tool:echoHeaders?tags=test"
+ + "&description=Echo the received headers"
+ + "¶meter.name=string"
+ + "¶meter.CamelOverride=string")
+ .setBody(simple("name=${header.name},
camel=${header.CamelOverride}, extra=${header.extra}"));
+
+ // No description, several tags; the route sets no body
+ from("ai-tool:typedTool?tags=weather,math")
+ .log("typedTool called");
+
+ from("ai-tool:searchInline?tags=search"
+ + "&description=Search with an inline schema"
+ +
"&argSchema=RAW({\"type\":\"object\",\"properties\":{\"query\":{\"type\":\"string\"}},"
+ + "\"required\":[\"query\"]})")
+ .setBody(simple("Results for ${header.query}"));
+
+ from("ai-tool:searchFromResource?tags=search"
+ + "&description=Search with a schema from the classpath"
+ + "&argSchema=classpath:ai-tool/search-schema.json")
+ .setBody(simple("Results for ${header.query}"));
}
}
diff --git
a/integration-tests/ai-tool/src/main/resources/ai-tool/search-schema.json
b/integration-tests/ai-tool/src/main/resources/ai-tool/search-schema.json
new file mode 100644
index 00000000000..7572360fc4e
--- /dev/null
+++ b/integration-tests/ai-tool/src/main/resources/ai-tool/search-schema.json
@@ -0,0 +1,10 @@
+{
+ "type": "object",
+ "properties": {
+ "query": {
+ "type": "string",
+ "description": "The search phrase from the resource"
+ }
+ },
+ "required": ["query"]
+}
diff --git
a/integration-tests/ai-tool/src/main/resources/application.properties
b/integration-tests/ai-tool/src/main/resources/application.properties
new file mode 100644
index 00000000000..1f632aef764
--- /dev/null
+++ b/integration-tests/ai-tool/src/main/resources/application.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements. See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+quarkus.native.resources.includes=ai-tool/*.json
diff --git
a/integration-tests/ai-tool/src/test/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolTest.java
b/integration-tests/ai-tool/src/test/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolTest.java
index f1e5e411df1..01fc1533050 100644
---
a/integration-tests/ai-tool/src/test/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolTest.java
+++
b/integration-tests/ai-tool/src/test/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolTest.java
@@ -21,7 +21,9 @@ import io.restassured.RestAssured;
import org.junit.jupiter.api.Test;
import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertTrue;
@QuarkusTest
@@ -149,6 +151,81 @@ class AiToolTest {
.statusCode(500);
}
+ @Test
+ void camelPrefixedArgumentIsNotSetAsHeader() {
+ RestAssured.given()
+ .queryParam("param", "name=Alice")
+ .queryParam("param", "CamelOverride=injected")
+ .post("/ai-tool/execute/echoHeaders")
+ .then()
+ .statusCode(200)
+ .body(is("name=Alice, camel=, extra="));
+ }
+
+ @Test
+ void undeclaredArgumentIsIgnored() {
+ RestAssured.given()
+ .queryParam("param", "name=Alice")
+ .queryParam("param", "extra=injected")
+ .post("/ai-tool/execute/echoHeaders")
+ .then()
+ .statusCode(200)
+ .body(is("name=Alice, camel=, extra="));
+ }
+
+ @Test
+ void toolWithSeveralTagsIsVisibleUnderEachTag() {
+
RestAssured.get("/ai-tool/tools/tag/weather").then().statusCode(200).body(containsString("typedTool"));
+
RestAssured.get("/ai-tool/tools/tag/math").then().statusCode(200).body(containsString("typedTool"));
+
RestAssured.get("/ai-tool/tools/tag/search").then().statusCode(200).body(not(containsString("typedTool")));
+ }
+
+ @Test
+ void descriptionDefaultsToToolName() {
+ RestAssured.get("/ai-tool/tools/typedTool/description")
+ .then()
+ .statusCode(200)
+ .body(is("typedTool"));
+ }
+
+ @Test
+ void nullBodyReturnsNoResult() {
+ RestAssured.given()
+ .post("/ai-tool/execute/typedTool")
+ .then()
+ .statusCode(200)
+ .body(is("No result"));
+ }
+
+ @Test
+ void inlineArgSchema() {
+ RestAssured.get("/ai-tool/tools/searchInline/schema")
+ .then()
+ .statusCode(200)
+ .body("required", hasItem("query"));
+
+ RestAssured.given()
+ .post("/ai-tool/execute/searchInline")
+ .then()
+ .statusCode(400)
+ .body(containsString("query"));
+
+ RestAssured.given()
+ .queryParam("param", "query=camel")
+ .post("/ai-tool/execute/searchInline")
+ .then()
+ .statusCode(200)
+ .body(is("Results for camel"));
+ }
+
+ @Test
+ void argSchemaFromClasspathResource() {
+ RestAssured.get("/ai-tool/tools/searchFromResource/schema")
+ .then()
+ .statusCode(200)
+ .body("properties.query.description", is("The search phrase
from the resource"));
+ }
+
@Test
void executeNonExistentTool() {
RestAssured.given()