Skip to content

Commit 5b99e94

Browse files
committed
clean up somments
1 parent 71aeb9a commit 5b99e94

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/server/streamableHttp.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,6 @@ export class StreamableHTTPServerTransport implements Transport {
406406

407407
if (allResponsesReady) {
408408
if (this._enableJsonResponse) {
409-
// If we are in SSE mode, we don't need to do anything else
410-
411409
// All responses ready, send as JSON
412410
const headers: Record<string, string> = {
413411
'Content-Type': 'application/json',
@@ -416,18 +414,7 @@ export class StreamableHTTPServerTransport implements Transport {
416414
headers['mcp-session-id'] = this.sessionId;
417415
}
418416

419-
// In tests, relatedIds might be coming in non-deterministic order
420-
// We need to sort numerically for numeric IDs, alphabetically for string IDs
421417
const responses = relatedIds
422-
.sort((a, b) => {
423-
// If both IDs are numbers, sort numerically
424-
if (typeof a === 'number' && typeof b === 'number') {
425-
return a - b;
426-
}
427-
428-
// Otherwise sort by string lexical order
429-
return String(a).localeCompare(String(b));
430-
})
431418
.map(id => this._requestResponseMap.get(id)!);
432419

433420
response.writeHead(200, headers);
@@ -437,6 +424,7 @@ export class StreamableHTTPServerTransport implements Transport {
437424
response.end(JSON.stringify(responses));
438425
}
439426
} else {
427+
// End the SSE stream
440428
response.end();
441429
}
442430
// Clean up

0 commit comments

Comments
 (0)