@@ -37,12 +37,7 @@ func ListWorkflows(getClient GetClientFn, t translations.TranslationHelperFunc)
37
37
mcp .Required (),
38
38
mcp .Description (DescriptionRepositoryName ),
39
39
),
40
- mcp .WithNumber ("per_page" ,
41
- mcp .Description ("The number of results per page (max 100)" ),
42
- ),
43
- mcp .WithNumber ("page" ,
44
- mcp .Description ("The page number of the results to fetch" ),
45
- ),
40
+ WithPagination (),
46
41
),
47
42
func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
48
43
owner , err := RequiredParam [string ](request , "owner" )
@@ -55,11 +50,7 @@ func ListWorkflows(getClient GetClientFn, t translations.TranslationHelperFunc)
55
50
}
56
51
57
52
// Get optional pagination parameters
58
- perPage , err := OptionalIntParam (request , "per_page" )
59
- if err != nil {
60
- return mcp .NewToolResultError (err .Error ()), nil
61
- }
62
- page , err := OptionalIntParam (request , "page" )
53
+ pagination , err := OptionalPaginationParams (request )
63
54
if err != nil {
64
55
return mcp .NewToolResultError (err .Error ()), nil
65
56
}
@@ -71,8 +62,8 @@ func ListWorkflows(getClient GetClientFn, t translations.TranslationHelperFunc)
71
62
72
63
// Set up list options
73
64
opts := & github.ListOptions {
74
- PerPage : perPage ,
75
- Page : page ,
65
+ PerPage : pagination . perPage ,
66
+ Page : pagination . page ,
76
67
}
77
68
78
69
workflows , resp , err := client .Actions .ListWorkflows (ctx , owner , repo , opts )
@@ -157,12 +148,7 @@ func ListWorkflowRuns(getClient GetClientFn, t translations.TranslationHelperFun
157
148
mcp .Description ("Returns workflow runs with the check run status" ),
158
149
mcp .Enum ("queued" , "in_progress" , "completed" , "requested" , "waiting" ),
159
150
),
160
- mcp .WithNumber ("per_page" ,
161
- mcp .Description ("The number of results per page (max 100)" ),
162
- ),
163
- mcp .WithNumber ("page" ,
164
- mcp .Description ("The page number of the results to fetch" ),
165
- ),
151
+ WithPagination (),
166
152
),
167
153
func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
168
154
owner , err := RequiredParam [string ](request , "owner" )
@@ -197,11 +183,7 @@ func ListWorkflowRuns(getClient GetClientFn, t translations.TranslationHelperFun
197
183
}
198
184
199
185
// Get optional pagination parameters
200
- perPage , err := OptionalIntParam (request , "per_page" )
201
- if err != nil {
202
- return mcp .NewToolResultError (err .Error ()), nil
203
- }
204
- page , err := OptionalIntParam (request , "page" )
186
+ pagination , err := OptionalPaginationParams (request )
205
187
if err != nil {
206
188
return mcp .NewToolResultError (err .Error ()), nil
207
189
}
@@ -218,8 +200,8 @@ func ListWorkflowRuns(getClient GetClientFn, t translations.TranslationHelperFun
218
200
Event : event ,
219
201
Status : status ,
220
202
ListOptions : github.ListOptions {
221
- PerPage : perPage ,
222
- Page : page ,
203
+ PerPage : pagination . perPage ,
204
+ Page : pagination . page ,
223
205
},
224
206
}
225
207
@@ -483,12 +465,7 @@ func ListWorkflowJobs(getClient GetClientFn, t translations.TranslationHelperFun
483
465
mcp .Description ("Filters jobs by their completed_at timestamp" ),
484
466
mcp .Enum ("latest" , "all" ),
485
467
),
486
- mcp .WithNumber ("per_page" ,
487
- mcp .Description ("The number of results per page (max 100)" ),
488
- ),
489
- mcp .WithNumber ("page" ,
490
- mcp .Description ("The page number of the results to fetch" ),
491
- ),
468
+ WithPagination (),
492
469
),
493
470
func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
494
471
owner , err := RequiredParam [string ](request , "owner" )
@@ -512,11 +489,7 @@ func ListWorkflowJobs(getClient GetClientFn, t translations.TranslationHelperFun
512
489
}
513
490
514
491
// Get optional pagination parameters
515
- perPage , err := OptionalIntParam (request , "per_page" )
516
- if err != nil {
517
- return mcp .NewToolResultError (err .Error ()), nil
518
- }
519
- page , err := OptionalIntParam (request , "page" )
492
+ pagination , err := OptionalPaginationParams (request )
520
493
if err != nil {
521
494
return mcp .NewToolResultError (err .Error ()), nil
522
495
}
@@ -530,8 +503,8 @@ func ListWorkflowJobs(getClient GetClientFn, t translations.TranslationHelperFun
530
503
opts := & github.ListWorkflowJobsOptions {
531
504
Filter : filter ,
532
505
ListOptions : github.ListOptions {
533
- PerPage : perPage ,
534
- Page : page ,
506
+ PerPage : pagination . perPage ,
507
+ Page : pagination . page ,
535
508
},
536
509
}
537
510
@@ -1022,12 +995,7 @@ func ListWorkflowRunArtifacts(getClient GetClientFn, t translations.TranslationH
1022
995
mcp .Required (),
1023
996
mcp .Description ("The unique identifier of the workflow run" ),
1024
997
),
1025
- mcp .WithNumber ("per_page" ,
1026
- mcp .Description ("The number of results per page (max 100)" ),
1027
- ),
1028
- mcp .WithNumber ("page" ,
1029
- mcp .Description ("The page number of the results to fetch" ),
1030
- ),
998
+ WithPagination (),
1031
999
),
1032
1000
func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
1033
1001
owner , err := RequiredParam [string ](request , "owner" )
@@ -1045,11 +1013,7 @@ func ListWorkflowRunArtifacts(getClient GetClientFn, t translations.TranslationH
1045
1013
runID := int64 (runIDInt )
1046
1014
1047
1015
// Get optional pagination parameters
1048
- perPage , err := OptionalIntParam (request , "per_page" )
1049
- if err != nil {
1050
- return mcp .NewToolResultError (err .Error ()), nil
1051
- }
1052
- page , err := OptionalIntParam (request , "page" )
1016
+ pagination , err := OptionalPaginationParams (request )
1053
1017
if err != nil {
1054
1018
return mcp .NewToolResultError (err .Error ()), nil
1055
1019
}
@@ -1061,8 +1025,8 @@ func ListWorkflowRunArtifacts(getClient GetClientFn, t translations.TranslationH
1061
1025
1062
1026
// Set up list options
1063
1027
opts := & github.ListOptions {
1064
- PerPage : perPage ,
1065
- Page : page ,
1028
+ PerPage : pagination . perPage ,
1029
+ Page : pagination . page ,
1066
1030
}
1067
1031
1068
1032
artifacts , resp , err := client .Actions .ListWorkflowRunArtifacts (ctx , owner , repo , runID , opts )
0 commit comments