Skip to content

CAMEL-24332: MCP tool annotation hints on ai-tool endpoints - #25395

Merged
davsclaus merged 3 commits into
apache:mainfrom
atiaomar1978-hub:feature/CAMEL-24332-ai-tool-mcp-annotations
Aug 6, 2026
Merged

CAMEL-24332: MCP tool annotation hints on ai-tool endpoints#25395
davsclaus merged 3 commits into
apache:mainfrom
atiaomar1978-hub:feature/CAMEL-24332-ai-tool-mcp-annotations

Conversation

@atiaomar1978-hub

Copy link
Copy Markdown
Contributor

AI-generated PR on behalf of atiaomar1978-hub via Cursor Cloud Agent.

Supersedes #25394 — same changeset on the correctly named branch feature/CAMEL-24332-ai-tool-mcp-annotations (Apache convention).

Summary

Implements CAMEL-24332: optional MCP ToolAnnotations metadata on ai-tool consumer endpoints.

Routes can now declare advisory hints for MCP clients:

ai-tool:delete_order?tags=orders&title=Delete order&destructiveHint=true&idempotentHint=false

Supported options: title, readOnlyHint, destructiveHint, idempotentHint, openWorldHint.

Changes

  • AiToolAnnotations record + new @UriParam options on AiToolConfiguration
  • AiToolSpec carries annotations from consumer registration
  • McpServerTool SPI extended with annotations() (default null)
  • McpServerBridge passes spec annotations into published tools
  • VertxMcpServerEngine maps hints to MCP Java SDK Tool.title() / ToolAnnotations
  • Documentation in ai-tool-component.adoc and cross-link from mcp-server.adoc; regenerated catalog docs

Hints are advisory only (per MCP spec) — documented as untrusted UX metadata, not authorization.

Review follow-ups addressed

  • Branch renamed to feature/CAMEL-24332-ai-tool-mcp-annotations
  • AiToolAnnotations converted to a Java record
  • Title-only and partial-hint tests (unit + Vert.x integration)
  • Documented Tool.title mapping and catalog defaultValue: false vs runtime omit semantics

Tests

  • AiToolAnnotationsTest
  • AiToolEndpointLifecycleTest
  • McpServerBridgeTest
  • VertxMcpServerToolAnnotationsTest

All tests pass locally.

Expose optional MCP ToolAnnotations metadata on ai-tool consumer endpoints
(title, readOnlyHint, destructiveHint, idempotentHint, openWorldHint).
Carry hints through AiToolSpec, McpServerTool SPI, and Vert.x MCP engine.

Includes AssertJ tests for configuration parsing, registry lifecycle, bridge
passthrough, and Vert.x listTools annotation mapping. Regenerated catalog
and DSL metadata.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Clarify that annotation hints are untrusted UX metadata per the MCP spec,
document client default behavior when hints are omitted, and link from
mcp-server.adoc to the ai-tool configuration section.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Convert AiToolAnnotations to a record (review suggestion)
- Add title-only and partial-hint unit/integration tests
- Document Tool.title mapping and catalog defaultValue caveat
- Regenerate catalog docs

Co-authored-by: Cursor <cursoragent@cursor.com>
@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

AI-generated comment on behalf of atiaomar1978-hub via Cursor Cloud Agent.

Reopened on branch feature/CAMEL-24332-ai-tool-mcp-annotations per @davsclaus review (replacing closed #25394 which used the cursor/* Cloud Agent branch name). Review feedback is addressed in commit 592456ce.

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: CAMEL-24332 — MCP tool annotation hints on ai-tool endpoints

Well-structured feature PR. The implementation cleanly spans the appropriate layers (configuration → spec → bridge SPI → Vert.x engine) with good test coverage and documentation.

Highlights

  • Clean separation of concerns: AiToolAnnotations record, AiToolConfiguration fields, AiToolSpec extension, McpServerBridge passthrough, VertxMcpServerEngine mapping
  • Proper backward compatibility via default method on McpServerTool
  • Nullable handling throughout the chain (null = no annotation = omit from published tool)
  • Good test coverage: unit tests (AiToolAnnotationsTest), lifecycle tests, bridge tests, and Vert.x integration tests with a real MCP client
  • Documentation with Java and YAML examples in both ai-tool-component.adoc and mcp-server.adoc

Note

The catalog JSON shows "defaultValue": false for the boolean hint fields, but at runtime these are Boolean (boxed, initially null) — meaning "hint omitted from published MCP tool." The MCP spec distinguishes between "hint absent" and "hint = false." The documentation correctly explains this tension. This is a known characteristic of Camel's code generator for Boolean fields, not a PR-specific issue.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

@davsclaus davsclaus added the enhancement New feature or request label Aug 6, 2026
@davsclaus davsclaus added this to the 4.22.0 milestone Aug 6, 2026
@davsclaus
davsclaus merged commit cdb2028 into apache:main Aug 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants