Skip to content

Flow ExecutionContext with JsonRpcMessage #616

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
Open

Conversation

halter73
Copy link
Contributor

The primary goal of this change is to support IHttpContextAccessor in tool calls when the Streamable HTTP is in its default non-Stateless mode.

I'm not 100% sure making PerSessionExecutionContext configurable is the right move, but I have previously written sample code and tests that demonstrated the ability to set an AsyncLocal at the start of the RunSessionHandler callback and use that inside of tool call handlers, and I figured that could still be useful. I don't see any easy workaround to get the same functionality without providing this option, but I'm open to alternatives or for a better name.

Fixes #365.

The primary goal of this change is to support IHttpContextAccessor in
tool calls when the Streamable HTTP is in its default non-Stateless mode.
@halter73 halter73 requested a review from stephentoub July 11, 2025 21:09
@@ -38,6 +39,19 @@ private protected JsonRpcMessage()
[JsonIgnore]
public ITransport? RelatedTransport { get; set; }

/// <summary>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this immediate change, but it feels kind of strange that we're attaching a whole bunch of state to what is otherwise just a model for a protocol message. It does suggest that in the future we might want to refactor things somewhat, either by forcing separation between "domain models" and protocol version specific DTOs or perhaps by passing a context object alongside messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IHttpContextAccessor stopped working since 0.1.0-preview.10
2 participants