@@ -50,7 +50,7 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
5050 return mcp .NewToolResultError (err .Error ()), nil
5151 }
5252
53- // Get unified pagination parameters and convert to GraphQL format
53+ // Get pagination parameters and convert to GraphQL format
5454 unifiedPagination , err := OptionalUnifiedPaginationParams (request )
5555 if err != nil {
5656 return mcp .NewToolResultError (err .Error ()), nil
@@ -69,13 +69,6 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
6969 categoryID = & id
7070 }
7171
72- // Build GraphQL query arguments
73- // Use default of 30 if neither first nor last is specified
74- if pagination .First == nil && pagination .Last == nil {
75- defaultFirst := int32 (30 )
76- pagination .First = & defaultFirst
77- }
78-
7972 var out []byte
8073
8174 var discussions []* github.Discussion
@@ -97,17 +90,14 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
9790 HasNextPage bool
9891 EndCursor string
9992 }
100- } `graphql:"discussions(first: $first, last: $last, after: $after, before: $before, categoryId: $categoryId)"`
93+ } `graphql:"discussions(first: $first, categoryId: $categoryId)"`
10194 } `graphql:"repository(owner: $owner, name: $repo)"`
10295 }
10396 vars := map [string ]interface {}{
10497 "owner" : githubv4 .String (owner ),
10598 "repo" : githubv4 .String (repo ),
10699 "categoryId" : * categoryID ,
107- "first" : (* githubv4 .Int )(pagination .First ),
108- "last" : (* githubv4 .Int )(pagination .Last ),
109- "after" : (* githubv4 .String )(pagination .After ),
110- "before" : (* githubv4 .String )(pagination .Before ),
100+ "first" : githubv4 .Int (* pagination .First ),
111101 }
112102 if err := client .Query (ctx , & query , vars ); err != nil {
113103 return mcp .NewToolResultError (err .Error ()), nil
@@ -149,16 +139,13 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
149139 HasNextPage bool
150140 EndCursor string
151141 }
152- } `graphql:"discussions(first: $first, last: $last, after: $after, before: $before )"`
142+ } `graphql:"discussions(first: $first)"`
153143 } `graphql:"repository(owner: $owner, name: $repo)"`
154144 }
155145 vars := map [string ]interface {}{
156- "owner" : githubv4 .String (owner ),
157- "repo" : githubv4 .String (repo ),
158- "first" : (* githubv4 .Int )(pagination .First ),
159- "last" : (* githubv4 .Int )(pagination .Last ),
160- "after" : (* githubv4 .String )(pagination .After ),
161- "before" : (* githubv4 .String )(pagination .Before ),
146+ "owner" : githubv4 .String (owner ),
147+ "repo" : githubv4 .String (repo ),
148+ "first" : githubv4 .Int (* pagination .First ),
162149 }
163150 if err := client .Query (ctx , & query , vars ); err != nil {
164151 return mcp .NewToolResultError (err .Error ()), nil
@@ -291,10 +278,16 @@ func GetDiscussionComments(getGQLClient GetGQLClientFn, t translations.Translati
291278 if err != nil {
292279 return mcp .NewToolResultError (err .Error ()), nil
293280 }
281+
282+ // Check if pagination parameters were explicitly provided
283+ _ , pageProvided := request .Params .Arguments .(map [string ]interface {})["page" ]
284+ _ , perPageProvided := request .Params .Arguments .(map [string ]interface {})["perPage" ]
285+ paginationExplicit := pageProvided || perPageProvided
286+
294287 paginationParams := unifiedPagination .ToGraphQLParams ()
295288
296- // Use default of 100 if neither first nor last is specified
297- if paginationParams . First == nil && paginationParams . Last == nil {
289+ // Use default of 100 if pagination was not explicitly provided
290+ if ! paginationExplicit {
298291 defaultFirst := int32 (100 )
299292 paginationParams .First = & defaultFirst
300293 }
@@ -315,16 +308,15 @@ func GetDiscussionComments(getGQLClient GetGQLClientFn, t translations.Translati
315308 HasNextPage githubv4.Boolean
316309 EndCursor githubv4.String
317310 }
318- } `graphql:"comments(first: $first, after: $after )"`
311+ } `graphql:"comments(first: $first)"`
319312 } `graphql:"discussion(number: $discussionNumber)"`
320313 } `graphql:"repository(owner: $owner, name: $repo)"`
321314 }
322315 vars := map [string ]interface {}{
323316 "owner" : githubv4 .String (params .Owner ),
324317 "repo" : githubv4 .String (params .Repo ),
325318 "discussionNumber" : githubv4 .Int (params .DiscussionNumber ),
326- "first" : (* githubv4 .Int )(paginationParams .First ),
327- "after" : (* githubv4 .String )(paginationParams .After ),
319+ "first" : githubv4 .Int (* paginationParams .First ),
328320 }
329321 if err := client .Query (ctx , & q , vars ); err != nil {
330322 return mcp .NewToolResultError (err .Error ()), nil
@@ -376,10 +368,16 @@ func ListDiscussionCategories(getGQLClient GetGQLClientFn, t translations.Transl
376368 if err != nil {
377369 return mcp .NewToolResultError (err .Error ()), nil
378370 }
371+
372+ // Check if pagination parameters were explicitly provided
373+ _ , pageProvided := request .Params .Arguments .(map [string ]interface {})["page" ]
374+ _ , perPageProvided := request .Params .Arguments .(map [string ]interface {})["perPage" ]
375+ paginationExplicit := pageProvided || perPageProvided
376+
379377 pagination := unifiedPagination .ToGraphQLParams ()
380378
381- // Use default of 100 if neither first nor last is specified
382- if pagination . First == nil && pagination . Last == nil {
379+ // Use default of 100 if pagination was not explicitly provided
380+ if ! paginationExplicit {
383381 defaultFirst := int32 (100 )
384382 pagination .First = & defaultFirst
385383 }
@@ -400,14 +398,13 @@ func ListDiscussionCategories(getGQLClient GetGQLClientFn, t translations.Transl
400398 HasNextPage githubv4.Boolean
401399 EndCursor githubv4.String
402400 }
403- } `graphql:"discussionCategories(first: $first, after: $after )"`
401+ } `graphql:"discussionCategories(first: $first)"`
404402 } `graphql:"repository(owner: $owner, name: $repo)"`
405403 }
406404 vars := map [string ]interface {}{
407405 "owner" : githubv4 .String (params .Owner ),
408406 "repo" : githubv4 .String (params .Repo ),
409- "first" : (* githubv4 .Int )(pagination .First ),
410- "after" : (* githubv4 .String )(pagination .After ),
407+ "first" : githubv4 .Int (* pagination .First ),
411408 }
412409 if err := client .Query (ctx , & q , vars ); err != nil {
413410 return mcp .NewToolResultError (err .Error ()), nil
0 commit comments