@@ -220,7 +220,11 @@ func WithRecovery() ServerOption {
220220 return func (ctx context.Context , request mcp.CallToolRequest ) (result * mcp.CallToolResult , err error ) {
221221 defer func () {
222222 if r := recover (); r != nil {
223- err = fmt .Errorf ("panic recovered in %s tool handler: %v" , request .Params .Name , r )
223+ err = fmt .Errorf (
224+ "panic recovered in %s tool handler: %v" ,
225+ request .Params .Name ,
226+ r ,
227+ )
224228 }
225229 }()
226230 return next (ctx , request )
@@ -487,8 +491,8 @@ func (s *MCPServer) AddNotificationHandler(
487491
488492func (s * MCPServer ) handleInitialize (
489493 ctx context.Context ,
490- id any ,
491- request mcp.InitializeRequest ,
494+ _ any ,
495+ _ mcp.InitializeRequest ,
492496) (* mcp.InitializeResult , * requestError ) {
493497 capabilities := mcp.ServerCapabilities {}
494498
@@ -542,9 +546,9 @@ func (s *MCPServer) handleInitialize(
542546}
543547
544548func (s * MCPServer ) handlePing (
545- ctx context.Context ,
546- id any ,
547- request mcp.PingRequest ,
549+ _ context.Context ,
550+ _ any ,
551+ _ mcp.PingRequest ,
548552) (* mcp.EmptyResult , * requestError ) {
549553 return & mcp.EmptyResult {}, nil
550554}
@@ -586,14 +590,14 @@ func (s *MCPServer) handleSetLevel(
586590 err : fmt .Errorf ("invalid logging level '%s'" , level ),
587591 }
588592 }
589-
593+
590594 sessionLogging .SetLogLevel (level )
591595
592596 return & mcp.EmptyResult {}, nil
593597}
594598
595599func listByPagination [T mcp.Named ](
596- ctx context.Context ,
600+ _ context.Context ,
597601 s * MCPServer ,
598602 cursor mcp.Cursor ,
599603 allElements []T ,
@@ -644,7 +648,12 @@ func (s *MCPServer) handleListResources(
644648 sort .Slice (resources , func (i , j int ) bool {
645649 return resources [i ].Name < resources [j ].Name
646650 })
647- resourcesToReturn , nextCursor , err := listByPagination [mcp.Resource ](ctx , s , request .Params .Cursor , resources )
651+ resourcesToReturn , nextCursor , err := listByPagination (
652+ ctx ,
653+ s ,
654+ request .Params .Cursor ,
655+ resources ,
656+ )
648657 if err != nil {
649658 return nil , & requestError {
650659 id : id ,
@@ -675,7 +684,12 @@ func (s *MCPServer) handleListResourceTemplates(
675684 sort .Slice (templates , func (i , j int ) bool {
676685 return templates [i ].Name < templates [j ].Name
677686 })
678- templatesToReturn , nextCursor , err := listByPagination [mcp.ResourceTemplate ](ctx , s , request .Params .Cursor , templates )
687+ templatesToReturn , nextCursor , err := listByPagination (
688+ ctx ,
689+ s ,
690+ request .Params .Cursor ,
691+ templates ,
692+ )
679693 if err != nil {
680694 return nil , & requestError {
681695 id : id ,
@@ -747,7 +761,11 @@ func (s *MCPServer) handleReadResource(
747761 return nil , & requestError {
748762 id : id ,
749763 code : mcp .RESOURCE_NOT_FOUND ,
750- err : fmt .Errorf ("handler not found for resource URI '%s': %w" , request .Params .URI , ErrResourceNotFound ),
764+ err : fmt .Errorf (
765+ "handler not found for resource URI '%s': %w" ,
766+ request .Params .URI ,
767+ ErrResourceNotFound ,
768+ ),
751769 }
752770}
753771
@@ -772,7 +790,12 @@ func (s *MCPServer) handleListPrompts(
772790 sort .Slice (prompts , func (i , j int ) bool {
773791 return prompts [i ].Name < prompts [j ].Name
774792 })
775- promptsToReturn , nextCursor , err := listByPagination [mcp.Prompt ](ctx , s , request .Params .Cursor , prompts )
793+ promptsToReturn , nextCursor , err := listByPagination (
794+ ctx ,
795+ s ,
796+ request .Params .Cursor ,
797+ prompts ,
798+ )
776799 if err != nil {
777800 return nil , & requestError {
778801 id : id ,
@@ -885,7 +908,12 @@ func (s *MCPServer) handleListTools(
885908 s .toolFiltersMu .RUnlock ()
886909
887910 // Apply pagination
888- toolsToReturn , nextCursor , err := listByPagination [mcp.Tool ](ctx , s , request .Params .Cursor , tools )
911+ toolsToReturn , nextCursor , err := listByPagination (
912+ ctx ,
913+ s ,
914+ request .Params .Cursor ,
915+ tools ,
916+ )
889917 if err != nil {
890918 return nil , & requestError {
891919 id : id ,
0 commit comments