oscerd opened a new pull request, #23169:
URL: https://github.com/apache/camel/pull/23169

   ## Summary
   
   Configures the Quarkus Jackson `ObjectMapper` for the `camel-jbang-mcp` 
module
   with `quarkus.jackson.serialization-inclusion=non-null` so the `@Tool` result
   records serialized via `JsonTextContentEncoder` no longer emit fields with
   `null` values.
   
   This reduces LLM context-window pressure for every caller of the
   camel-jbang-mcp server. The module exposes 31 tools, 6 resources and 3 
prompts,
   so per-call token bloat from useless `\"field\": null` entries adds up 
quickly.
   
   Closes [CAMEL-23476](https://issues.apache.org/jira/browse/CAMEL-23476).
   
   ## Why this works
   
   `io.quarkiverse.mcp.server.runtime.JsonTextContentEncoder` (the default 
content
   encoder used for arbitrary objects returned from `@Tool` methods) injects the
   default Quarkus `ObjectMapper` and calls `writeValueAsString(...)` on it.
   Quarkus' built-in `io.quarkus.jackson.runtime.ConfigurationCustomizer`
   (priority `Integer.MAX_VALUE`) reads 
`JacksonBuildTimeConfig.serializationInclusion()`
   and invokes `setSerializationInclusion(...)` on that `ObjectMapper`, so the
   single property line is enough to strip nulls from every result the MCP 
server
   emits.
   
   The framework already ships an `McpObjectMapperCustomizer` that adds a
   `@JsonInclude(NON_NULL)` mixin to MCP envelope types (`ToolResponse`,
   `PromptResponse`, etc.), but **not** to application-level result records like
   `ComponentDetailResult` or `OptionInfo` — which is the bug filed in the JIRA.
   
   ## Changes
   
   - `application.properties`: add 
`quarkus.jackson.serialization-inclusion=non-null`
   - `McpJsonSerializationTest`: new test verifying
     - the property is set in `application.properties`
     - `ComponentInfo`, `OptionInfo` and `ComponentDetailResult` instances with
       null fields produce JSON that omits those fields
   
   ## Test plan
   
   - [x] `mvn -pl dsl/camel-jbang/camel-jbang-mcp test` — 231 tests pass (227 
existing + 4 new)
   - [x] `mvn clean install -DskipTests` from the repo root — full reactor 
build green
   
   ---
   
   _Claude Code on behalf of Andrea Cosentino_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to