Federico Mariani created CAMEL-24334:
----------------------------------------

             Summary: camel-ai-tool - raw JSON Schema tool input (argSchema) 
for nested parameters
                 Key: CAMEL-24334
                 URL: https://issues.apache.org/jira/browse/CAMEL-24334
             Project: Camel
          Issue Type: Improvement
          Components: camel-ai
            Reporter: Federico Mariani


Follow-up from CAMEL-24308 (camel-mcp-server).

The ai-tool consumer endpoint currently supports only the flat 
{{parameter.NAME=type}} syntax (with {{.description}}/{{.required}}/{{.enum}} 
refinements). Nested or complex input schemas — arrays, nested objects, oneOf — 
are a common need for MCP tools and cannot be expressed today.

Proposed scope:

* New optional {{argSchema}} endpoint option accepting a raw JSON Schema object 
(inline string and/or {{resource:}} reference), mutually exclusive with the 
flat {{parameter.*}} syntax.
* {{AiToolParameterHelper}} keeps generating the schema for the flat syntax; 
with {{argSchema}} the provided schema is used as-is for 
{{AiToolSpec.getParametersJsonSchema()}}.
* *Security-critical*: {{AiToolExecutor}}'s argument allowlist currently 
derives accepted argument names from {{parameterDefs}}. With a raw schema, the 
allowlist MUST be derived from the schema's top-level {{properties}} — 
otherwise every argument is dropped (or worse, the filter is bypassed). This is 
the same bug class as CAMEL-24241; the required-parameter validation needs the 
same treatment.
* Engines consuming the structured {{parameters()}} map (quarkus ToolManager 
{{addArgument}}) need the schema-based path: quarkiverse 
{{ToolDefinition.setInputSchema(Object)}} covers it; the MCP Java SDK and 
Spring AI engines already consume the JSON Schema string directly.
* The langchain4j-agent adapter builds native schema objects from 
{{ParameterDef}} — it needs a raw-schema mapping too ({{JsonObjectSchema}} from 
JSON).

----
_This issue was drafted by Claude Code on behalf of Federico Mariani._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to