AddReplyToPullRequestComment creates a tool to add a reply or reaction to an existing pull request comment.
(t translations.TranslationHelperFunc)
| 1149 | |
| 1150 | // AddReplyToPullRequestComment creates a tool to add a reply or reaction to an existing pull request comment. |
| 1151 | func AddReplyToPullRequestComment(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 1152 | schema := &jsonschema.Schema{ |
| 1153 | Type: "object", |
| 1154 | Properties: map[string]*jsonschema.Schema{ |
| 1155 | "owner": { |
| 1156 | Type: "string", |
| 1157 | Description: "Repository owner", |
| 1158 | }, |
| 1159 | "repo": { |
| 1160 | Type: "string", |
| 1161 | Description: "Repository name", |
| 1162 | }, |
| 1163 | "pullNumber": { |
| 1164 | Type: "number", |
| 1165 | Description: "Pull request number. Required when body is provided.", |
| 1166 | }, |
| 1167 | "commentId": { |
| 1168 | Type: "number", |
| 1169 | Description: "The numeric ID of the pull request review comment to reply or react to. Use the number from a #discussion_r... anchor, not the GraphQL thread node ID (PRRT_...).", |
| 1170 | Minimum: jsonschema.Ptr(1.0), |
| 1171 | }, |
| 1172 | "body": { |
| 1173 | Type: "string", |
| 1174 | Description: "The text of the reply. Required unless reaction is provided.", |
| 1175 | }, |
| 1176 | "reaction": { |
| 1177 | Type: "string", |
| 1178 | Description: "Emoji reaction to add. Required unless body is provided.", |
| 1179 | Enum: []any{"+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", "eyes"}, |
| 1180 | }, |
| 1181 | }, |
| 1182 | Required: []string{"owner", "repo", "commentId"}, |
| 1183 | } |
| 1184 | |
| 1185 | return NewTool( |
| 1186 | ToolsetMetadataPullRequests, |
| 1187 | mcp.Tool{ |
| 1188 | Name: "add_reply_to_pull_request_comment", |
| 1189 | Description: t("TOOL_ADD_REPLY_TO_PULL_REQUEST_COMMENT_DESCRIPTION", "Add a reply and/or reaction to an existing pull request comment. This can create a new comment linked as a reply to the specified comment, add an emoji reaction to the specified comment, or do both. At least one of body or reaction is required."), |
| 1190 | Annotations: &mcp.ToolAnnotations{ |
| 1191 | Title: t("TOOL_ADD_REPLY_TO_PULL_REQUEST_COMMENT_USER_TITLE", "Add reply to pull request comment"), |
| 1192 | ReadOnlyHint: false, |
| 1193 | }, |
| 1194 | InputSchema: schema, |
| 1195 | }, |
| 1196 | []scopes.Scope{scopes.Repo}, |
| 1197 | func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 1198 | owner, err := RequiredParam[string](args, "owner") |
| 1199 | if err != nil { |
| 1200 | return utils.NewToolResultError(err.Error()), nil, nil |
| 1201 | } |
| 1202 | repo, err := RequiredParam[string](args, "repo") |
| 1203 | if err != nil { |
| 1204 | return utils.NewToolResultError(err.Error()), nil, nil |
| 1205 | } |
| 1206 | commentID, err := RequiredBigInt(args, "commentId") |
| 1207 | if err != nil { |
| 1208 | return utils.NewToolResultError(err.Error()), nil, nil |