Skip to content

Commit c8f040f

Browse files
Apply suggestions from code review
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 018a745 commit c8f040f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

server/session.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,13 @@ func (s *MCPServer) UnregisterSession(
6565
ctx context.Context,
6666
sessionID string,
6767
) {
68-
session, _ := s.sessions.LoadAndDelete(sessionID)
69-
s.hooks.UnregisterSession(ctx, session.(ClientSession))
68+
sessionValue, ok := s.sessions.LoadAndDelete(sessionID)
69+
if !ok {
70+
return
71+
}
72+
if session, ok := sessionValue.(ClientSession); ok {
73+
s.hooks.UnregisterSession(ctx, session)
74+
}
7075
}
7176

7277
// SendNotificationToAllClients sends a notification to all the currently active clients.

0 commit comments

Comments
 (0)