@@ -55,14 +55,14 @@ func NewClient(impl *Implementation, opts *ClientOptions) *Client {
55
55
type ClientOptions struct {
56
56
// Handler for sampling.
57
57
// Called when a server calls CreateMessage.
58
- CreateMessageHandler func (context.Context , * ClientRequest [ * CreateMessageParams ] ) (* CreateMessageResult , error )
58
+ CreateMessageHandler func (context.Context , * CreateMessageRequest ) (* CreateMessageResult , error )
59
59
// 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 )
66
66
// If non-zero, defines an interval for regular "ping" requests.
67
67
// If the peer fails to respond to pings originating from the keepalive check,
68
68
// the session is automatically closed.
@@ -132,7 +132,7 @@ func (c *Client) Connect(ctx context.Context, t Transport, _ *ClientSessionOptio
132
132
ClientInfo : c .impl ,
133
133
Capabilities : c .capabilities (),
134
134
}
135
- req := & ClientRequest [ * InitializeParams ] {Session : cs , Params : params }
135
+ req := & InitializeRequest {Session : cs , Params : params }
136
136
res , err := handleSend [* InitializeResult ](ctx , methodInitialize , req )
137
137
if err != nil {
138
138
_ = cs .Close ()
@@ -145,7 +145,7 @@ func (c *Client) Connect(ctx context.Context, t Transport, _ *ClientSessionOptio
145
145
if hc , ok := cs .mcpConn .(clientConnection ); ok {
146
146
hc .sessionUpdated (cs .state )
147
147
}
148
- req2 := & ClientRequest [ * InitializedParams ] {Session : cs , Params : & InitializedParams {}}
148
+ req2 := & InitializedClientRequest {Session : cs , Params : & InitializedParams {}}
149
149
if err := handleNotify (ctx , notificationInitialized , req2 ); err != nil {
150
150
_ = cs .Close ()
151
151
return nil , err
@@ -248,7 +248,7 @@ func changeAndNotify[P Params](c *Client, notification string, params P, change
248
248
notifySessions (sessions , notification , params )
249
249
}
250
250
251
- func (c * Client ) listRoots (_ context.Context , req * ClientRequest [ * ListRootsParams ] ) (* ListRootsResult , error ) {
251
+ func (c * Client ) listRoots (_ context.Context , req * ListRootsRequest ) (* ListRootsResult , error ) {
252
252
c .mu .Lock ()
253
253
defer c .mu .Unlock ()
254
254
roots := slices .Collect (c .roots .all ())
@@ -260,7 +260,7 @@ func (c *Client) listRoots(_ context.Context, req *ClientRequest[*ListRootsParam
260
260
}, nil
261
261
}
262
262
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 ) {
264
264
if c .opts .CreateMessageHandler == nil {
265
265
// TODO: wrap or annotate this error? Pick a standard code?
266
266
return nil , jsonrpc2 .NewError (CodeUnsupportedMethod , "client does not support CreateMessage" )
@@ -436,35 +436,35 @@ func (cs *ClientSession) Unsubscribe(ctx context.Context, params *UnsubscribePar
436
436
return err
437
437
}
438
438
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 ) {
440
440
if h := c .opts .ToolListChangedHandler ; h != nil {
441
441
h (ctx , req )
442
442
}
443
443
return nil , nil
444
444
}
445
445
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 ) {
447
447
if h := c .opts .PromptListChangedHandler ; h != nil {
448
448
h (ctx , req )
449
449
}
450
450
return nil , nil
451
451
}
452
452
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 ) {
454
454
if h := c .opts .ResourceListChangedHandler ; h != nil {
455
455
h (ctx , req )
456
456
}
457
457
return nil , nil
458
458
}
459
459
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 ) {
461
461
if h := c .opts .ResourceUpdatedHandler ; h != nil {
462
462
h (ctx , req )
463
463
}
464
464
return nil , nil
465
465
}
466
466
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 ) {
468
468
if h := c .opts .LoggingMessageHandler ; h != nil {
469
469
h (ctx , req )
470
470
}
0 commit comments