list_change_requests
Retrieve and filter change requests from Alibaba Cloud DevOps projects to track code modifications, review status, and author activity.
Instructions
[Code Management] List change requests
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 | |
| page | No | Page number | |
| perPage | No | Items per page | |
| projectIds | No | Repository ID or a combination of organization ID and repository name list, for example: 2835387 or organizationId%2Frepo-name (Note: slashes need to be URL encoded as %2F), multiple separated by commas | |
| authorIds | No | Creator user ID list, multiple separated by commas | |
| reviewerIds | No | Reviewer user ID list, multiple separated by commas | |
| state | No | Merge request filter status. Possible values: opened, merged, closed. Default is null, which queries all statuses | |
| search | No | Title keyword search | |
| orderBy | No | Sort field. Possible values: created_at (creation time), updated_at (update time, default) | updated_at |
| sort | No | Sort order. Possible values: asc (ascending), desc (descending, default) | desc |
| createdBefore | No | Start creation time, time format is ISO 8601, for example: 2019-03-15T08:00:00Z | |
| createdAfter | No | End creation time, time format is ISO 8601, for example: 2019-03-15T08:00:00Z |
Implementation Reference
- tool-handlers/code-management.ts:197-216 (handler)The handler function for the 'list_change_requests' tool. It parses the input arguments using the schema, calls the listChangeRequestsFunc helper, and returns the result as a JSON string in the response content.case "list_change_requests": { const args = types.ListChangeRequestsSchema.parse(request.params.arguments); const changeRequestList = await changeRequests.listChangeRequestsFunc( args.organizationId, args.page, args.perPage, args.projectIds ?? undefined, args.authorIds ?? undefined, args.reviewerIds ?? undefined, args.state ?? undefined, args.search ?? undefined, args.orderBy, args.sort, args.createdBefore ?? undefined, args.createdAfter ?? undefined ); return { content: [{ type: "text", text: JSON.stringify(changeRequestList, null, 2) }], }; }
- operations/codeup/types.ts:325-338 (schema)Zod schema defining the input parameters for the list_change_requests tool, including organizationId, pagination, filters, sorting, etc.export const ListChangeRequestsSchema = z.object({ organizationId: z.string().describe("Organization ID, can be found in the basic information page of the organization admin console"), page: z.number().int().default(1).optional().describe("Page number"), perPage: z.number().int().default(20).optional().describe("Items per page"), projectIds: z.string().nullable().optional().describe("Repository ID or a combination of organization ID and repository name list, for example: 2835387 or organizationId%2Frepo-name (Note: slashes need to be URL encoded as %2F), multiple separated by commas"), authorIds: z.string().nullable().optional().describe("Creator user ID list, multiple separated by commas"), reviewerIds: z.string().nullable().optional().describe("Reviewer user ID list, multiple separated by commas"), state: z.string().nullable().optional().describe("Merge request filter status. Possible values: opened, merged, closed. Default is null, which queries all statuses"), search: z.string().nullable().optional().describe("Title keyword search"), orderBy: z.string().default("updated_at").optional().describe("Sort field. Possible values: created_at (creation time), updated_at (update time, default)"), sort: z.string().default("desc").optional().describe("Sort order. Possible values: asc (ascending), desc (descending, default)"), createdBefore: z.string().nullable().optional().describe("Start creation time, time format is ISO 8601, for example: 2019-03-15T08:00:00Z"), createdAfter: z.string().nullable().optional().describe("End creation time, time format is ISO 8601, for example: 2019-03-15T08:00:00Z"), });
- tool-registry/code-management.ts:84-88 (registration)Tool registration entry for 'list_change_requests', specifying name, description, and input schema.{ name: "list_change_requests", description: "[Code Management] List change requests", inputSchema: zodToJsonSchema(types.ListChangeRequestsSchema), },
- The helper function that constructs the API URL with query parameters and fetches the list of change requests from the Codeup API, parsing the response with ChangeRequestSchema.export async function listChangeRequestsFunc( organizationId: string, page?: number, perPage?: number, projectIds?: string, authorIds?: string, reviewerIds?: string, state?: string, // Possible values: opened, merged, closed search?: string, orderBy?: string, // Possible values: created_at, updated_at sort?: string, // Possible values: asc, desc createdBefore?: string, createdAfter?: string ): Promise<z.infer<typeof ChangeRequestSchema>[]> { const baseUrl = `/oapi/v1/codeup/organizations/${organizationId}/changeRequests`; // 构建查询参数 const queryParams: Record<string, string | number | undefined> = {}; if (page !== undefined) { queryParams.page = page; } if (perPage !== undefined) { queryParams.perPage = perPage; } if (projectIds !== undefined) { queryParams.projectIds = projectIds; } if (authorIds !== undefined) { queryParams.authorIds = authorIds; } if (reviewerIds !== undefined) { queryParams.reviewerIds = reviewerIds; } if (state !== undefined) { queryParams.state = state; } if (search !== undefined) { queryParams.search = search; } if (orderBy !== undefined) { queryParams.orderBy = orderBy; } if (sort !== undefined) { queryParams.sort = sort; } if (createdBefore !== undefined) { queryParams.createdBefore = createdBefore; } if (createdAfter !== undefined) { queryParams.createdAfter = createdAfter; } // 使用buildUrl函数构建包含查询参数的URL const url = buildUrl(baseUrl, queryParams); const response = await yunxiaoRequest(url, { method: "GET", }); // 确保响应是数组 if (!Array.isArray(response)) { return []; } // 解析每个变更请求对象 return response.map(changeRequest => ChangeRequestSchema.parse(changeRequest)); }