@@ -50,7 +50,7 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
50
50
return mcp .NewToolResultError (err .Error ()), nil
51
51
}
52
52
53
- // Get unified pagination parameters and convert to GraphQL format
53
+ // Get pagination parameters and convert to GraphQL format
54
54
unifiedPagination , err := OptionalUnifiedPaginationParams (request )
55
55
if err != nil {
56
56
return mcp .NewToolResultError (err .Error ()), nil
@@ -69,13 +69,6 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
69
69
categoryID = & id
70
70
}
71
71
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
-
79
72
var out []byte
80
73
81
74
var discussions []* github.Discussion
@@ -97,17 +90,14 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
97
90
HasNextPage bool
98
91
EndCursor string
99
92
}
100
- } `graphql:"discussions(first: $first, last: $last, after: $after, before: $before, categoryId: $categoryId)"`
93
+ } `graphql:"discussions(first: $first, categoryId: $categoryId)"`
101
94
} `graphql:"repository(owner: $owner, name: $repo)"`
102
95
}
103
96
vars := map [string ]interface {}{
104
97
"owner" : githubv4 .String (owner ),
105
98
"repo" : githubv4 .String (repo ),
106
99
"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 ),
111
101
}
112
102
if err := client .Query (ctx , & query , vars ); err != nil {
113
103
return mcp .NewToolResultError (err .Error ()), nil
@@ -149,16 +139,13 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
149
139
HasNextPage bool
150
140
EndCursor string
151
141
}
152
- } `graphql:"discussions(first: $first, last: $last, after: $after, before: $before )"`
142
+ } `graphql:"discussions(first: $first)"`
153
143
} `graphql:"repository(owner: $owner, name: $repo)"`
154
144
}
155
145
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 ),
162
149
}
163
150
if err := client .Query (ctx , & query , vars ); err != nil {
164
151
return mcp .NewToolResultError (err .Error ()), nil
@@ -291,10 +278,16 @@ func GetDiscussionComments(getGQLClient GetGQLClientFn, t translations.Translati
291
278
if err != nil {
292
279
return mcp .NewToolResultError (err .Error ()), nil
293
280
}
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
+
294
287
paginationParams := unifiedPagination .ToGraphQLParams ()
295
288
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 {
298
291
defaultFirst := int32 (100 )
299
292
paginationParams .First = & defaultFirst
300
293
}
@@ -315,16 +308,15 @@ func GetDiscussionComments(getGQLClient GetGQLClientFn, t translations.Translati
315
308
HasNextPage githubv4.Boolean
316
309
EndCursor githubv4.String
317
310
}
318
- } `graphql:"comments(first: $first, after: $after )"`
311
+ } `graphql:"comments(first: $first)"`
319
312
} `graphql:"discussion(number: $discussionNumber)"`
320
313
} `graphql:"repository(owner: $owner, name: $repo)"`
321
314
}
322
315
vars := map [string ]interface {}{
323
316
"owner" : githubv4 .String (params .Owner ),
324
317
"repo" : githubv4 .String (params .Repo ),
325
318
"discussionNumber" : githubv4 .Int (params .DiscussionNumber ),
326
- "first" : (* githubv4 .Int )(paginationParams .First ),
327
- "after" : (* githubv4 .String )(paginationParams .After ),
319
+ "first" : githubv4 .Int (* paginationParams .First ),
328
320
}
329
321
if err := client .Query (ctx , & q , vars ); err != nil {
330
322
return mcp .NewToolResultError (err .Error ()), nil
@@ -376,10 +368,16 @@ func ListDiscussionCategories(getGQLClient GetGQLClientFn, t translations.Transl
376
368
if err != nil {
377
369
return mcp .NewToolResultError (err .Error ()), nil
378
370
}
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
+
379
377
pagination := unifiedPagination .ToGraphQLParams ()
380
378
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 {
383
381
defaultFirst := int32 (100 )
384
382
pagination .First = & defaultFirst
385
383
}
@@ -400,14 +398,13 @@ func ListDiscussionCategories(getGQLClient GetGQLClientFn, t translations.Transl
400
398
HasNextPage githubv4.Boolean
401
399
EndCursor githubv4.String
402
400
}
403
- } `graphql:"discussionCategories(first: $first, after: $after )"`
401
+ } `graphql:"discussionCategories(first: $first)"`
404
402
} `graphql:"repository(owner: $owner, name: $repo)"`
405
403
}
406
404
vars := map [string ]interface {}{
407
405
"owner" : githubv4 .String (params .Owner ),
408
406
"repo" : githubv4 .String (params .Repo ),
409
- "first" : (* githubv4 .Int )(pagination .First ),
410
- "after" : (* githubv4 .String )(pagination .After ),
407
+ "first" : githubv4 .Int (* pagination .First ),
411
408
}
412
409
if err := client .Query (ctx , & q , vars ); err != nil {
413
410
return mcp .NewToolResultError (err .Error ()), nil
0 commit comments