[
https://issues.apache.org/jira/browse/CAMEL-27647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27647:
--------------------------------
Fix Version/s: 4.25.0
(was: 4.24.0)
> camel-ai-tool: unknown parameter TYPE taken as string, parameter.* replace
> component maps
> -----------------------------------------------------------------------------------------
>
> Key: CAMEL-27647
> URL: https://issues.apache.org/jira/browse/CAMEL-27647
> Project: Camel
> Issue Type: Bug
> Components: camel-ai
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-ai-tool for
> CAMEL-23832 (commit
> https://github.com/apache/camel/commit/03d5b4b54cca6a3cf14938b7e089b303bac965d1).
> These are separate problems of the component; the descriptions commit only
> documents the current behavior.
> h4. 1. An unknown TYPE in {{parameter.NAME=TYPE}} silently becomes {{string}}
> {{AiToolParameterHelper.parseParameterMetadata()}} stores the TYPE as given,
> and {{AiToolParameterHelper.mapType()}} (and
> {{AiToolSpecToLangChain4j.buildSchema()}}) map every value other than
> integer, int, long, number, double, float, boolean and bool to {{string}},
> without a log line.
> A typo such as {{parameter.count=intger}}, or a JSON Schema type such as
> {{array}} or {{object}}, starts the route with a string parameter, and the
> model then sends a string. An unknown property such as
> {{parameter.count.foo=x}} does log a WARN, so the two cases behave
> differently.
> Proposed change: log a WARN for an unknown TYPE (or fail the route at start),
> naming the supported types.
> h4. 2. Endpoint {{parameter.*}} and {{outputParameter.*}} options replace the
> component maps
> {{AiToolComponent.createEndpoint()}} calls {{config.setParameters(...)}} and
> {{config.setOutputParameters(...)}} when the URI has any such option, which
> replaces the whole map that came from the component. This is the same problem
> as CAMEL-27599 for {{argument.*}} of camel-ai-prompt, and should be decided
> together with it.
> h4. 3. The {{consumerOut}} body type says "No body" also when
> {{argumentsAsBody=true}}
> The {{@BodyTypes}} of {{AiToolEndpoint}} declares {{consumerOut}} as
> {{Carrier.NULL}} with "No body: each argument of the tool call is a header
> ...". With {{argumentsAsBody=true}}, {{AiToolExecutor.doExecute()}} sets the
> body to the arguments as a JSON String.
> The catalog, and the tools that read its body types, tell the route author
> that the route gets no body.
> Proposed change: add {{dependsOn = "argumentsAsBody"}} to {{consumerOut}} and
> mention the JSON String body in its description.
> h4. 4. {{outputParameter.NAME.required}} and {{outputParameter.NAME.enum}}
> work but are not documented
> {{outputParameter.*}} is parsed by the same
> {{AiToolParameterHelper.parseParameterMetadata()}} as {{parameter.*}}, so
> {{required}} and {{enum}} end up in the output JSON Schema that MCP clients
> see in {{tools/list}}. The option metadata documents only
> {{outputParameter.NAME=TYPE}} and {{outputParameter.NAME.description=TEXT}}.
> Proposed change: document them in the option, or ignore them with a WARN if
> they are not meant for output.
> h4. 5. {{returnDirect}} has {{defaultValue = "false"}}, but unset and
> {{false}} differ
> {{AiToolConfiguration.returnDirect}} is a {{Boolean}} with metadata default
> {{false}}. {{AiToolAnnotations.fromConfiguration()}} keeps {{null}} when it
> is not set, and {{VertxMcpServerEngine.applyAnnotations()}} publishes the
> {{returnDirect}} annotation only when it is not {{null}}. So
> {{returnDirect=false}} adds an annotation to {{tools/list}} that the
> documented default does not.
> Proposed change: drop the {{defaultValue}} from the metadata (as for the four
> MCP hints, which are also {{Boolean}}), or make the field a {{boolean}} and
> publish the annotation only when it is {{true}}.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)