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 4a4d7b88656 ai-tool: fix usage documentation
4a4d7b88656 is described below
commit 4a4d7b88656affafda2d56b16e543045e50a4a02
Author: Jiří Ondrušek <[email protected]>
AuthorDate: Mon Nov 23 08:28:32 2026 +0100
ai-tool: fix usage documentation
* Fixes #9534. ai-tool: fix usage documentation
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
* ai-tool: regenerate the extension reference page
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
---------
Co-authored-by: jiriOndrusek-agent <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
---
.../ROOT/pages/reference/extensions/ai-tool.adoc | 36 +++++++++++++++++++---
extensions/ai-tool/runtime/src/main/doc/usage.adoc | 34 +++++++++++++++++---
2 files changed, 62 insertions(+), 8 deletions(-)
diff --git a/docs/modules/ROOT/pages/reference/extensions/ai-tool.adoc
b/docs/modules/ROOT/pages/reference/extensions/ai-tool.adoc
index cc956700c59..4c6394b5897 100644
--- a/docs/modules/ROOT/pages/reference/extensions/ai-tool.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/ai-tool.adoc
@@ -46,7 +46,12 @@ endif::[]
[id="extensions-ai-tool-usage"]
== Usage
-The `ai-tool` component is a framework-agnostic consumer endpoint that
registers Camel routes as LLM-callable tools in a shared `AiToolRegistry`.
Framework-specific extensions (such as `camel-quarkus-langchain4j-agent`,
`camel-quarkus-openai`) discover and invoke these tools at runtime.
+The `ai-tool` component is a framework-agnostic consumer endpoint that
registers Camel routes as LLM-callable tools in a shared `AiToolRegistry`.
Framework-specific extensions (such as `camel-quarkus-langchain4j-agent`,
`camel-quarkus-openai`, `camel-quarkus-mcp-server`) discover and invoke these
tools at runtime.
+
+[id="extensions-ai-tool-usage-dependency"]
+=== Dependency
+
+Routes using `ai-tool:` need `camel-quarkus-ai-tool` as a dependency. The
bridge to Quarkus LangChain4j AI services is part of it, but it also needs
`camel-quarkus-langchain4j-agent` (`camel-langchain4j-agent`) and Quarkus
LangChain4j on the classpath.
[id="extensions-ai-tool-usage-defining-a-tool"]
=== Defining a tool
@@ -72,6 +77,24 @@ public class MyRoutes extends RouteBuilder {
Arguments passed by the LLM are set as exchange headers (e.g.
`${header.city}`).
+[id="extensions-ai-tool-usage-schema-mcp-hints-and-return-direct"]
+=== Schema, MCP hints and return direct
+
+Instead of `parameter.*` options, `argSchema` takes a raw JSON Schema, inline
or as a resource such as `classpath:schemas/order.json`. The two are mutually
exclusive. The schema needs an object root with at least one property in
`properties`. Only the top-level properties are set as headers.
+
+Further options (see the Camel `ai-tool` documentation for details):
+
+* `title` - display title for MCP tool listings.
+* `readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint` - MCP
hints. They are advisory, Camel does not enforce them, and an unset hint is not
published.
+* `returnDirect` - AI producers that support it (such as `openai`) return the
tool result to the caller without sending it back to the model. Also published
as an MCP hint.
+
+[source,java]
+----
+from("ai-tool:createOrder?tags=orders&title=Create order&returnDirect=true"
+ + "&argSchema=classpath:schemas/create-order.json")
+ .to("direct:createOrder");
+----
+
[id="extensions-ai-tool-usage-tag-based-grouping"]
=== Tag-based grouping
@@ -86,7 +109,7 @@ from("ai-tool:lookupOrder?tags=support&description=Look up
order status"
+ "¶meter.orderId=string¶meter.orderId.required=true")
.to("sql:SELECT status FROM orders WHERE id = :#${header.orderId}");
-// Untagged tool — available to all producers
+// Untagged tool — added to every tag query; never exposed by the MCP server
from("ai-tool:greet?description=Greet a user"
+ "¶meter.name=string¶meter.name.required=true")
.setBody(simple("Hello, ${header.name}!"));
@@ -98,10 +121,15 @@ from("ai-tool:greet?description=Greet a user"
Camel agents (`langchain4j-agent` endpoints) receive registry tools only
through their
endpoint's `tags` parameter — an agent without `tags` receives no registry
tools (tools from
the agent's other sources, such as MCP clients or custom tool objects, are
unaffected).
-Quarkus LangChain4j AI services (`@RegisterAiService` interfaces and
programmatically built
-`AiServices`) receive every registered tool by default; restrict a service to
a subset with
+Quarkus LangChain4j AI services (`@RegisterAiService` interfaces) receive
every registered tool by default; restrict a service to a subset with
the `org.apache.camel.quarkus.component.ai.tool.CamelAiTools` annotation.
+`@CamelAiTools` rules:
+
+* It takes a single tag. A comma-separated list is not split.
+* A blank tag fails the build (when Quarkus LangChain4j and
`camel-langchain4j-agent` are present).
+* It has no effect on Camel agents (`langchain4j-agent` endpoints), which
receive no tools from this bridge.
+
[source,java]
----
@RegisterAiService
diff --git a/extensions/ai-tool/runtime/src/main/doc/usage.adoc
b/extensions/ai-tool/runtime/src/main/doc/usage.adoc
index 2aa04eaca40..da837c2346d 100644
--- a/extensions/ai-tool/runtime/src/main/doc/usage.adoc
+++ b/extensions/ai-tool/runtime/src/main/doc/usage.adoc
@@ -1,4 +1,8 @@
-The `ai-tool` component is a framework-agnostic consumer endpoint that
registers Camel routes as LLM-callable tools in a shared `AiToolRegistry`.
Framework-specific extensions (such as `camel-quarkus-langchain4j-agent`,
`camel-quarkus-openai`) discover and invoke these tools at runtime.
+The `ai-tool` component is a framework-agnostic consumer endpoint that
registers Camel routes as LLM-callable tools in a shared `AiToolRegistry`.
Framework-specific extensions (such as `camel-quarkus-langchain4j-agent`,
`camel-quarkus-openai`, `camel-quarkus-mcp-server`) discover and invoke these
tools at runtime.
+
+=== Dependency
+
+Routes using `ai-tool:` need `camel-quarkus-ai-tool` as a dependency. The
bridge to Quarkus LangChain4j AI services is part of it, but it also needs
`camel-quarkus-langchain4j-agent` (`camel-langchain4j-agent`) and Quarkus
LangChain4j on the classpath.
=== Defining a tool
@@ -23,6 +27,23 @@ public class MyRoutes extends RouteBuilder {
Arguments passed by the LLM are set as exchange headers (e.g.
`${header.city}`).
+=== Schema, MCP hints and return direct
+
+Instead of `parameter.*` options, `argSchema` takes a raw JSON Schema, inline
or as a resource such as `classpath:schemas/order.json`. The two are mutually
exclusive. The schema needs an object root with at least one property in
`properties`. Only the top-level properties are set as headers.
+
+Further options (see the Camel `ai-tool` documentation for details):
+
+* `title` - display title for MCP tool listings.
+* `readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint` - MCP
hints. They are advisory, Camel does not enforce them, and an unset hint is not
published.
+* `returnDirect` - AI producers that support it (such as `openai`) return the
tool result to the caller without sending it back to the model. Also published
as an MCP hint.
+
+[source,java]
+----
+from("ai-tool:createOrder?tags=orders&title=Create order&returnDirect=true"
+ + "&argSchema=classpath:schemas/create-order.json")
+ .to("direct:createOrder");
+----
+
=== Tag-based grouping
Tools can be grouped by tags. AI producer endpoints use tags to discover a
subset of available tools.
@@ -36,7 +57,7 @@ from("ai-tool:lookupOrder?tags=support&description=Look up
order status"
+ "¶meter.orderId=string¶meter.orderId.required=true")
.to("sql:SELECT status FROM orders WHERE id = :#${header.orderId}");
-// Untagged tool — available to all producers
+// Untagged tool — added to every tag query; never exposed by the MCP server
from("ai-tool:greet?description=Greet a user"
+ "¶meter.name=string¶meter.name.required=true")
.setBody(simple("Hello, ${header.name}!"));
@@ -47,10 +68,15 @@ from("ai-tool:greet?description=Greet a user"
Camel agents (`langchain4j-agent` endpoints) receive registry tools only
through their
endpoint's `tags` parameter — an agent without `tags` receives no registry
tools (tools from
the agent's other sources, such as MCP clients or custom tool objects, are
unaffected).
-Quarkus LangChain4j AI services (`@RegisterAiService` interfaces and
programmatically built
-`AiServices`) receive every registered tool by default; restrict a service to
a subset with
+Quarkus LangChain4j AI services (`@RegisterAiService` interfaces) receive
every registered tool by default; restrict a service to a subset with
the `org.apache.camel.quarkus.component.ai.tool.CamelAiTools` annotation.
+`@CamelAiTools` rules:
+
+* It takes a single tag. A comma-separated list is not split.
+* A blank tag fails the build (when Quarkus LangChain4j and
`camel-langchain4j-agent` are present).
+* It has no effect on Camel agents (`langchain4j-agent` endpoints), which
receive no tools from this bridge.
+
[source,java]
----
@RegisterAiService