[ 
https://issues.apache.org/jira/browse/CAMEL-24333?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Omar Atie reassigned CAMEL-24333:
---------------------------------

    Assignee: Omar Atie

> camel-ai-tool - structured tool output (outputSchema / structuredContent)
> -------------------------------------------------------------------------
>
>                 Key: CAMEL-24333
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24333
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-ai
>            Reporter: Federico Mariani
>            Assignee: Omar Atie
>            Priority: Major
>
> Follow-up from CAMEL-24308 (camel-mcp-server).
> MCP tools can declare an {{outputSchema}} and return {{structuredContent}} 
> (typed JSON) in the {{CallToolResult}}, so clients can parse tool results 
> reliably instead of re-interpreting free text. This is distinct from the 
> "structured output" feature of the chat components (camel-langchain4j-agent 
> {{outputClass}}, spring-ai converters), which constrains the *LLM's answer* — 
> this issue is about the *tool's result*.
> Today the whole stack is string-only: {{AiToolExecutor}} converts the 
> exchange body to {{String}}, {{AiToolResult.Success}} carries a plain string, 
> and the bridge's {{McpToolCallResult}} is {{(text, isError)}} — a route 
> producing JSON is delivered as an opaque text blob without a schema.
> Proposed scope:
> * Optional output-schema metadata on the ai-tool consumer endpoint (flat 
> {{outputParameter.NAME=type}} syntax and/or raw JSON Schema, consistent with 
> whatever CAMEL-24308's argSchema follow-up decides for inputs).
> * A structured variant in {{AiToolResult}} (e.g. {{Success(String text, 
> Object structured)}}) populated from a JSON exchange body when an output 
> schema is declared.
> * Extend {{McpToolCallResult}} / the {{McpServerTool}} SPI accordingly and 
> map to {{structuredContent}} in every engine — all three APIs already support 
> it: MCP Java SDK {{CallToolResult.structuredContent}} + 
> {{Tool.outputSchema}}, quarkiverse 
> {{ToolDefinition.setOutputSchema()/generateOutputSchema()}} + 
> {{ToolResponse}} structured variant, Spring AI 
> {{@McpTool(generateOutputSchema = ...)}}.
> * The improvement also benefits the langchain4j-agent and spring-ai-chat 
> adapters (typed tool results for the LLM), not only MCP.
> Note: this extends {{AiToolResult}} and the {{McpServerTool}} SPI ({{@since 
> 4.22}}). Deciding the shape before Camel 4.22 ships avoids evolving a 
> released SPI.
> ----
> _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