Federico Mariani created CAMEL-23397:
----------------------------------------

             Summary: camel-openai: Support tool annotations/hints for 
returnDirect and safety classification
                 Key: CAMEL-23397
                 URL: https://issues.apache.org/jira/browse/CAMEL-23397
             Project: Camel
          Issue Type: Improvement
          Components: camel-openai
            Reporter: Federico Mariani


Extends [CAMEL-23382|https://issues.apache.org/jira/browse/CAMEL-23382]

The MCP integration in _camel-openai_ already supports rich tool metadata via 
MCP tool annotations:
- _returnDirect_: short-circuit the agentic loop and return the tool result 
directly to the caller
- `readOnlyHint`, `destructiveHint`, `openWorldHint`: safety classification 
hints

However, these annotations are only available for MCP-sourced tools. When 
[CAMEL-23382|https://issues.apache.org/jira/browse/CAMEL-23382] introduces 
route-based tools via `AiToolSpec`, those tools will lack this metadata, making 
them less capable than MCP tools used through the same agentic loop.

*Proposed changes:*

The `AiToolSpec` defined in CAMEL-23382 should include an extensible 
annotations mechanism:

- `returnDirect` (boolean, default false) — when true, the agentic loop returns 
the tool result directly without sending it back to the model. This is critical 
for tools that produce final output (e.g., "generate report", "fetch file").

The agentic loop should treat annotations uniformly regardless of whether the 
tool came from MCP or from the Camel route-based registry. This means the 
`AiToolRegistry` lookup should return annotations alongside the tool spec.

*Example usage:*

```yaml
- from:
    uri: "ai-tools:generateReport"
    parameters:
      description: "Generate a PDF report from the given data"
      returnDirect: true
    steps:
      - to: "pdf:create"
```



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

Reply via email to