AddCommentToPendingReview creates a tool to add a comment to a pull request review.
(t translations.TranslationHelperFunc)
| 2212 | |
| 2213 | // AddCommentToPendingReview creates a tool to add a comment to a pull request review. |
| 2214 | func AddCommentToPendingReview(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 2215 | schema := &jsonschema.Schema{ |
| 2216 | Type: "object", |
| 2217 | Properties: map[string]*jsonschema.Schema{ |
| 2218 | // Ideally, for performance sake this would just accept the pullRequestReviewID. However, we would need to |
| 2219 | // add a new tool to get that ID for clients that aren't in the same context as the original pending review |
| 2220 | // creation. So for now, we'll just accept the owner, repo and pull number and assume this is adding a comment |
| 2221 | // the latest review from a user, since only one can be active at a time. It can later be extended with |
| 2222 | // a pullRequestReviewID parameter if targeting other reviews is desired: |
| 2223 | // mcp.WithString("pullRequestReviewID", |
| 2224 | // mcp.Required(), |
| 2225 | // mcp.Description("The ID of the pull request review to add a comment to"), |
| 2226 | // ), |
| 2227 | "owner": { |
| 2228 | Type: "string", |
| 2229 | Description: "Repository owner", |
| 2230 | }, |
| 2231 | "repo": { |
| 2232 | Type: "string", |
| 2233 | Description: "Repository name", |
| 2234 | }, |
| 2235 | "pullNumber": { |
| 2236 | Type: "number", |
| 2237 | Description: "Pull request number", |
| 2238 | }, |
| 2239 | "path": { |
| 2240 | Type: "string", |
| 2241 | Description: "The relative path to the file that necessitates a comment", |
| 2242 | }, |
| 2243 | "body": { |
| 2244 | Type: "string", |
| 2245 | Description: "The text of the review comment", |
| 2246 | }, |
| 2247 | "subjectType": { |
| 2248 | Type: "string", |
| 2249 | Description: "The level at which the comment is targeted", |
| 2250 | Enum: []any{"FILE", "LINE"}, |
| 2251 | }, |
| 2252 | "line": { |
| 2253 | Type: "number", |
| 2254 | Description: "The line of the blob in the pull request diff that the comment applies to. For multi-line comments, the last line of the range", |
| 2255 | }, |
| 2256 | "side": { |
| 2257 | Type: "string", |
| 2258 | Description: "The side of the diff to comment on. LEFT indicates the previous state, RIGHT indicates the new state", |
| 2259 | Enum: []any{"LEFT", "RIGHT"}, |
| 2260 | }, |
| 2261 | "startLine": { |
| 2262 | Type: "number", |
| 2263 | Description: "For multi-line comments, the first line of the range that the comment applies to", |
| 2264 | }, |
| 2265 | "startSide": { |
| 2266 | Type: "string", |
| 2267 | Description: "For multi-line comments, the starting side of the diff that the comment applies to. LEFT indicates the previous state, RIGHT indicates the new state", |
| 2268 | Enum: []any{"LEFT", "RIGHT"}, |
| 2269 | }, |
| 2270 | }, |
| 2271 | Required: []string{"owner", "repo", "pullNumber", "path", "body", "subjectType"}, |