MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / createSessionLocked

Method createSessionLocked

server/mcp/handler.go:306–318  ·  view source on GitHub ↗
(userID uint, protocolVersion string, now time.Time)

Source from the content-addressed store, hash-verified

304}
305
306func (s *Server) createSessionLocked(userID uint, protocolVersion string, now time.Time) *session {
307 s.pruneLeastRecentlyUsedUserSessionsLocked(userID, max(0, s.countUserSessionsLocked(userID)-maxUserSessions+1))
308 s.pruneLeastRecentlyUsedSessionsLocked(max(0, len(s.sessions)-maxSessions+1))
309 currentSession := &session{
310 id: random.Token(),
311 userID: userID,
312 protocolVersion: protocolVersion,
313 createdAt: now,
314 lastUsedAt: now,
315 }
316 s.sessions[currentSession.id] = currentSession
317 return currentSession
318}
319
320func (s *Server) validateRequestProtocolVersion(requestedVersion string, negotiatedVersion string) bool {
321 if requestedVersion == "" {

Callers 2

initializeSessionMethod · 0.95
createSessionMethod · 0.95

Tested by

no test coverage detected