@@ -645,7 +645,7 @@ func GetPullRequestComments(getClient GetClientFn, t translations.TranslationHel
645645}
646646
647647// 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 ) {
649649 return mcp .NewTool ("add_pull_request_review_comment" ,
650650 mcp .WithDescription (t ("TOOL_ADD_PULL_REQUEST_COMMENT_DESCRIPTION" , "Add a review comment to a pull request" )),
651651 mcp .WithString ("owner" ,
@@ -770,6 +770,11 @@ func AddPullRequestReviewComment(client *github.Client, t translations.Translati
770770 }
771771 }
772772
773+ client , err := getClient (ctx )
774+ if err != nil {
775+ return nil , fmt .Errorf ("failed to get GitHub client: %w" , err )
776+ }
777+
773778 createdComment , resp , err := client .PullRequests .CreateComment (ctx , owner , repo , pullNumber , comment )
774779 if err != nil {
775780 return nil , fmt .Errorf ("failed to create pull request comment: %w" , err )
@@ -794,7 +799,7 @@ func AddPullRequestReviewComment(client *github.Client, t translations.Translati
794799}
795800
796801// 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 ,
798803 handler server.ToolHandlerFunc ) {
799804 return mcp .NewTool ("reply_to_pull_request_review_comment" ,
800805 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
841846 return mcp .NewToolResultError (err .Error ()), nil
842847 }
843848
849+ client , err := getClient (ctx )
850+ if err != nil {
851+ return nil , fmt .Errorf ("failed to get GitHub client: %w" , err )
852+ }
853+
844854 createdReply , resp , err := client .PullRequests .CreateCommentInReplyTo (ctx , owner , repo , pullNumber , body , int64 (commentID ))
845855 if err != nil {
846856 return nil , fmt .Errorf ("failed to reply to pull request comment: %w" , err )
0 commit comments