Skip to content

Commit f48c117

Browse files
committed
minor edit
1 parent 71185b4 commit f48c117

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

pkg/github/pullrequests.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ Possible options:
111111
if err != nil {
112112
return utils.NewToolResultErrorFromErr("failed to get GitHub GQL client", err), nil, nil
113113
}
114-
result, err := GetPullRequestReviewComments(ctx, gqlClient, cache, owner, repo, pullNumber, pagination, flags)
114+
cursorPagination, err := OptionalCursorPaginationParams(args)
115+
if err != nil {
116+
return utils.NewToolResultError(err.Error()), nil, nil
117+
}
118+
result, err := GetPullRequestReviewComments(ctx, gqlClient, cache, owner, repo, pullNumber, cursorPagination, flags)
115119
return result, nil, err
116120
case "get_reviews":
117121
result, err := GetPullRequestReviews(ctx, client, cache, owner, repo, pullNumber, flags)
@@ -330,30 +334,24 @@ type pageInfoFragment struct {
330334
EndCursor githubv4.String
331335
}
332336

333-
func GetPullRequestReviewComments(ctx context.Context, gqlClient *githubv4.Client, cache *lockdown.RepoAccessCache, owner, repo string, pullNumber int, pagination PaginationParams, ff FeatureFlags) (*mcp.CallToolResult, error) {
337+
func GetPullRequestReviewComments(ctx context.Context, gqlClient *githubv4.Client, cache *lockdown.RepoAccessCache, owner, repo string, pullNumber int, pagination CursorPaginationParams, ff FeatureFlags) (*mcp.CallToolResult, error) {
334338
// Convert pagination parameters to GraphQL format
335339
gqlParams, err := pagination.ToGraphQLParams()
336340
if err != nil {
337341
return utils.NewToolResultError(fmt.Sprintf("invalid pagination parameters: %v", err)), nil
338342
}
339343

340-
// Default to 30 threads if not specified, max is 100 for GraphQL
341-
perPage := int32(30)
342-
if gqlParams.First != nil && *gqlParams.First > 0 {
343-
perPage = *gqlParams.First
344-
}
345-
346344
// Build variables for GraphQL query
347345
vars := map[string]any{
348346
"owner": githubv4.String(owner),
349347
"repo": githubv4.String(repo),
350348
"prNum": githubv4.Int(int32(pullNumber)), //nolint:gosec // pullNumber is controlled by user input validation
351-
"first": githubv4.Int(perPage),
349+
"first": githubv4.Int(*gqlParams.First),
352350
"commentsPerThread": githubv4.Int(50),
353351
}
354352

355353
// Add cursor if provided
356-
if gqlParams.After != nil && *gqlParams.After != "" {
354+
if gqlParams.After != nil {
357355
vars["after"] = githubv4.String(*gqlParams.After)
358356
} else {
359357
vars["after"] = (*githubv4.String)(nil)

0 commit comments

Comments
 (0)