@@ -645,7 +645,7 @@ func GetPullRequestComments(getClient GetClientFn, t translations.TranslationHel
645
645
}
646
646
647
647
// AddPullRequestReviewComment creates a tool to add a review comment to a pull request.
648
- func AddPullRequestReviewComment (client * github. Client , t translations.TranslationHelperFunc ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
648
+ func AddPullRequestReviewComment (getClient GetClientFn , t translations.TranslationHelperFunc ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
649
649
return mcp .NewTool ("add_pull_request_review_comment" ,
650
650
mcp .WithDescription (t ("TOOL_ADD_PULL_REQUEST_COMMENT_DESCRIPTION" , "Add a review comment to a pull request" )),
651
651
mcp .WithString ("owner" ,
@@ -770,6 +770,11 @@ func AddPullRequestReviewComment(client *github.Client, t translations.Translati
770
770
}
771
771
}
772
772
773
+ client , err := getClient (ctx )
774
+ if err != nil {
775
+ return nil , fmt .Errorf ("failed to get GitHub client: %w" , err )
776
+ }
777
+
773
778
createdComment , resp , err := client .PullRequests .CreateComment (ctx , owner , repo , pullNumber , comment )
774
779
if err != nil {
775
780
return nil , fmt .Errorf ("failed to create pull request comment: %w" , err )
@@ -794,7 +799,7 @@ func AddPullRequestReviewComment(client *github.Client, t translations.Translati
794
799
}
795
800
796
801
// ReplyToPullRequestReviewComment creates a tool to reply to an existing review comment on a pull request.
797
- func ReplyToPullRequestReviewComment (client * github. Client , t translations.TranslationHelperFunc ) (tool mcp.Tool ,
802
+ func ReplyToPullRequestReviewComment (getClient GetClientFn , t translations.TranslationHelperFunc ) (tool mcp.Tool ,
798
803
handler server.ToolHandlerFunc ) {
799
804
return mcp .NewTool ("reply_to_pull_request_review_comment" ,
800
805
mcp .WithDescription (t ("TOOL_REPLY_TO_PULL_REQUEST_REVIEW_COMMENT_DESCRIPTION" , "Reply to an existing review comment on a pull request" )),
@@ -841,6 +846,11 @@ func ReplyToPullRequestReviewComment(client *github.Client, t translations.Trans
841
846
return mcp .NewToolResultError (err .Error ()), nil
842
847
}
843
848
849
+ client , err := getClient (ctx )
850
+ if err != nil {
851
+ return nil , fmt .Errorf ("failed to get GitHub client: %w" , err )
852
+ }
853
+
844
854
createdReply , resp , err := client .PullRequests .CreateCommentInReplyTo (ctx , owner , repo , pullNumber , body , int64 (commentID ))
845
855
if err != nil {
846
856
return nil , fmt .Errorf ("failed to reply to pull request comment: %w" , err )
0 commit comments