list_change_request_comments
Retrieve comments on Alibaba Cloud DevOps change requests to review feedback, track discussions, and manage code review processes effectively.
Instructions
[Code Management] List comments on a change request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organizationId | Yes | Organization ID, can be found in the basic information page of the organization admin console | |
| repositoryId | Yes | Repository ID or a combination of organization ID and repository name, for example: 2835387 or organizationId%2Frepo-name (Note: slashes need to be URL encoded as %2F) | |
| localId | Yes | Change request local ID | |
| patchSetBizIds | No | Associated version ID list, each comment is associated with a version, indicating which version the comment was posted on, for global comments, it's associated with the latest merge source version | |
| commentType | No | Comment type. Possible values: GLOBAL_COMMENT, INLINE_COMMENT | GLOBAL_COMMENT |
| state | No | Comment state. Possible values: OPENED, DRAFT | OPENED |
| resolved | No | Whether marked as resolved | |
| filePath | No | Filter by file path (for inline comments) |
Implementation Reference
- tool-handlers/code-management.ts:261-276 (handler)Handler implementation that parses input arguments using the schema, calls the core listChangeRequestCommentsFunc helper, and returns the comments as JSON text.case "list_change_request_comments": { const args = types.ListChangeRequestCommentsSchema.parse(request.params.arguments); const comments = await changeRequestComments.listChangeRequestCommentsFunc( args.organizationId, args.repositoryId, args.localId, args.patchSetBizIds ?? undefined, args.commentType, args.state, args.resolved, args.filePath ?? undefined ); return { content: [{ type: "text", text: JSON.stringify(comments, null, 2) }], }; }
- tool-registry/code-management.ts:100-103 (registration)Tool registration in the code-management tools array, specifying name, description, and input schema.name: "list_change_request_comments", description: "[Code Management] List comments on a change request", inputSchema: zodToJsonSchema(types.ListChangeRequestCommentsSchema), },
- operations/codeup/types.ts:378-387 (schema)Zod schema definition for the tool's input parameters, including organizationId, repositoryId, localId, and optional filters.export const ListChangeRequestCommentsSchema = z.object({ organizationId: z.string().describe("Organization ID, can be found in the basic information page of the organization admin console"), repositoryId: z.string().describe("Repository ID or a combination of organization ID and repository name, for example: 2835387 or organizationId%2Frepo-name (Note: slashes need to be URL encoded as %2F)"), localId: z.string().describe("Change request local ID"), patchSetBizIds: z.array(z.string()).nullable().optional().describe("Associated version ID list, each comment is associated with a version, indicating which version the comment was posted on, for global comments, it's associated with the latest merge source version"), commentType: z.string().optional().default("GLOBAL_COMMENT").describe("Comment type. Possible values: GLOBAL_COMMENT, INLINE_COMMENT"), state: z.string().optional().default("OPENED").describe("Comment state. Possible values: OPENED, DRAFT"), resolved: z.boolean().optional().default(false).describe("Whether marked as resolved"), filePath: z.string().nullable().optional().describe("Filter by file path (for inline comments)"), });
- Core helper function that performs the actual API call to list change request comments using yunxiaoRequest, parses the response with ChangeRequestCommentSchema.export async function listChangeRequestCommentsFunc( organizationId: string, repositoryId: string, localId: string, patchSetBizIds?: string[], commentType: string = "GLOBAL_COMMENT", // Possible values: GLOBAL_COMMENT, INLINE_COMMENT state: string = "OPENED", // Possible values: OPENED, DRAFT resolved: boolean = false, filePath?: string ): Promise<z.infer<typeof ChangeRequestCommentSchema>[]> { const encodedRepoId = handleRepositoryIdEncoding(repositoryId); const url = `/oapi/v1/codeup/organizations/${organizationId}/repositories/${encodedRepoId}/changeRequests/${localId}/comments/list`; // 准备payload const payload: Record<string, any> = { patchSetBizIds: patchSetBizIds || [], commentType: commentType, state: state, resolved: resolved, }; // 添加可选参数 if (filePath) { payload.filePath = filePath; } const response = await yunxiaoRequest(url, { method: "POST", body: payload, }); // 确保响应是数组 if (!Array.isArray(response)) { return []; } // 解析每个评论对象 return response.map(comment => ChangeRequestCommentSchema.parse(comment)); }