Skip to content

Commit ad7915c

Browse files
authored
Merge pull request #197 from buildkite/PS-1515/Fix-pagination
2 parents 9a505b0 + 82e1c36 commit ad7915c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

pkg/buildkite/artifacts.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ func ListArtifactsForBuild(client ArtifactsClient) (tool mcp.Tool, handler serve
9191
mcp.WithString("build_number",
9292
mcp.Required(),
9393
),
94+
withPagination(),
9495
mcp.WithToolAnnotation(mcp.ToolAnnotation{
9596
Title: "Build Artifact List",
9697
ReadOnlyHint: mcp.ToBoolPtr(true),
@@ -171,6 +172,7 @@ func ListArtifactsForJob(client ArtifactsClient) (tool mcp.Tool, handler server.
171172
mcp.WithString("job_id",
172173
mcp.Required(),
173174
),
175+
withPagination(),
174176
mcp.WithToolAnnotation(mcp.ToolAnnotation{
175177
Title: "Job Artifact List",
176178
ReadOnlyHint: mcp.ToBoolPtr(true),

pkg/buildkite/buildkite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type PaginatedResult[T any] struct {
1818

1919
func optionalPaginationParams(r mcp.CallToolRequest) (buildkite.ListOptions, error) {
2020
page := r.GetInt("page", 1)
21-
perPage := r.GetInt("perPage", 1)
21+
perPage := r.GetInt("perPage", 100)
2222
return buildkite.ListOptions{
2323
Page: page,
2424
PerPage: perPage,

pkg/buildkite/buildkite_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ func Test_optionalPaginationParams(t *testing.T) {
2828
expectErr: false,
2929
},
3030
{
31-
name: "missing pagination parameters should use new defaults (1 per page)",
31+
name: "missing pagination parameters should use new defaults (100 per page)",
3232
args: map[string]any{
3333
"name": "test-name",
3434
},
3535
expected: buildkite.ListOptions{
3636
Page: 1,
37-
PerPage: 1,
37+
PerPage: 100,
3838
},
3939
expectErr: false,
4040
},

0 commit comments

Comments
 (0)