Skip to content

Commit ca542a5

Browse files
GosthellJBUinfo
authored andcommitted
feat(server): get session
1 parent 76350ff commit ca542a5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

server/session.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ func (s *MCPServer) RegisterSession(
107107
return nil
108108
}
109109

110+
// GetSession returns the session by its ID.
111+
func (s *MCPServer) GetSession(
112+
sessionID string,
113+
) (ClientSession, error) {
114+
sessionValue, ok := s.sessions.Load(sessionID)
115+
if !ok {
116+
return nil, ErrSessionNotFound
117+
}
118+
return sessionValue.(ClientSession), nil
119+
}
120+
110121
func (s *MCPServer) buildLogNotification(notification mcp.LoggingMessageNotification) mcp.JSONRPCNotification {
111122
return mcp.JSONRPCNotification{
112123
JSONRPC: mcp.JSONRPC_VERSION,

0 commit comments

Comments
 (0)