@@ -37,12 +37,7 @@ func ListWorkflows(getClient GetClientFn, t translations.TranslationHelperFunc)
3737 mcp .Required (),
3838 mcp .Description (DescriptionRepositoryName ),
3939 ),
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 (),
4641 ),
4742 func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
4843 owner , err := RequiredParam [string ](request , "owner" )
@@ -55,11 +50,7 @@ func ListWorkflows(getClient GetClientFn, t translations.TranslationHelperFunc)
5550 }
5651
5752 // 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 )
6354 if err != nil {
6455 return mcp .NewToolResultError (err .Error ()), nil
6556 }
@@ -71,8 +62,8 @@ func ListWorkflows(getClient GetClientFn, t translations.TranslationHelperFunc)
7162
7263 // Set up list options
7364 opts := & github.ListOptions {
74- PerPage : perPage ,
75- Page : page ,
65+ PerPage : pagination . perPage ,
66+ Page : pagination . page ,
7667 }
7768
7869 workflows , resp , err := client .Actions .ListWorkflows (ctx , owner , repo , opts )
@@ -157,12 +148,7 @@ func ListWorkflowRuns(getClient GetClientFn, t translations.TranslationHelperFun
157148 mcp .Description ("Returns workflow runs with the check run status" ),
158149 mcp .Enum ("queued" , "in_progress" , "completed" , "requested" , "waiting" ),
159150 ),
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 (),
166152 ),
167153 func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
168154 owner , err := RequiredParam [string ](request , "owner" )
@@ -197,11 +183,7 @@ func ListWorkflowRuns(getClient GetClientFn, t translations.TranslationHelperFun
197183 }
198184
199185 // 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 )
205187 if err != nil {
206188 return mcp .NewToolResultError (err .Error ()), nil
207189 }
@@ -218,8 +200,8 @@ func ListWorkflowRuns(getClient GetClientFn, t translations.TranslationHelperFun
218200 Event : event ,
219201 Status : status ,
220202 ListOptions : github.ListOptions {
221- PerPage : perPage ,
222- Page : page ,
203+ PerPage : pagination . perPage ,
204+ Page : pagination . page ,
223205 },
224206 }
225207
@@ -483,12 +465,7 @@ func ListWorkflowJobs(getClient GetClientFn, t translations.TranslationHelperFun
483465 mcp .Description ("Filters jobs by their completed_at timestamp" ),
484466 mcp .Enum ("latest" , "all" ),
485467 ),
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 (),
492469 ),
493470 func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
494471 owner , err := RequiredParam [string ](request , "owner" )
@@ -512,11 +489,7 @@ func ListWorkflowJobs(getClient GetClientFn, t translations.TranslationHelperFun
512489 }
513490
514491 // 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 )
520493 if err != nil {
521494 return mcp .NewToolResultError (err .Error ()), nil
522495 }
@@ -530,8 +503,8 @@ func ListWorkflowJobs(getClient GetClientFn, t translations.TranslationHelperFun
530503 opts := & github.ListWorkflowJobsOptions {
531504 Filter : filter ,
532505 ListOptions : github.ListOptions {
533- PerPage : perPage ,
534- Page : page ,
506+ PerPage : pagination . perPage ,
507+ Page : pagination . page ,
535508 },
536509 }
537510
@@ -1022,12 +995,7 @@ func ListWorkflowRunArtifacts(getClient GetClientFn, t translations.TranslationH
1022995 mcp .Required (),
1023996 mcp .Description ("The unique identifier of the workflow run" ),
1024997 ),
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 (),
1031999 ),
10321000 func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
10331001 owner , err := RequiredParam [string ](request , "owner" )
@@ -1045,11 +1013,7 @@ func ListWorkflowRunArtifacts(getClient GetClientFn, t translations.TranslationH
10451013 runID := int64 (runIDInt )
10461014
10471015 // 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 )
10531017 if err != nil {
10541018 return mcp .NewToolResultError (err .Error ()), nil
10551019 }
@@ -1061,8 +1025,8 @@ func ListWorkflowRunArtifacts(getClient GetClientFn, t translations.TranslationH
10611025
10621026 // Set up list options
10631027 opts := & github.ListOptions {
1064- PerPage : perPage ,
1065- Page : page ,
1028+ PerPage : pagination . perPage ,
1029+ Page : pagination . page ,
10661030 }
10671031
10681032 artifacts , resp , err := client .Actions .ListWorkflowRunArtifacts (ctx , owner , repo , runID , opts )
0 commit comments