Skip to content

Commit 8e1e341

Browse files
authored
Use constant for limit
1 parent 230ca60 commit 8e1e341

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pkg/github/issues.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,7 @@ const (
13581358
// DefaultClosingPRsLimit is the default number of closing PRs to return per issue
13591359
// Aligned with GitHub GraphQL API default of 100 items per page
13601360
DefaultClosingPRsLimit = 100
1361+
MaxGraphQLPageSize = 250 // Maximum page size for GitHub GraphQL API
13611362
)
13621363

13631364
// FindClosingPullRequests creates a tool to find pull requests that closed specific issues
@@ -1386,7 +1387,7 @@ func FindClosingPullRequests(getGQLClient GetGQLClientFn, t translations.Transla
13861387
),
13871388
),
13881389
mcp.WithNumber("limit",
1389-
mcp.Description("Maximum number of closing PRs to return per issue (default: 100, max: 250)"),
1390+
mcp.Description("Maximum number of closing PRs to return per issue (default: 100, max: )"),
13901391
),
13911392
mcp.WithBoolean("includeClosedPrs",
13921393
mcp.Description("Include closed/merged pull requests in results (default: false)"),
@@ -1415,11 +1416,11 @@ func FindClosingPullRequests(getGQLClient GetGQLClientFn, t translations.Transla
14151416
limitExplicitlySet = true
14161417
if limitFloat, ok := limitParam.(float64); ok {
14171418
limit = int(limitFloat)
1418-
if limit <= 0 || limit > 250 {
1419-
return mcp.NewToolResultError("limit must be between 1 and 250 inclusive (GitHub GraphQL API maximum)"), nil
1419+
if limit <= 0 || limit > MaxGraphQLPageSize {
1420+
return mcp.NewToolResultError(fmt.Sprintf("limit must be between 1 and %d inclusive (GitHub GraphQL API maximum)", MaxGraphQLPageSize)), nil
14201421
}
14211422
} else {
1422-
return mcp.NewToolResultError("limit must be a number between 1 and 250 (GitHub GraphQL API maximum)"), nil
1423+
return mcp.NewToolResultError(fmt.Sprintf("limit must be a number between 1 and %d (GitHub GraphQL API maximum)", MaxGraphQLPageSize)), nil
14231424
}
14241425
}
14251426

@@ -1428,8 +1429,8 @@ func FindClosingPullRequests(getGQLClient GetGQLClientFn, t translations.Transla
14281429
if err != nil {
14291430
return mcp.NewToolResultError(fmt.Sprintf("last parameter error: %s", err.Error())), nil
14301431
}
1431-
if last != 0 && (last <= 0 || last > 250) {
1432-
return mcp.NewToolResultError("last must be between 1 and 250 inclusive for backward pagination (GitHub GraphQL API maximum)"), nil
1432+
if last != 0 && (last <= 0 || last > MaxGraphQLPageSize) {
1433+
return mcp.NewToolResultError(fmt.Sprintf("last must be between 1 and %d inclusive for backward pagination (GitHub GraphQL API maximum)", MaxGraphQLPageSize)), nil
14331434
}
14341435

14351436
// Parse cursor parameters

0 commit comments

Comments
 (0)