Skip to content

Commit 4587941

Browse files
authored
mcp: add Request.GetExtra (#350)
1 parent 42f419f commit 4587941

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mcp/shared.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,8 @@ type Request interface {
404404
isRequest()
405405
GetSession() Session
406406
GetParams() Params
407+
// GetExtra returns the Extra field for ServerRequests, and nil for ClientRequests.
408+
GetExtra() *RequestExtra
407409
}
408410

409411
// A ClientRequest is a request to a client.
@@ -435,6 +437,9 @@ func (r *ServerRequest[P]) GetSession() Session { return r.Session }
435437
func (r *ClientRequest[P]) GetParams() Params { return r.Params }
436438
func (r *ServerRequest[P]) GetParams() Params { return r.Params }
437439

440+
func (r *ClientRequest[P]) GetExtra() *RequestExtra { return nil }
441+
func (r *ServerRequest[P]) GetExtra() *RequestExtra { return r.Extra }
442+
438443
func serverRequestFor[P Params](s *ServerSession, p P) *ServerRequest[P] {
439444
return &ServerRequest[P]{Session: s, Params: p}
440445
}

0 commit comments

Comments
 (0)