@@ -55,14 +55,14 @@ func NewClient(impl *Implementation, opts *ClientOptions) *Client {
5555type ClientOptions struct {
5656 // Handler for sampling.
5757 // Called when a server calls CreateMessage.
58- CreateMessageHandler func (context.Context , * ClientRequest [ * CreateMessageParams ] ) (* CreateMessageResult , error )
58+ CreateMessageHandler func (context.Context , * CreateMessageRequest ) (* CreateMessageResult , error )
5959 // Handlers for notifications from the server.
60- ToolListChangedHandler func (context.Context , * ClientRequest [ * ToolListChangedParams ] )
61- PromptListChangedHandler func (context.Context , * ClientRequest [ * PromptListChangedParams ] )
62- ResourceListChangedHandler func (context.Context , * ClientRequest [ * ResourceListChangedParams ] )
63- ResourceUpdatedHandler func (context.Context , * ClientRequest [ * ResourceUpdatedNotificationParams ] )
64- LoggingMessageHandler func (context.Context , * ClientRequest [ * LoggingMessageParams ] )
65- ProgressNotificationHandler func (context.Context , * ClientRequest [ * ProgressNotificationParams ] )
60+ ToolListChangedHandler func (context.Context , * ToolListChangedRequest )
61+ PromptListChangedHandler func (context.Context , * PromptListChangedRequest )
62+ ResourceListChangedHandler func (context.Context , * ResourceListChangedRequest )
63+ ResourceUpdatedHandler func (context.Context , * ResourceUpdatedNotificationRequest )
64+ LoggingMessageHandler func (context.Context , * LoggingMessageRequest )
65+ ProgressNotificationHandler func (context.Context , * ProgressNotificationClientRequest )
6666 // If non-zero, defines an interval for regular "ping" requests.
6767 // If the peer fails to respond to pings originating from the keepalive check,
6868 // the session is automatically closed.
@@ -132,7 +132,7 @@ func (c *Client) Connect(ctx context.Context, t Transport, _ *ClientSessionOptio
132132 ClientInfo : c .impl ,
133133 Capabilities : c .capabilities (),
134134 }
135- req := & ClientRequest [ * InitializeParams ] {Session : cs , Params : params }
135+ req := & InitializeRequest {Session : cs , Params : params }
136136 res , err := handleSend [* InitializeResult ](ctx , methodInitialize , req )
137137 if err != nil {
138138 _ = cs .Close ()
@@ -145,7 +145,7 @@ func (c *Client) Connect(ctx context.Context, t Transport, _ *ClientSessionOptio
145145 if hc , ok := cs .mcpConn .(clientConnection ); ok {
146146 hc .sessionUpdated (cs .state )
147147 }
148- req2 := & ClientRequest [ * InitializedParams ] {Session : cs , Params : & InitializedParams {}}
148+ req2 := & InitializedClientRequest {Session : cs , Params : & InitializedParams {}}
149149 if err := handleNotify (ctx , notificationInitialized , req2 ); err != nil {
150150 _ = cs .Close ()
151151 return nil , err
@@ -248,7 +248,7 @@ func changeAndNotify[P Params](c *Client, notification string, params P, change
248248 notifySessions (sessions , notification , params )
249249}
250250
251- func (c * Client ) listRoots (_ context.Context , req * ClientRequest [ * ListRootsParams ] ) (* ListRootsResult , error ) {
251+ func (c * Client ) listRoots (_ context.Context , req * ListRootsRequest ) (* ListRootsResult , error ) {
252252 c .mu .Lock ()
253253 defer c .mu .Unlock ()
254254 roots := slices .Collect (c .roots .all ())
@@ -260,7 +260,7 @@ func (c *Client) listRoots(_ context.Context, req *ClientRequest[*ListRootsParam
260260 }, nil
261261}
262262
263- func (c * Client ) createMessage (ctx context.Context , req * ClientRequest [ * CreateMessageParams ] ) (* CreateMessageResult , error ) {
263+ func (c * Client ) createMessage (ctx context.Context , req * CreateMessageRequest ) (* CreateMessageResult , error ) {
264264 if c .opts .CreateMessageHandler == nil {
265265 // TODO: wrap or annotate this error? Pick a standard code?
266266 return nil , jsonrpc2 .NewError (CodeUnsupportedMethod , "client does not support CreateMessage" )
@@ -436,35 +436,35 @@ func (cs *ClientSession) Unsubscribe(ctx context.Context, params *UnsubscribePar
436436 return err
437437}
438438
439- func (c * Client ) callToolChangedHandler (ctx context.Context , req * ClientRequest [ * ToolListChangedParams ] ) (Result , error ) {
439+ func (c * Client ) callToolChangedHandler (ctx context.Context , req * ToolListChangedRequest ) (Result , error ) {
440440 if h := c .opts .ToolListChangedHandler ; h != nil {
441441 h (ctx , req )
442442 }
443443 return nil , nil
444444}
445445
446- func (c * Client ) callPromptChangedHandler (ctx context.Context , req * ClientRequest [ * PromptListChangedParams ] ) (Result , error ) {
446+ func (c * Client ) callPromptChangedHandler (ctx context.Context , req * PromptListChangedRequest ) (Result , error ) {
447447 if h := c .opts .PromptListChangedHandler ; h != nil {
448448 h (ctx , req )
449449 }
450450 return nil , nil
451451}
452452
453- func (c * Client ) callResourceChangedHandler (ctx context.Context , req * ClientRequest [ * ResourceListChangedParams ] ) (Result , error ) {
453+ func (c * Client ) callResourceChangedHandler (ctx context.Context , req * ResourceListChangedRequest ) (Result , error ) {
454454 if h := c .opts .ResourceListChangedHandler ; h != nil {
455455 h (ctx , req )
456456 }
457457 return nil , nil
458458}
459459
460- func (c * Client ) callResourceUpdatedHandler (ctx context.Context , req * ClientRequest [ * ResourceUpdatedNotificationParams ] ) (Result , error ) {
460+ func (c * Client ) callResourceUpdatedHandler (ctx context.Context , req * ResourceUpdatedNotificationRequest ) (Result , error ) {
461461 if h := c .opts .ResourceUpdatedHandler ; h != nil {
462462 h (ctx , req )
463463 }
464464 return nil , nil
465465}
466466
467- func (c * Client ) callLoggingHandler (ctx context.Context , req * ClientRequest [ * LoggingMessageParams ] ) (Result , error ) {
467+ func (c * Client ) callLoggingHandler (ctx context.Context , req * LoggingMessageRequest ) (Result , error ) {
468468 if h := c .opts .LoggingMessageHandler ; h != nil {
469469 h (ctx , req )
470470 }
0 commit comments