MCPcopy Index your code
hub / github.com/modelcontextprotocol/go-sdk / newStream

Method newStream

mcp/streamable.go:869–881  ·  view source on GitHub ↗
(ctx context.Context, requests map[jsonrpc.ID]struct{}, id string)

Source from the content-addressed store, hash-verified

867}
868
869func (c *streamableServerConn) newStream(ctx context.Context, requests map[jsonrpc.ID]struct{}, id string) (*stream, error) {
870 if c.eventStore != nil {
871 if err := c.eventStore.Open(ctx, c.sessionID, id); err != nil {
872 return nil, err
873 }
874 }
875 return &stream{
876 id: id,
877 requests: requests,
878 lastIdx: -1, // indices start at 0, incremented before each write
879 logger: c.logger,
880 }, nil
881}
882
883// We track the incoming request ID inside the handler context using
884// idContextValue, so that notifications and server->client calls that occur in

Callers 2

servePOSTMethod · 0.95
ConnectMethod · 0.80

Calls 1

OpenMethod · 0.65

Tested by

no test coverage detected