get_change_request
Retrieve details about a specific merge request in Alibaba Cloud DevOps repositories to track code changes and review status.
Instructions
[Code Management] Get information about 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 | Local ID, represents the nth merge request in the repository |
Implementation Reference
- tool-handlers/code-management.ts:185-195 (handler)MCP tool handler for 'get_change_request': parses arguments using the schema and calls the core getChangeRequestFunc implementation.case "get_change_request": { const args = types.GetChangeRequestSchema.parse(request.params.arguments); const changeRequest = await changeRequests.getChangeRequestFunc( args.organizationId, args.repositoryId, args.localId ); return { content: [{ type: "text", text: JSON.stringify(changeRequest, null, 2) }], }; }
- tool-registry/code-management.ts:79-83 (registration)Tool registration entry for 'get_change_request' including name, description, and input schema reference.{ name: "get_change_request", description: "[Code Management] Get information about a change request", inputSchema: zodToJsonSchema(types.GetChangeRequestSchema), },
- operations/codeup/types.ts:319-323 (schema)Zod input schema definition for validating arguments to the get_change_request tool.export const GetChangeRequestSchema = 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"), });
- Core helper function that encodes the repository ID, constructs the API URL, fetches the change request data via yunxiaoRequest, and parses the response using ChangeRequestSchema.export async function getChangeRequestFunc( organizationId: string, repositoryId: string, localId: string ): Promise<z.infer<typeof ChangeRequestSchema>> { const encodedRepoId = handleRepositoryIdEncoding(repositoryId); const url = `/oapi/v1/codeup/organizations/${organizationId}/repositories/${encodedRepoId}/changeRequests/${localId}`; const response = await yunxiaoRequest(url, { method: "GET", }); return ChangeRequestSchema.parse(response); }
- operations/codeup/types.ts:158-216 (schema)Zod output schema (ChangeRequestSchema) used to parse and validate the API response for the change request data.export const ChangeRequestSchema = z.object({ ahead: z.number().int().nullable().optional().describe("源分支领先目标分支的commit数量"), allRequirementsPass: z.boolean().nullable().optional().describe("是否所有卡点项通过"), author: z.object({ avatar: z.string().nullable().optional().describe("用户头像地址"), email: z.string().nullable().optional().describe("用户邮箱"), name: z.string().nullable().optional().describe("用户名称"), state: z.string().nullable().optional().describe("用户状态:active - 激活可用;blocked - 阻塞暂不可用"), userId: z.string().nullable().optional().describe("云效用户ID"), username: z.string().nullable().optional().describe("用户登录名") }).nullable().optional().describe("创建者信息"), behind: z.number().int().nullable().optional().describe("目标分支领先源分支的commit数量"), canRevertOrCherryPick: z.boolean().nullable().optional().describe("是否能Revert或者CherryPick"), conflictCheckStatus: z.string().nullable().optional().describe("冲突检测状态:CHECKING - 检测中;HAS_CONFLICT - 有冲突;NO_CONFLICT - 无冲突;FAILED - 检测失败"), createFrom: z.string().nullable().optional().describe("创建来源:WEB - 页面创建;COMMAND_LINE - 命令行创建"), createTime: z.string().nullable().optional().describe("创建时间 (ISO 8601格式)"), description: z.string().nullable().optional().describe("描述"), detailUrl: z.string().nullable().optional().describe("合并请求详情地址"), hasReverted: z.boolean().nullable().optional().describe("是否Revert过"), localId: z.union([z.string(), z.number().int()]).nullable().optional().describe("局部ID,表示代码库中第几个合并请求"), mergedRevision: z.string().nullable().optional().describe("合并版本(提交ID),仅已合并状态才有值"), mrType: z.string().nullable().optional().describe("合并请求类型"), projectId: z.number().int().nullable().optional().describe("项目ID"), reviewers: z.array(z.object({ avatar: z.string().nullable().optional().describe("用户头像地址"), email: z.string().nullable().optional().describe("用户邮箱"), hasCommented: z.boolean().nullable().optional().describe("是否已评论"), hasReviewed: z.boolean().nullable().optional().describe("是否已审阅"), name: z.string().nullable().optional().describe("用户名称"), reviewOpinionStatus: z.string().nullable().optional().describe("审阅意见状态"), reviewTime: z.string().nullable().optional().describe("审阅时间 (ISO 8601格式)"), state: z.string().nullable().optional().describe("用户状态"), userId: z.string().nullable().optional().describe("云效用户ID"), username: z.string().nullable().optional().describe("用户登录名") })).nullable().optional().describe("评审人列表"), sourceBranch: z.string().nullable().optional().describe("源分支"), sourceCommitId: z.string().nullable().optional().describe("源提交ID,当createFrom=COMMAND_LINE时有值"), sourceProjectId: z.union([z.string(), z.number().int()]).nullable().optional().describe("源库ID"), sourceRef: z.string().nullable().optional().describe("源提交引用,当createFrom=COMMAND_LINE时有值"), status: z.string().nullable().optional().describe("合并请求状态:UNDER_DEV - 开发中;UNDER_REVIEW - 评审中;TO_BE_MERGED - 待合并;CLOSED - 已关闭;MERGED - 已合并"), subscribers: z.array(z.object({ avatar: z.string().nullable().optional().describe("用户头像地址"), email: z.string().nullable().optional().describe("用户邮箱"), name: z.string().nullable().optional().describe("用户名称"), state: z.string().nullable().optional().describe("用户状态"), userId: z.string().nullable().optional().describe("云效用户ID"), username: z.string().nullable().optional().describe("用户登录名") })).nullable().optional().describe("订阅人列表"), supportMergeFastForwardOnly: z.boolean().nullable().optional().describe("是否支持fast-forward-only"), targetBranch: z.string().nullable().optional().describe("目标分支"), targetProjectId: z.union([z.string(), z.number().int()]).nullable().optional().describe("目标库ID"), targetProjectNameWithNamespace: z.string().nullable().optional().describe("目标库名称(含完整父路径)"), targetProjectPathWithNamespace: z.string().nullable().optional().describe("目标库路径(含完整父路径)"), title: z.string().nullable().optional().describe("标题"), totalCommentCount: z.number().int().nullable().optional().describe("总评论数"), unResolvedCommentCount: z.number().int().nullable().optional().describe("未解决评论数"), updateTime: z.string().nullable().optional().describe("更新时间 (ISO 8601格式)"), webUrl: z.string().nullable().optional().describe("页面地址") });