spring-projects / spring-projects/spring-ai
Content field is empty in streaming response after tool call in MCP client
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
Bug description
When using the Spring AI MCP client for handling tool calls, we've observed inconsistent behavior between streaming and non-streaming modes regarding the content field in the request payload.
-
Streaming Mode (stream: true):
{ "messages": [ { "content": "What data does the database contain?", "role": "user" }, { "content": "", // 👈 Content is unexpectedly empty "role": "assistant", "tool_calls": [ { "id": "...", "type": "function", "function": {"name": "list_tables"} } ] }, // ... subsequent tool response ], "stream": true } -
Non-streaming Mode (stream: false):
{ "messages": [ { "content": "What data does the database contain?", "role": "user" }, { "content": "\n<think>\n ... \n</think>\n\n", // Content contains intermediate thought steps "role": "assistant", "tool_calls": [ // ... same tool call structure ] }, // ... subsequent tool response ], "stream": false }
Environment
- Spring AI version: 1.0.0-M6
- Java version: 17
- MCP API version: 0.7.0-SNAPSHOT
Steps to reproduce
- Send a tool call request with
stream: true - Observe empty
contentfield in assistant message - Compare with non-streaming request where
contentcontains text content
Expected behavior
- Both streaming and non-streaming modes should maintain consistent payload structure
- The
contentfield should either:- Contain intermediate thought steps in both modes, or
- Be omitted in streaming mode while preserving tool call metadata
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 by reproducing the streaming and non-streaming MCP client requests described in the issue, then trace the Spring AI MCP client code that builds assistant messages after a tool call. Compare how content and tool-call metadata are serialized in both paths; done means the chosen content behavior is consistent and covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100