Skip to content

Conversation

@jba
Copy link
Contributor

@jba jba commented Jul 24, 2025

Consolidate several maps into a single struct.

Simplifies the code, for the most part.

Consolidate several maps into a single struct.

Simplifies the code, for the most part.
@jba jba requested review from Copilot and samthanawalla July 24, 2025 11:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR consolidates the streamable server transport implementation by introducing a single stream struct to replace multiple separate maps. The main purpose is to simplify the code structure and improve maintainability by grouping related stream data together.

  • Replaces three separate maps (outgoing, signals, streamRequests) with a single streams map containing stream structs
  • Introduces a new stream type that encapsulates all stream-related state and behavior
  • Updates all stream-related operations to work with the consolidated structure


for _, data := range outgoing {
if err := t.opts.EventStore.Append(req.Context(), t.id, id, data); err != nil {
if err := t.opts.EventStore.Append(req.Context(), t.SessionID(), stream.id, data); err != nil {
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

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

Inconsistent method call: using t.SessionID() here but t.id was used in the original code. This may cause incorrect session identification in the event store.

Suggested change
if err := t.opts.EventStore.Append(req.Context(), t.SessionID(), stream.id, data); err != nil {
if err := t.opts.EventStore.Append(req.Context(), t.SessionID(), t.SessionID(), data); err != nil {

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@samthanawalla samthanawalla left a comment

Choose a reason for hiding this comment

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

Nice LGTM!

@jba jba enabled auto-merge (squash) July 25, 2025 18:21
@jba jba merged commit 86f71fc into modelcontextprotocol:main Jul 28, 2025
3 checks passed
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.

2 participants