@@ -210,30 +210,12 @@ Call ${handleDialog.name} to handle it before continuing.`);
210210
211211      response . push ( '## Network requests' ) ; 
212212      if  ( requests . length )  { 
213-         const  paginationResult  =  paginate ( 
213+         const  data  =  this . #dataWithPagination ( 
214214          requests , 
215215          this . #networkRequestsOptions. pagination , 
216216        ) ; 
217-         if  ( paginationResult . invalidPage )  { 
218-           response . push ( 'Invalid page number provided. Showing first page.' ) ; 
219-         } 
220- 
221-         const  { startIndex,  endIndex,  currentPage,  totalPages}  = 
222-           paginationResult ; 
223-         response . push ( 
224-           `Showing ${ startIndex  +  1 } ${ endIndex } ${ requests . length } ${ currentPage  +  1 } ${ totalPages }  , 
225-         ) ; 
226- 
227-         if  ( this . #networkRequestsOptions. pagination )  { 
228-           if  ( paginationResult . hasNextPage )  { 
229-             response . push ( `Next page: ${ currentPage  +  1 }  ) ; 
230-           } 
231-           if  ( paginationResult . hasPreviousPage )  { 
232-             response . push ( `Previous page: ${ currentPage  -  1 }  ) ; 
233-           } 
234-         } 
235- 
236-         for  ( const  request  of  paginationResult . items )  { 
217+         response . push ( ...data . info ) ; 
218+         for  ( const  request  of  data . items )  { 
237219          response . push ( getShortDescriptionForRequest ( request ) ) ; 
238220        } 
239221      }  else  { 
@@ -264,6 +246,32 @@ Call ${handleDialog.name} to handle it before continuing.`);
264246    return  [ text ,  ...images ] ; 
265247  } 
266248
249+   #dataWithPagination< T > ( data : T [ ] ,  pagination ?: PaginationOptions )  { 
250+     const  response  =  [ ] ; 
251+     const  paginationResult  =  paginate < T > ( data ,  pagination ) ; 
252+     if  ( paginationResult . invalidPage )  { 
253+       response . push ( 'Invalid page number provided. Showing first page.' ) ; 
254+     } 
255+ 
256+     const  { startIndex,  endIndex,  currentPage,  totalPages}  =  paginationResult ; 
257+     response . push ( 
258+       `Showing ${ startIndex  +  1 } ${ endIndex } ${ data . length } ${ currentPage  +  1 } ${ totalPages }  , 
259+     ) ; 
260+     if  ( pagination )  { 
261+       if  ( paginationResult . hasNextPage )  { 
262+         response . push ( `Next page: ${ currentPage  +  1 }  ) ; 
263+       } 
264+       if  ( paginationResult . hasPreviousPage )  { 
265+         response . push ( `Previous page: ${ currentPage  -  1 }  ) ; 
266+       } 
267+     } 
268+ 
269+     return  { 
270+       info : response , 
271+       items : paginationResult . items , 
272+     } ; 
273+   } 
274+ 
267275  #getIncludeNetworkRequestsData( context : McpContext ) : string [ ]  { 
268276    const  response : string [ ]  =  [ ] ; 
269277    const  url  =  this . #attachedNetworkRequestUrl; 
0 commit comments