@@ -33,7 +33,7 @@ type hiParams struct {
3333// TODO(jba): after schemas are stateless (WIP), this can be a variable.
3434func greetTool () * Tool { return & Tool {Name : "greet" , Description : "say hi" } }
3535
36- func sayHi (ctx context.Context , req * ServerRequest [ * CallToolParams ] , args hiParams ) (* CallToolResult , any , error ) {
36+ func sayHi (ctx context.Context , req * CallToolRequest , args hiParams ) (* CallToolResult , any , error ) {
3737 if err := req .Session .Ping (ctx , nil ); err != nil {
3838 return nil , nil , fmt .Errorf ("ping failed: %v" , err )
3939 }
@@ -74,20 +74,20 @@ func TestEndToEnd(t *testing.T) {
7474 }
7575
7676 sopts := & ServerOptions {
77- InitializedHandler : func (context.Context , * ServerRequest [ * InitializedParams ] ) {
77+ InitializedHandler : func (context.Context , * InitializedRequest ) {
7878 notificationChans ["initialized" ] <- 0
7979 },
80- RootsListChangedHandler : func (context.Context , * ServerRequest [ * RootsListChangedParams ] ) {
80+ RootsListChangedHandler : func (context.Context , * RootsListChangedRequest ) {
8181 notificationChans ["roots" ] <- 0
8282 },
83- ProgressNotificationHandler : func (context.Context , * ServerRequest [ * ProgressNotificationParams ] ) {
83+ ProgressNotificationHandler : func (context.Context , * ProgressNotificationRequest ) {
8484 notificationChans ["progress_server" ] <- 0
8585 },
86- SubscribeHandler : func (context.Context , * ServerRequest [ * SubscribeParams ] ) error {
86+ SubscribeHandler : func (context.Context , * SubscribeRequest ) error {
8787 notificationChans ["subscribe" ] <- 0
8888 return nil
8989 },
90- UnsubscribeHandler : func (context.Context , * ServerRequest [ * UnsubscribeParams ] ) error {
90+ UnsubscribeHandler : func (context.Context , * UnsubscribeRequest ) error {
9191 notificationChans ["unsubscribe" ] <- 0
9292 return nil
9393 },
@@ -98,7 +98,7 @@ func TestEndToEnd(t *testing.T) {
9898 Description : "say hi" ,
9999 }, sayHi )
100100 AddTool (s , & Tool {Name : "fail" , InputSchema : & jsonschema.Schema {}},
101- func (context.Context , * ServerRequest [ * CallToolParams ] , map [string ]any ) (* CallToolResult , any , error ) {
101+ func (context.Context , * CallToolRequest , map [string ]any ) (* CallToolResult , any , error ) {
102102 return nil , nil , errTestFailure
103103 })
104104 s .AddPrompt (codeReviewPrompt , codReviewPromptHandler )
@@ -511,7 +511,7 @@ var embeddedResources = map[string]string{
511511 "info" : "This is the MCP test server." ,
512512}
513513
514- func handleEmbeddedResource (_ context.Context , req * ServerRequest [ * ReadResourceParams ] ) (* ReadResourceResult , error ) {
514+ func handleEmbeddedResource (_ context.Context , req * ReadResourceRequest ) (* ReadResourceResult , error ) {
515515 u , err := url .Parse (req .Params .URI )
516516 if err != nil {
517517 return nil , err
@@ -663,7 +663,7 @@ func TestCancellation(t *testing.T) {
663663 start = make (chan struct {})
664664 cancelled = make (chan struct {}, 1 ) // don't block the request
665665 )
666- slowRequest := func (ctx context.Context , req * ServerRequest [ * CallToolParams ] , args any ) (* CallToolResult , any , error ) {
666+ slowRequest := func (ctx context.Context , req * CallToolRequest , args any ) (* CallToolResult , any , error ) {
667667 start <- struct {}{}
668668 select {
669669 case <- ctx .Done ():
@@ -852,7 +852,7 @@ func traceCalls[S Session](w io.Writer, prefix string) Middleware {
852852 }
853853}
854854
855- func nopHandler (context.Context , * ServerRequest [ * CallToolParams ] ) (* CallToolResult , error ) {
855+ func nopHandler (context.Context , * CallToolRequest ) (* CallToolResult , error ) {
856856 return nil , nil
857857}
858858
@@ -1009,13 +1009,13 @@ func TestSynchronousNotifications(t *testing.T) {
10091009
10101010 var rootsChanged atomic.Bool
10111011 serverOpts := & ServerOptions {
1012- RootsListChangedHandler : func (_ context.Context , req * ServerRequest [ * RootsListChangedParams ] ) {
1012+ RootsListChangedHandler : func (_ context.Context , req * RootsListChangedRequest ) {
10131013 rootsChanged .Store (true )
10141014 },
10151015 }
10161016 server := NewServer (testImpl , serverOpts )
10171017 cs , ss := basicClientServerConnection (t , client , server , func (s * Server ) {
1018- AddTool (s , & Tool {Name : "tool" }, func (ctx context.Context , req * ServerRequest [ * CallToolParams ] , args any ) (* CallToolResult , any , error ) {
1018+ AddTool (s , & Tool {Name : "tool" }, func (ctx context.Context , req * CallToolRequest , args any ) (* CallToolResult , any , error ) {
10191019 if ! rootsChanged .Load () {
10201020 return nil , nil , fmt .Errorf ("didn't get root change notification" )
10211021 }
@@ -1064,11 +1064,11 @@ func TestNoDistributedDeadlock(t *testing.T) {
10641064 }
10651065 client := NewClient (testImpl , clientOpts )
10661066 cs , _ := basicClientServerConnection (t , client , nil , func (s * Server ) {
1067- AddTool (s , & Tool {Name : "tool1" }, func (ctx context.Context , req * ServerRequest [ * CallToolParams ] , args any ) (* CallToolResult , any , error ) {
1067+ AddTool (s , & Tool {Name : "tool1" }, func (ctx context.Context , req * CallToolRequest , args any ) (* CallToolResult , any , error ) {
10681068 req .Session .CreateMessage (ctx , new (CreateMessageParams ))
10691069 return new (CallToolResult ), nil , nil
10701070 })
1071- AddTool (s , & Tool {Name : "tool2" }, func (ctx context.Context , req * ServerRequest [ * CallToolParams ] , args any ) (* CallToolResult , any , error ) {
1071+ AddTool (s , & Tool {Name : "tool2" }, func (ctx context.Context , req * CallToolRequest , args any ) (* CallToolResult , any , error ) {
10721072 req .Session .Ping (ctx , nil )
10731073 return new (CallToolResult ), nil , nil
10741074 })
0 commit comments