mcp: add Session.ID (#67)
Support retrieving the session ID from client and server sessions. Fixes #65.
This commit is contained in:
parent
e1b1cd0072
commit
9b6327b3b7
1 changed files with 67 additions and 11 deletions
|
|
@ -142,6 +142,18 @@ type ClientSession struct {
|
|||
client *Client
|
||||
initializeResult *InitializeResult
|
||||
keepaliveCancel context.CancelFunc
|
||||
mcpConn Connection
|
||||
}
|
||||
|
||||
func (cs *ClientSession) setConn(c Connection) {
|
||||
cs.mcpConn = c
|
||||
}
|
||||
|
||||
func (cs *ClientSession) ID() string {
|
||||
if cs.mcpConn == nil {
|
||||
return ""
|
||||
}
|
||||
return cs.mcpConn.SessionID()
|
||||
}
|
||||
|
||||
// Close performs a graceful close of the connection, preventing new requests
|
||||
|
|
|
|||
Loading…
Reference in a new issue