Skip to main content
Glama
aliyun

AlibabaCloud DevOps MCP Server

Official
by aliyun

list_change_request_patch_sets

Retrieve patch sets for a specific change request in Alibaba Cloud DevOps to track code modifications and review updates during development.

Instructions

[Code Management] List patch sets for 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

Implementation Reference

  • MCP tool handler: parses arguments with ListChangeRequestPatchSetsSchema, calls listChangeRequestPatchSetsFunc, returns JSON stringified patch sets.
    case "list_change_request_patch_sets": {
      const args = types.ListChangeRequestPatchSetsSchema.parse(request.params.arguments);
      const patchSets = await changeRequests.listChangeRequestPatchSetsFunc(
        args.organizationId,
        args.repositoryId,
        args.localId
      );
    
      return {
        content: [{ type: "text", text: JSON.stringify(patchSets, null, 2) }],
      };
    }
  • Core implementation: encodes repository ID, calls API /changeRequests/{localId}/diffs/patches, parses response array with PatchSetSchema.
    export async function listChangeRequestPatchSetsFunc(
      organizationId: string,
      repositoryId: string,
      localId: string
    ): Promise<z.infer<typeof PatchSetSchema>[]> {
      const encodedRepoId = handleRepositoryIdEncoding(repositoryId);
    
      const url = `/oapi/v1/codeup/organizations/${organizationId}/repositories/${encodedRepoId}/changeRequests/${localId}/diffs/patches`;
    
      const response = await yunxiaoRequest(url, {
        method: "GET",
      });
    
      // 确保响应是数组
      if (!Array.isArray(response)) {
        return [];
      }
    
      // 解析每个版本对象
      return response.map(patchSet => PatchSetSchema.parse(patchSet));
    }
  • Tool registration: defines name, description, and converts Zod input schema to JSON schema.
    {
      name: "list_change_request_patch_sets",
      description: "[Code Management] List patch sets for a change request",
      inputSchema: zodToJsonSchema(types.ListChangeRequestPatchSetsSchema),
    },
  • Input schema definition using Zod: requires organizationId, repositoryId, localId with descriptions.
    export const ListChangeRequestPatchSetsSchema = 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"),
    });

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