@@ -254,8 +254,7 @@ func Test_SearchIssues(t *testing.T) {
254254 assert .Contains (t , tool .InputSchema .Properties , "repo" )
255255 assert .Contains (t , tool .InputSchema .Properties , "sort" )
256256 assert .Contains (t , tool .InputSchema .Properties , "order" )
257- assert .Contains (t , tool .InputSchema .Properties , "perPage" )
258- assert .Contains (t , tool .InputSchema .Properties , "page" )
257+ assert .Contains (t , tool .InputSchema .Properties , "cursor" )
259258 assert .ElementsMatch (t , tool .InputSchema .Required , []string {"query" })
260259
261260 // Setup mock search results
@@ -308,7 +307,7 @@ func Test_SearchIssues(t *testing.T) {
308307 "sort" : "created" ,
309308 "order" : "desc" ,
310309 "page" : "1" ,
311- "per_page" : "30 " ,
310+ "per_page" : "11 " ,
312311 },
313312 ).andThen (
314313 mockResponse (t , http .StatusOK , mockSearchResult ),
@@ -337,7 +336,7 @@ func Test_SearchIssues(t *testing.T) {
337336 "sort" : "created" ,
338337 "order" : "asc" ,
339338 "page" : "1" ,
340- "per_page" : "30 " ,
339+ "per_page" : "11 " ,
341340 },
342341 ).andThen (
343342 mockResponse (t , http .StatusOK , mockSearchResult ),
@@ -364,7 +363,7 @@ func Test_SearchIssues(t *testing.T) {
364363 map [string ]string {
365364 "q" : "is:issue bug" ,
366365 "page" : "1" ,
367- "per_page" : "30 " ,
366+ "per_page" : "11 " ,
368367 },
369368 ).andThen (
370369 mockResponse (t , http .StatusOK , mockSearchResult ),
@@ -388,7 +387,7 @@ func Test_SearchIssues(t *testing.T) {
388387 map [string ]string {
389388 "q" : "is:issue feature" ,
390389 "page" : "1" ,
391- "per_page" : "30 " ,
390+ "per_page" : "11 " ,
392391 },
393392 ).andThen (
394393 mockResponse (t , http .StatusOK , mockSearchResult ),
@@ -426,7 +425,7 @@ func Test_SearchIssues(t *testing.T) {
426425 map [string ]string {
427426 "q" : "repo:github/github-mcp-server is:issue is:open (label:critical OR label:urgent)" ,
428427 "page" : "1" ,
429- "per_page" : "30 " ,
428+ "per_page" : "11 " ,
430429 },
431430 ).andThen (
432431 mockResponse (t , http .StatusOK , mockSearchResult ),
@@ -449,7 +448,7 @@ func Test_SearchIssues(t *testing.T) {
449448 map [string ]string {
450449 "q" : "is:issue repo:github/github-mcp-server critical" ,
451450 "page" : "1" ,
452- "per_page" : "30 " ,
451+ "per_page" : "11 " ,
453452 },
454453 ).andThen (
455454 mockResponse (t , http .StatusOK , mockSearchResult ),
@@ -474,7 +473,7 @@ func Test_SearchIssues(t *testing.T) {
474473 map [string ]string {
475474 "q" : "is:issue repo:octocat/Hello-World bug" ,
476475 "page" : "1" ,
477- "per_page" : "30 " ,
476+ "per_page" : "11 " ,
478477 },
479478 ).andThen (
480479 mockResponse (t , http .StatusOK , mockSearchResult ),
@@ -497,7 +496,7 @@ func Test_SearchIssues(t *testing.T) {
497496 map [string ]string {
498497 "q" : "repo:github/github-mcp-server is:issue (label:critical OR label:urgent OR label:high-priority OR label:blocker)" ,
499498 "page" : "1" ,
500- "per_page" : "30 " ,
499+ "per_page" : "11 " ,
501500 },
502501 ).andThen (
503502 mockResponse (t , http .StatusOK , mockSearchResult ),
@@ -553,14 +552,32 @@ func Test_SearchIssues(t *testing.T) {
553552 // Parse the result and get the text content if no error
554553 textContent := getTextResult (t , result )
555554
556- // Unmarshal and verify the result
557- var returnedResult github. IssuesSearchResult
555+ // Unmarshal paginated search result
556+ var returnedResult map [ string ] interface {}
558557 err = json .Unmarshal ([]byte (textContent .Text ), & returnedResult )
559558 require .NoError (t , err )
560- assert .Equal (t , * tc .expectedResult .Total , * returnedResult .Total )
561- assert .Equal (t , * tc .expectedResult .IncompleteResults , * returnedResult .IncompleteResults )
562- assert .Len (t , returnedResult .Issues , len (tc .expectedResult .Issues ))
563- for i , issue := range returnedResult .Issues {
559+
560+ // Check totalCount and incompleteResults
561+ if totalCount , ok := returnedResult ["totalCount" ].(float64 ); ok {
562+ assert .Equal (t , float64 (* tc .expectedResult .Total ), totalCount )
563+ }
564+ if incompleteResults , ok := returnedResult ["incompleteResults" ].(bool ); ok {
565+ assert .Equal (t , * tc .expectedResult .IncompleteResults , incompleteResults )
566+ }
567+
568+ // Extract items (Issues array)
569+ items , ok := returnedResult ["items" ].([]interface {})
570+ require .True (t , ok )
571+ assert .Len (t , items , len (tc .expectedResult .Issues ))
572+
573+ // Convert items to Issues array for comparison
574+ itemsBytes , err := json .Marshal (items )
575+ require .NoError (t , err )
576+ var issues []* github.Issue
577+ err = json .Unmarshal (itemsBytes , & issues )
578+ require .NoError (t , err )
579+
580+ for i , issue := range issues {
564581 assert .Equal (t , * tc .expectedResult .Issues [i ].Number , * issue .Number )
565582 assert .Equal (t , * tc .expectedResult .Issues [i ].Title , * issue .Title )
566583 assert .Equal (t , * tc .expectedResult .Issues [i ].State , * issue .State )
@@ -749,7 +766,7 @@ func Test_ListIssues(t *testing.T) {
749766 assert .Contains (t , tool .InputSchema .Properties , "direction" )
750767 assert .Contains (t , tool .InputSchema .Properties , "since" )
751768 assert .Contains (t , tool .InputSchema .Properties , "after" )
752- assert . Contains ( t , tool . InputSchema . Properties , "perPage" )
769+ // ListIssues uses GraphQL pagination with "after", not REST "cursor"
753770 assert .ElementsMatch (t , tool .InputSchema .Required , []string {"owner" , "repo" })
754771
755772 // Mock issues data
@@ -1598,8 +1615,7 @@ func Test_GetIssueComments(t *testing.T) {
15981615 assert .Contains (t , tool .InputSchema .Properties , "owner" )
15991616 assert .Contains (t , tool .InputSchema .Properties , "repo" )
16001617 assert .Contains (t , tool .InputSchema .Properties , "issue_number" )
1601- assert .Contains (t , tool .InputSchema .Properties , "page" )
1602- assert .Contains (t , tool .InputSchema .Properties , "perPage" )
1618+ assert .Contains (t , tool .InputSchema .Properties , "cursor" )
16031619 assert .ElementsMatch (t , tool .InputSchema .Required , []string {"method" , "owner" , "repo" , "issue_number" })
16041620
16051621 // Setup mock comments for success case
@@ -1654,7 +1670,7 @@ func Test_GetIssueComments(t *testing.T) {
16541670 mock .GetReposIssuesCommentsByOwnerByRepoByIssueNumber ,
16551671 expectQueryParams (t , map [string ]string {
16561672 "page" : "2" ,
1657- "per_page" : "10 " ,
1673+ "per_page" : "11 " ,
16581674 }).andThen (
16591675 mockResponse (t , http .StatusOK , mockComments ),
16601676 ),
@@ -1713,9 +1729,10 @@ func Test_GetIssueComments(t *testing.T) {
17131729 require .NoError (t , err )
17141730 textContent := getTextResult (t , result )
17151731
1716- // Unmarshal and verify the result
1732+ // Extract items from paginated response and unmarshal
1733+ itemsBytes := extractItemsFromPaginatedResponse (t , textContent .Text )
17171734 var returnedComments []* github.IssueComment
1718- err = json .Unmarshal ([] byte ( textContent . Text ) , & returnedComments )
1735+ err = json .Unmarshal (itemsBytes , & returnedComments )
17191736 require .NoError (t , err )
17201737 assert .Equal (t , len (tc .expectedComments ), len (returnedComments ))
17211738 if len (returnedComments ) > 0 {
@@ -2507,8 +2524,7 @@ func Test_GetSubIssues(t *testing.T) {
25072524 assert .Contains (t , tool .InputSchema .Properties , "owner" )
25082525 assert .Contains (t , tool .InputSchema .Properties , "repo" )
25092526 assert .Contains (t , tool .InputSchema .Properties , "issue_number" )
2510- assert .Contains (t , tool .InputSchema .Properties , "page" )
2511- assert .Contains (t , tool .InputSchema .Properties , "perPage" )
2527+ assert .Contains (t , tool .InputSchema .Properties , "cursor" )
25122528 assert .ElementsMatch (t , tool .InputSchema .Required , []string {"method" , "owner" , "repo" , "issue_number" })
25132529
25142530 // Setup mock sub-issues for success case
@@ -2577,7 +2593,7 @@ func Test_GetSubIssues(t *testing.T) {
25772593 mock .GetReposIssuesSubIssuesByOwnerByRepoByIssueNumber ,
25782594 expectQueryParams (t , map [string ]string {
25792595 "page" : "2" ,
2580- "per_page" : "10 " ,
2596+ "per_page" : "11 " ,
25812597 }).andThen (
25822598 mockResponse (t , http .StatusOK , mockSubIssues ),
25832599 ),
@@ -2723,8 +2739,9 @@ func Test_GetSubIssues(t *testing.T) {
27232739 textContent := getTextResult (t , result )
27242740
27252741 // Unmarshal and verify the result
2742+ itemsBytes := extractItemsFromPaginatedResponse (t , textContent .Text )
27262743 var returnedSubIssues []* github.Issue
2727- err = json .Unmarshal ([] byte ( textContent . Text ) , & returnedSubIssues )
2744+ err = json .Unmarshal (itemsBytes , & returnedSubIssues )
27282745 require .NoError (t , err )
27292746
27302747 assert .Len (t , returnedSubIssues , len (tc .expectedSubIssues ))
0 commit comments