spring-projects / spring-projects/spring-ai
Inject jackson `ObjectMapper` configured via DI in `ToolCallResultConverter`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
Expected Behavior
When a method tool (annotated via @Tool) returns an object it's serialized with DefaultToolCallResultConverter. This however uses JsonParser which has a hardcoded ObjectMapper in it.
Would have expected that it would use the ObjectMapper via Spring DI
Current Behavior
Like mentioned it uses a hardcoded ToolCallResultConverter which does not allow to override it's configuration
Context
This one is not configurable which we would like to (to drop fields which have null fields to save tokens towards the LLM)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with DefaultToolCallResultConverter and JsonParser, then trace how @Tool results are converted and how Spring provides the ObjectMapper. Done means object results use the DI-configured mapper, allowing settings such as omitting null fields to affect the serialized tool-call result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100