Skip to content

CAMEL-24369: camel-mcp-server-starter: publish MCP tool annotations, fix json-schema-validator resolution - #1881

Merged
davsclaus merged 1 commit into
apache:mainfrom
Croway:CAMEL-24369-mcp-server-starter-fixes
Aug 7, 2026
Merged

CAMEL-24369: camel-mcp-server-starter: publish MCP tool annotations, fix json-schema-validator resolution#1881
davsclaus merged 1 commit into
apache:mainfrom
Croway:CAMEL-24369-mcp-server-starter-fixes

Conversation

@Croway

@Croway Croway commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

JIRA: CAMEL-24369 — companion PRs: apache/camel#25404 and one in apache/camel-quarkus.

Two fixes found by running the same ai-tool + mcp-server application on Camel Main, Spring Boot and Quarkus:

  1. MCP tool annotation hints were dropped. SpringAiMcpServerEngine.toolAdded() published only name/description/inputSchema; title, readOnlyHint, destructiveHint, idempotentHint, openWorldHint — which the Vert.x engine publishes and the ai-tool/mcp-server docs promise are passed to the engine — were silently lost. The engine now maps them exactly like the Vert.x engine (unset hints are not published). This required promoting the starter's camel-ai-tool dependency from test to compile scope: the direct test-scope declaration overrode the transitive compile scope from camel-mcp-server-api.

  2. Startup failure with the documented BOM setup (camel-spring-boot-bom + spring-boot-dependencies): the Spring AI MCP server validates tool arguments through mcp-json-jackson3, which requires the Jackson3-based com.networknt:json-schema-validator:3.0.x; nearest-wins resolution picked a 2.0.x (Jackson2 API) instead, failing with NoSuchMethodError: Schema.validate(tools.jackson.databind.JsonNode). The starter now declares 3.0.0 directly so applications resolve it out of the box.

Two new conformance tests cover the annotations (published hints + no annotations for hint-less tools); the full starter suite passes (13 tests).


Claude Code on behalf of Croway (Federico Mariani)

🤖 Generated with Claude Code

…nd fix json-schema-validator resolution

SpringAiMcpServerEngine now maps the ai-tool annotation hints (title,
readOnlyHint, destructiveHint, idempotentHint, openWorldHint) to the MCP
tool, mirroring the Vert.x engine; unset hints are not published. This
required promoting the starter's camel-ai-tool dependency from test to
compile scope (the direct test-scope declaration overrode the transitive
compile scope from camel-mcp-server-api).

Also declare the Jackson3-based com.networknt:json-schema-validator 3.0.0
required by the MCP SDK's mcp-json-jackson3 tool-argument validation:
without it, nearest-wins resolution can pick the Jackson2-based 2.0.x line
and the application fails at startup with
NoSuchMethodError: Schema.validate(tools.jackson.databind.JsonNode).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

@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.

Clean, well-scoped PR that fixes two real bugs in the MCP server starter.

Highlights:

  • applyAnnotations is a line-for-line match of the Vert.x engine in camel core — verified against VertxMcpServerEngine.java. The conformance gap between runtimes is eliminated: unset hints are omitted (not defaulted), title maps to the tool's top-level title
  • Scope fix for camel-ai-tool is correct: camel-mcp-server-api already declares it at compile scope, so the starter's explicit <scope>test</scope> was winning by nearest-declaration and hiding AiToolAnnotations from the compile classpath
  • json-schema-validator 3.0.0 pin is pragmatic — the MCP SDK's mcp-json-jackson3 needs the Jackson3-based 3.x line, while Camel manages 2.0.x for other components. The comment explains the problem clearly
  • Tests are well-targeted: one verifying hints are published for an annotated tool, one verifying that a hint-less tool has null annotations — conformance assertions against the MCP client view

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

@davsclaus
davsclaus merged commit de43e58 into apache:main Aug 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants