Andrea Cosentino created CAMEL-23476:
----------------------------------------

             Summary: camel-jbang-mcp: strip null fields from MCP JSON responses
                 Key: CAMEL-23476
                 URL: https://issues.apache.org/jira/browse/CAMEL-23476
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang
    Affects Versions: 4.21.0
            Reporter: Andrea Cosentino


h3. Context

Part of an effort to reduce token consumption of the {{camel-jbang-mcp}} MCP 
server. The module exposes 31 tools, 6 resources, and 3 prompts; both tool 
schemas (loaded once per session) and tool results (per call) contribute to LLM 
context-window pressure for every user of the server.

Related tickets in this effort are linked via "Relates to".

Several records have nullable fields populated on some code paths and {{null}} 
on others. Example: {{OptionInfo.group}} is {{null}} for component options 
({{CatalogTools.java:407}} passes {{null}}) but populated for endpoint options 
({{CatalogTools.java:418}}). Without {{@JsonInclude(NON_NULL)}} or a customized 
{{ObjectMapper}}, every component option carries a useless {{"group": null}}.

A grep across the module finds no {{JsonInclude}}, {{NON_NULL}}, or 
{{ObjectMapper}} references.

h3. Proposed change

Either:
* Annotate the result records (and/or a common base) with 
{{@JsonInclude(JsonInclude.Include.NON_NULL)}}, OR
* Configure the MCP Jackson {{ObjectMapper}} globally with 
{{setSerializationInclusion(Include.NON_NULL)}}.

Same for nullable booleans where applicable.

h3. Acceptance

MCP responses no longer contain fields with {{null}} values.

----
_Filed by Claude Code on behalf of Andrea Cosentino_



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

Reply via email to