mcp: add Request.GetExtra (#350)

This commit is contained in:
Jonathan Amsterdam 2025-08-22 11:04:01 -04:00 • committed by GitHub
commit 4587941994
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -404,6 +404,8 @@ type Request interface {
isRequest()
GetSession() Session
GetParams() Params
// GetExtra returns the Extra field for ServerRequests, and nil for ClientRequests.
GetExtra() *RequestExtra
}
// A ClientRequest is a request to a client.
@ -435,6 +437,9 @@ func (r *ServerRequest[P]) GetSession() Session { return r.Session }
func (r *ClientRequest[P]) GetParams() Params { return r.Params }
func (r *ServerRequest[P]) GetParams() Params { return r.Params }
func (r *ClientRequest[P]) GetExtra() *RequestExtra { return nil }
func (r *ServerRequest[P]) GetExtra() *RequestExtra { return r.Extra }
func serverRequestFor[P Params](s *ServerSession, p P) *ServerRequest[P] {
return &ServerRequest[P]{Session: s, Params: p}
}