Claus Ibsen created CAMEL-27599:
-----------------------------------
Summary: camel-ai-prompt: endpoint argument.* options replace the
component arguments
Key: CAMEL-27599
URL: https://issues.apache.org/jira/browse/CAMEL-27599
Project: Camel
Issue Type: Bug
Components: camel-ai
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-ai-prompt for
CAMEL-23832 (PR https://github.com/apache/camel/pull/30933).
These are separate problems of the component; the descriptions PR only
documents the current behavior.
h4. 1. Endpoint {{argument.*}} options replace the component {{arguments}}
instead of adding to them
{{AiPromptComponent.createEndpoint()}} copies the component configuration. When
the endpoint URI has any {{argument.*}} option, it calls
{{config.setArguments(orderedArguments)}}, which replaces the whole map that
came from the component.
So arguments set on the component (for example
{{camel.component.ai-prompt.arguments[locale.description]=...}}) are declared
only on prompts whose URI has no {{argument.*}} option. A prompt that adds one
argument of its own silently loses all the component arguments, and MCP clients
do not see them in {{prompts/list}}.
{code:java}
// component: arguments = {locale.description=The locale}
from("ai-prompt:a").setBody(constant("..."));
// declares locale
from("ai-prompt:b?argument.accountId.required=true").setBody(constant("..."));
// declares only accountId
{code}
Proposed change: merge the endpoint arguments into a copy of the component
arguments (endpoint keys win, component order first), or document that the
component option is only a default for endpoints without {{argument.*}}
options. {{AiToolComponent.createEndpoint()}} handles {{parameter.*}} the same
way, so the two should be decided together.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)