Skip to content

Propagate reactive Context to AsyncMcpToolCallback #3640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants