Skip to main content
Glama
aliyun

AlibabaCloud DevOps MCP Server

Official
by aliyun

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
NameRequiredDescriptionDefault
organizationIdYesOrganization ID, can be found in the basic information page of the organization admin console
repositoryIdYesRepository 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)
localIdYesChange request local ID
patchSetBizIdsNoAssociated 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
commentTypeNoComment type. Possible values: GLOBAL_COMMENT, INLINE_COMMENTGLOBAL_COMMENT
stateNoComment state. Possible values: OPENED, DRAFTOPENED
resolvedNoWhether marked as resolved
filePathNoFilter by file path (for inline comments)

Implementation Reference

  • 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 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),
    },
  • 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));
    } 

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aliyun/alibabacloud-devops-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server