Skip to content

Commit 4b168b6

Browse files
committed
add doc
1 parent c21ea65 commit 4b168b6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mcp/streamable.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,11 @@ func (t *StreamableServerTransport) ServeHTTP(w http.ResponseWriter, req *http.R
312312

313313
func (t *StreamableServerTransport) serveGET(w http.ResponseWriter, req *http.Request) {
314314
// connID 0 corresponds to the default GET request.
315-
id, lastIdx := StreamID(0), -1
315+
id := StreamID(0)
316+
// By default, we haven't seen a last index. Since indices start at 0, we represent
317+
// that by -1. This is incremented just before each event is written, in streamResponse
318+
// around L407.
319+
lastIdx := -1
316320
if len(req.Header.Values("Last-Event-ID")) > 0 {
317321
eid := req.Header.Get("Last-Event-ID")
318322
var ok bool

0 commit comments

Comments
 (0)