Andrea Cosentino created CAMEL-23287:
----------------------------------------
Summary: Camel-Jbang-mcp: Unify MCP tool return types to use typed
records instead of raw JSON strings
Key: CAMEL-23287
URL: https://issues.apache.org/jira/browse/CAMEL-23287
Project: Camel
Issue Type: Improvement
Reporter: Andrea Cosentino
Assignee: Andrea Cosentino
Fix For: 4.19.0
Several MCP tools in {{camel-jbang-mcp}} return raw JSON strings built manually
via {{JsonObject}}/{{JsonArray}}, while others return typed Java records that
get
auto-serialized by the Quarkus MCP framework. This inconsistency makes the
codebase harder to maintain and the tool contracts less clear.
Tools returning typed records (consistent):
- {{CatalogTools}} → {{ComponentListResult}}, {{ComponentDetailResult}}, etc.
- {{MigrationTools}} → {{ProjectAnalysisResult}}, {{CompatibilityResult}},
etc.
- {{VersionTools}} → {{VersionListResult}}
- {{OpenApiTools}} → {{ValidateResult}}, {{ScaffoldResult}}
Tools returning raw JSON strings (inconsistent):
- {{DiagnoseTools.camel_error_diagnose()}} → returns {{String}}
- {{DependencyCheckTools.camel_dependency_check()}} → returns {{String}}
- {{ExplainTools.camel_route_context()}} → returns {{String}}
- {{HardenTools.camel_route_harden_context()}} → returns {{String}}
Refactor the four raw-JSON tools to return typed records matching the pattern
used by {{CatalogTools}} and {{MigrationTools}}. Benefits:
- Compile-time type safety
- Auto-generated JSON schema for MCP tool responses
- Consistent serialization behavior across all tools
- Easier testing (assert on record fields instead of JSON string parsing)
The JSON output structure must remain unchanged for backward compatibility.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)