spring-projects / spring-projects/spring-ai

Inject jackson `ObjectMapper` configured via DI in `ToolCallResultConverter`

Open
#4,838 3 comments 5 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

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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.