@@ -406,11 +406,12 @@ public Mono<Void> removeTool(String toolName) {
406406 private McpStatelessRequestHandler <McpSchema .ListToolsResult > toolsListRequestHandler () {
407407 return (exchange , params ) -> {
408408 var paginatedRequest = jsonMapper .convertValue (params , PAGINATED_REQUEST_TYPE_REF );
409+ var cursor = paginatedRequest != null ? paginatedRequest .cursor () : null ;
409410
410411 var mapSize = this .tools .size ();
411412 var mapHash = this .tools .hashCode ();
412413
413- return handleCursor (paginatedRequest . cursor () , mapSize , mapHash ).map (requestedStartIndex -> {
414+ return handleCursor (cursor , mapSize , mapHash ).map (requestedStartIndex -> {
414415 var startIndex = requestedStartIndex != null ? requestedStartIndex : 0 ;
415416 var endIndex = Math .min (startIndex + PAGE_SIZE , mapSize );
416417
@@ -584,11 +585,12 @@ public Mono<Void> removeResourceTemplate(String uriTemplate) {
584585 private McpStatelessRequestHandler <McpSchema .ListResourcesResult > resourcesListRequestHandler () {
585586 return (exchange , params ) -> {
586587 var paginatedRequest = jsonMapper .convertValue (params , PAGINATED_REQUEST_TYPE_REF );
588+ var cursor = paginatedRequest != null ? paginatedRequest .cursor () : null ;
587589
588590 var mapSize = this .resources .size ();
589591 var mapHash = this .resources .hashCode ();
590592
591- return handleCursor (paginatedRequest . cursor () , mapSize , mapHash ).map (requestedStartIndex -> {
593+ return handleCursor (cursor , mapSize , mapHash ).map (requestedStartIndex -> {
592594 var startIndex = requestedStartIndex != null ? requestedStartIndex : 0 ;
593595 var endIndex = Math .min (startIndex + PAGE_SIZE , mapSize );
594596
@@ -609,11 +611,12 @@ private McpStatelessRequestHandler<McpSchema.ListResourcesResult> resourcesListR
609611 private McpStatelessRequestHandler <McpSchema .ListResourceTemplatesResult > resourceTemplateListRequestHandler () {
610612 return (exchange , params ) -> {
611613 var paginatedRequest = jsonMapper .convertValue (params , PAGINATED_REQUEST_TYPE_REF );
614+ var cursor = paginatedRequest != null ? paginatedRequest .cursor () : null ;
612615
613616 var mapSize = this .resourceTemplates .size ();
614617 var mapHash = this .resourceTemplates .hashCode ();
615618
616- return handleCursor (paginatedRequest . cursor () , mapSize , mapHash ).map (requestedStartIndex -> {
619+ return handleCursor (cursor , mapSize , mapHash ).map (requestedStartIndex -> {
617620 var startIndex = requestedStartIndex != null ? requestedStartIndex : 0 ;
618621 var endIndex = Math .min (startIndex + PAGE_SIZE , mapSize );
619622
@@ -738,11 +741,12 @@ public Mono<Void> removePrompt(String promptName) {
738741 private McpStatelessRequestHandler <McpSchema .ListPromptsResult > promptsListRequestHandler () {
739742 return (exchange , params ) -> {
740743 var paginatedRequest = jsonMapper .convertValue (params , PAGINATED_REQUEST_TYPE_REF );
744+ var cursor = paginatedRequest != null ? paginatedRequest .cursor () : null ;
741745
742746 var mapSize = this .prompts .size ();
743747 var mapHash = this .prompts .hashCode ();
744748
745- return handleCursor (paginatedRequest . cursor () , mapSize , mapHash ).map (requestedStartIndex -> {
749+ return handleCursor (cursor , mapSize , mapHash ).map (requestedStartIndex -> {
746750 var startIndex = requestedStartIndex != null ? requestedStartIndex : 0 ;
747751 var endIndex = Math .min (startIndex + PAGE_SIZE , mapSize );
748752
0 commit comments