create_change_request_comment
Add comments to merge requests on Alibaba Cloud DevOps. Supports global comments on the entire request or inline comments on specific code lines, with options for drafts and replies.
Instructions
[Code Management] Create a comment on a change request. Supports two types: GLOBAL_COMMENT (global comment on the entire merge request) and INLINE_COMMENT (inline comment on specific code lines). For INLINE_COMMENT, you must provide file_path, line_number, from_patchset_biz_id, and to_patchset_biz_id parameters.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"organizationId": "<organizationId>",
"repositoryId": "<repositoryId>",
"localId": "<localId>",
"content": "<content>",
"patchset_biz_id": "<patchset_biz_id>"
},
"name": "create_change_request_comment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| draft | No | 是否草稿评论。true - 草稿评论(不会立即显示给其他人);false - 正式评论(默认值) | |
| content | Yes | 评论内容,长度必须在 1 到 65535 之间。示例:'This is a comment content.' 或 '这里需要优化性能,建议使用缓存机制' | |
| localId | Yes | 局部ID,表示代码库中第几个合并请求。示例:'1' 或 '42' | |
| resolved | No | 是否标记已解决。true - 已解决;false - 未解决(默认值) | |
| file_path | No | 文件路径,仅行内评论需要。表示评论针对的文件路径。示例:'/src/main/java/com/example/MyClass.java' 或 'src/utils/helper.ts' 或 'frontend/components/Button.tsx' | |
| line_number | No | 行号,仅行内评论需要,从1开始计数(示例:42 表示第42行)。全局评论可省略,或传 0 / null 表示无行号 | |
| comment_type | No | 评论类型。GLOBAL_COMMENT - 全局评论(对整个合并请求的评论);INLINE_COMMENT - 行内评论(针对特定代码行的评论)。创建行内评论时,必须提供 file_path、line_number、from_patchset_biz_id 和 to_patchset_biz_id 参数 | GLOBAL_COMMENT |
| repositoryId | Yes | 代码库ID或全路径(斜杠须编码为%2F),如 2835387 或 myorg%2FmyRepo | |
| organizationId | Yes | 组织ID | |
| patchset_biz_id | Yes | 关联版本ID,具有唯一性。对于全局评论,使用最新合并源版本ID;对于行内评论,选择 from_patchset_biz_id 或 to_patchset_biz_id 中的一个。示例:'bf117304dfe44d5d9b1132f348edf92e' | |
| to_patchset_biz_id | No | 比较的目标版本ID,行内评论类型必传。表示代码比较的目标版本(通常是源分支版本,即合并源对应的版本)。示例:'537367017a9841738ac4269fbf6aacbe' | |
| from_patchset_biz_id | No | 比较的起始版本ID,行内评论类型必传。表示代码比较的起始版本(通常是目标分支版本,即合并目标对应的版本)。示例:'bf117304dfe44d5d9b1132f348edf92e' | |
| parent_comment_biz_id | No | 父评论ID,用于回复评论。如果这是对某个评论的回复,需要传入被回复评论的 bizId。示例:'1d8171cf0cc2453197fae0e0a27d5ece' |