spring-projects / spring-projects/spring-ai

MCP server starters SHOULD use spring.jackson properties.

Open
#6,097 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Bug description
When using spring.jackson.default-property-inclusion=non_null and spring-ai-starter-mcp-server-webmvc
tool calls are returning null values.
For example "end_date": null,
I want to avoid this noise in the context window.

Expected behavior
The starter should create a ToolCallResultConverter based on the autoconfigured jackson json mapper and use it.

Workaround
Of course I can use this annotation :

@Tool(description = "Retrieve customer information", resultConverter = MyNonNullJacksonConverter.class)

But this does not fit well in the spring boot autoconfiguration philosophy.

Another solution could be to allow injecting a ToolCallResultConverter using MethodToolCallbackProvider.build().toolCallResultConverter( ... ), but this method does not exists.

My feeling is that the root problem is that DefaultToolCallResultConverter and JsonParser are not IoC friendly. Hardcoding a static JsonParser is imho a bad practice.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how spring-ai-starter-mcp-server-webmvc creates its ToolCallResultConverter and how DefaultToolCallResultConverter and JsonParser obtain JSON configuration. Inspect MethodToolCallbackProvider.build() and the starter autoconfiguration entry points. Done means tool-call results honor the autoconfigured spring.jackson properties, including omitting null values, without requiring a per-tool converter annotation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.