@@ -613,12 +613,7 @@ func listBranches(client *github.Client, t translations.TranslationHelperFunc) (
613
613
mcp .Required (),
614
614
mcp .Description ("Repository name" ),
615
615
),
616
- mcp .WithNumber ("page" ,
617
- mcp .Description ("Page number" ),
618
- ),
619
- mcp .WithNumber ("perPage" ,
620
- mcp .Description ("Results per page" ),
621
- ),
616
+ withPagination (),
622
617
),
623
618
func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
624
619
owner , err := requiredParam [string ](request , "owner" )
@@ -629,19 +624,15 @@ func listBranches(client *github.Client, t translations.TranslationHelperFunc) (
629
624
if err != nil {
630
625
return mcp .NewToolResultError (err .Error ()), nil
631
626
}
632
- page , err := optionalIntParamWithDefault (request , "page" , 1 )
633
- if err != nil {
634
- return mcp .NewToolResultError (err .Error ()), nil
635
- }
636
- perPage , err := optionalIntParamWithDefault (request , "per_page" , 30 )
627
+ pagination , err := optionalPaginationParams (request )
637
628
if err != nil {
638
629
return mcp .NewToolResultError (err .Error ()), nil
639
630
}
640
631
641
632
opts := & github.BranchListOptions {
642
633
ListOptions : github.ListOptions {
643
- Page : page ,
644
- PerPage : perPage ,
634
+ Page : pagination . page ,
635
+ PerPage : pagination . perPage ,
645
636
},
646
637
}
647
638
0 commit comments