Skip to content

Commit a43fb6f

Browse files
committed
mcp: simplify ServerSession.Close() based on review feedback
1 parent 3b84ae3 commit a43fb6f

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

mcp/server.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"encoding/base64"
1111
"encoding/gob"
1212
"encoding/json"
13-
"errors"
1413
"fmt"
1514
"iter"
1615
"maps"
@@ -1125,21 +1124,13 @@ func (ss *ServerSession) Close() error {
11251124
// Close is idempotent and conn.Close() handles concurrent calls correctly
11261125
ss.keepaliveCancel()
11271126
}
1128-
1129-
var connErr, mcpConnErr error
1130-
if err := ss.conn.Close(); err != nil {
1131-
connErr = fmt.Errorf("failed to close connection: %w", err)
1132-
}
1133-
1134-
if err := ss.mcpConn.Close(); err != nil {
1135-
connErr = fmt.Errorf("failed to close mcp connection: %w", err)
1136-
}
1127+
err := ss.conn.Close()
11371128

11381129
if ss.onClose != nil {
11391130
ss.onClose()
11401131
}
11411132

1142-
return errors.Join(connErr, mcpConnErr)
1133+
return err
11431134
}
11441135

11451136
// Wait waits for the connection to be closed by the client.

0 commit comments

Comments
 (0)