Federico Mariani created CAMEL-26399:
----------------------------------------

             Summary: camel-jbang-mcp - accept the argument names that models 
pass for term, example, file and content, or name the expected ones in "Missing 
required argument"
                 Key: CAMEL-26399
                 URL: https://issues.apache.org/jira/browse/CAMEL-26399
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang-mcp
    Affects Versions: 4.23.0
            Reporter: Federico Mariani
            Assignee: Federico Mariani


Found on main (4.24.0-SNAPSHOT, commit ffef175654d1); the line numbers below 
are from that commit. The same code is in the 4.23.0 release.

h3. Reproduction

The catalog tools name their main argument differently: {{camel_catalog_doc}} 
and {{camel_catalog_sample}} take {{name}}, {{camel_catalog_find}} takes 
{{term}}, {{camel_catalog_example_file}} takes {{example}}, and 
{{camel_validate_source}} takes {{file}} (the file name) and {{content}}. 
Models carry one tool's argument names over to the next tool:

{code}
camel_catalog_find {"query":"activemq classic 6 jms"}                       -> 
Missing required argument: term
camel_catalog_find {"name":"groovy"}                                        -> 
Missing required argument: term
camel_catalog_example_file 
{"name":"contracts/rest-code-first","file":"rest-code-first.camel.yaml"}
                                                                            -> 
Missing required argument: example
camel_validate_source {"name":"hr-api-call.yaml","content":"- route: ..."}  -> 
Missing required argument: file
camel_validate_source {"filename":"routes.yaml","source":"- route: ..."}    -> 
Missing required argument: file
camel_validate_source 
{"path":"/workspace/camel/salesleads.yaml","filename":"salesleads.yaml"}
                                                                            -> 
Missing required argument: file
{code}

The answer does not say which arguments the tool takes. Quarkus MCP rejects the 
call before the tool runs, and the argument it did not know is dropped without 
a word.

Eval evidence (200 trials on 4.24.0-SNAPSHOT): 15 failed calls (Claude Haiku 
5.5: 7, Claude Haiku 4.5: 7, Claude Sonnet 5.5: 1). This is the only failure 
Sonnet 5.5 had on the 4.24 server.
||Tool||Passed||Expected||Calls||
|{{camel_validate_source}}|{{name}}/{{filename}}/{{path}}/{{source}} + 
{{content}}/{{source}}|{{file}} + {{content}}|9|
|{{camel_catalog_find}}|{{query}} (3), {{name}} (1)|{{term}}|4|
|{{camel_catalog_example_file}}|{{name}}|{{example}}|2|

What the agents did next: in 6 of the 8 {{camel_validate_source}} episodes (9 
calls) the agent gave up on the tool. It ran {{camel validate yaml}} in the 
shell, or ran or built the app without validating it. 2 of the 4 
{{camel_catalog_find}} calls were not retried. Sonnet loaded the schema with 
ToolSearch and called the tool again. The problem existed before: on 4.22.1 
(197 trials) there were 22 "Missing required argument" failures, mostly 
{{name}} for {{component}}/{{eip}}/{{language}} and {{yaml}} for {{route}}. The 
consolidation into {{camel_catalog_doc}} removed most of them. These are the 
ones left.

h3. Cause

The arguments are {{required = true}} with names of their own per tool: 
{{camel-jbang-mcp/.../mcp/AuthoringTools.java:115}} ({{term}}), {{:153-155}} 
({{file}}, {{content}}); {{mcp/ExampleTools.java:64}} ({{example}}). The 
Quarkus MCP server answers a missing required argument with the bare "Missing 
required argument: <name>" and ignores unknown arguments. So the model learns 
which name is missing, not that its own argument was taken for something else.

h3. Fix

Either or both:
* Aliases in the wrappers: make the argument optional in the schema and take 
the first of {{term}} | {{query}} | {{name}} for {{camel_catalog_find}}, 
{{example}} | {{name}} for {{camel_catalog_example_file}}, {{file}} | {{name}} 
| {{filename}} | {{path}} and {{content}} | {{source}} for 
{{camel_validate_source}}. An alias that looks like a path ({{path}}, an 
absolute {{file}}) goes through the path handling of the file tools. Answer 
with the canonical names, so the next call uses them.
* A useful error for every tool: when a required argument is missing, answer 
"camel_catalog_find takes term (required), kind, limit, camelVersion; got 
query", from the tool's own argument list. A single place in the server (a tool 
filter or a wrapper around {{call}}) covers all tools, including those not 
listed here.

CAMEL-25639 makes the argument names the same across tools. This issue is about 
accepting the names models already use, and can be done before it or as part of 
it.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to