Skip to main content
Glama
aliyun

AlibabaCloud DevOps MCP Server

Official
by aliyun

create_change_request_comment

Add comments to code change requests in Alibaba Cloud DevOps for review, feedback, or issue tracking during development workflows.

Instructions

[Code Management] Create a comment 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)
localIdYesLocal ID, represents the nth merge request in the repository
comment_typeNoComment type. Possible values: GLOBAL_COMMENT, INLINE_COMMENTGLOBAL_COMMENT
contentYesComment content, length must be between 1 and 65535
draftNoWhether it is a draft comment
resolvedNoWhether to mark as resolved
patchset_biz_idYesAssociated version ID, if it's INLINE_COMMENT, choose one from from_patchset_biz_id or to_patchset_biz_id
file_pathNoFile name, only for inline comments
line_numberNoLine number, only for inline comments
from_patchset_biz_idNoStart version ID for comparison, required for INLINE_COMMENT type
to_patchset_biz_idNoTarget version ID for comparison, required for INLINE_COMMENT type
parent_comment_biz_idNoParent comment ID

Implementation Reference

  • The MCP tool handler switch case that parses the input arguments with CreateChangeRequestCommentSchema and invokes the createChangeRequestCommentFunc to execute the API call for creating a change request comment, returning the result as formatted JSON.
    case "create_change_request_comment": {
      const args = types.CreateChangeRequestCommentSchema.parse(request.params.arguments);
      const comment = await changeRequestComments.createChangeRequestCommentFunc(
        args.organizationId,
        args.repositoryId,
        args.localId,
        args.comment_type,
        args.content,
        args.draft,
        args.resolved,
        args.patchset_biz_id,
        args.file_path ?? undefined,
        args.line_number ?? undefined,
        args.from_patchset_biz_id ?? undefined,
        args.to_patchset_biz_id ?? undefined,
        args.parent_comment_biz_id ?? undefined
      );
      return {
        content: [{ type: "text", text: JSON.stringify(comment, null, 2) }],
      };
    }
  • Zod schema defining the input validation for the create_change_request_comment tool parameters.
    export const CreateChangeRequestCommentSchema = 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("Local ID, represents the nth merge request in the repository"),
      comment_type: z.string().default("GLOBAL_COMMENT").describe("Comment type. Possible values: GLOBAL_COMMENT, INLINE_COMMENT"),
      content: z.string().describe("Comment content, length must be between 1 and 65535"),
      draft: z.boolean().default(false).describe("Whether it is a draft comment"),
      resolved: z.boolean().default(false).describe("Whether to mark as resolved"),
      patchset_biz_id: z.string().describe("Associated version ID, if it's INLINE_COMMENT, choose one from from_patchset_biz_id or to_patchset_biz_id"),
      file_path: z.string().nullable().optional().describe("File name, only for inline comments"),
      line_number: z.number().int().nullable().optional().describe("Line number, only for inline comments"),
      from_patchset_biz_id: z.string().nullable().optional().describe("Start version ID for comparison, required for INLINE_COMMENT type"),
      to_patchset_biz_id: z.string().nullable().optional().describe("Target version ID for comparison, required for INLINE_COMMENT type"),
      parent_comment_biz_id: z.string().nullable().optional().describe("Parent comment ID"),
    });
  • Tool registration entry in the code-management tool registry, defining the tool name, description, and input schema.
      name: "create_change_request_comment",
      description: "[Code Management] Create a comment on a change request",
      inputSchema: zodToJsonSchema(types.CreateChangeRequestCommentSchema),
    },
  • Supporting function that builds the API payload conditionally based on comment type (GLOBAL_COMMENT or INLINE_COMMENT), encodes repository ID, makes POST request to Codeup API to create the comment, and parses the response.
    export async function createChangeRequestCommentFunc(
      organizationId: string,
      repositoryId: string,
      localId: string,
      comment_type: string, // Possible values: GLOBAL_COMMENT, INLINE_COMMENT
      content: string,
      draft: boolean,
      resolved: boolean,
      patchset_biz_id: string,
      file_path?: string,
      line_number?: number,
      from_patchset_biz_id?: string,
      to_patchset_biz_id?: string,
      parent_comment_biz_id?: string
    ): Promise<z.infer<typeof ChangeRequestCommentSchema>> {
      const encodedRepoId = handleRepositoryIdEncoding(repositoryId);
    
      const url = `/oapi/v1/codeup/organizations/${organizationId}/repositories/${encodedRepoId}/changeRequests/${localId}/comments`;
    
      // 准备payload
      const payload: Record<string, any> = {
        comment_type: comment_type,
        content: content,
        draft: draft,
        resolved: resolved,
        patchset_biz_id: patchset_biz_id,
      };
    
      // 根据评论类型添加必要参数
      if (comment_type === "INLINE_COMMENT") {
        // 检查INLINE_COMMENT必需的参数
        if (!file_path || line_number === undefined || !from_patchset_biz_id || !to_patchset_biz_id) {
          throw new Error("For INLINE_COMMENT, file_path, line_number, from_patchset_biz_id, and to_patchset_biz_id are required");
        }
    
        payload.file_path = file_path;
        payload.line_number = line_number;
        payload.from_patchset_biz_id = from_patchset_biz_id;
        payload.to_patchset_biz_id = to_patchset_biz_id;
      }
    
      // 添加可选参数
      if (parent_comment_biz_id) {
        payload.parent_comment_biz_id = parent_comment_biz_id;
      }
    
      const response = await yunxiaoRequest(url, {
        method: "POST",
        body: payload,
      });
    
      return ChangeRequestCommentSchema.parse(response);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states the basic action. It doesn't disclose whether this is a mutating operation (implied by 'Create'), what permissions are required, whether comments are editable/deletable, rate limits, or response format. For a tool with 13 parameters and no annotation coverage, this is a significant gap in behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise single sentence with zero waste. The domain context hint is front-loaded, and the core action is stated clearly. Every word earns its place in this minimal description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tool with 13 parameters, 5 required parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what a 'change request' is in this context, doesn't describe the return value or success/failure behavior, and provides minimal behavioral context. The 100% schema coverage helps but doesn't compensate for the missing operational context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 13 parameters thoroughly. The description adds no additional parameter information beyond what's in the schema. Baseline 3 is appropriate when schema does the heavy lifting, though the description could have explained relationships between parameters like comment_type and its dependent fields.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create a comment') and target ('on a change request') with a domain context hint ('[Code Management]'). It distinguishes from sibling 'create_work_item_comment' by specifying 'change request' instead of 'work item', but doesn't explicitly differentiate from 'create_commit_comment' or other comment tools, keeping it at 4 rather than 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like 'create_work_item_comment' or 'create_commit_comment'. The description provides basic context but lacks explicit when/when-not instructions or prerequisite information about change request states or permissions needed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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