Skip to content

Conversation

@Kehrlann
Copy link
Contributor

  • When calling tools while using ChatModel#stream, store the reactive context in a thread-local, so it can be used by downstream reactive tools.
  • In AsyncMcpToolCallback, restore the reactive context so it can be accessed by the tool. This will be useful for Spring Security OAuth2 support in reactive scenarios, because it relies on the context.

@Kehrlann Kehrlann force-pushed the dgarnier/propagate-toolcall-reactive-context branch from 8983dcb to 15c2430 Compare June 23, 2025 09:23
@Kehrlann Kehrlann marked this pull request as ready for review June 24, 2025 12:59
- When calling tools while using ChatModel#stream, store the reactive
  context in a thread-local, so it can be used by downstream reactive
  tools.
- In AsyncMcpToolCallback, restore the reactive context so it can be
  accessed by the tool. This will be useful for Spring Security OAuth2
  support in reactive scenarios, because it relies on the context.

Signed-off-by: Daniel Garnier-Moiroux <[email protected]>
@Kehrlann Kehrlann force-pushed the dgarnier/propagate-toolcall-reactive-context branch from 15c2430 to 850b88d Compare June 24, 2025 13:01
@ilayaperumalg ilayaperumalg added bug Something isn't working MCP and removed bug Something isn't working labels Jun 24, 2025
tzolov added a commit to tzolov/spring-ai that referenced this pull request Jun 26, 2025
…l execution is enabled

- For streaming, block tool calling ChatResponse unless internal execution is disabled
- Add streaming validation test and debug logging

Related to spring-projects#3640

Signed-off-by: Christian Tzolov <[email protected]>
@tzolov tzolov added this to the 1.1.x milestone Jun 26, 2025
@tzolov
Copy link
Contributor

tzolov commented Jul 1, 2025

Thanks @Kehrlann

TODO: optimize the repeatable set context logic across all models.

rebased and merged at 9a52182

@tzolov tzolov closed this Jul 1, 2025
@Kehrlann Kehrlann deleted the dgarnier/propagate-toolcall-reactive-context branch September 15, 2025 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants