Skip to main content
Glama
aliyun

AlibabaCloud DevOps MCP Server

Official
by aliyun

get_branch

Retrieve branch details from Alibaba Cloud Codeup repositories to access commit history, permissions, and metadata for development workflows.

Instructions

[Code Management] Get information about a branch in a Codeup repository

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)
branchNameYesBranch name (if it contains special characters, use URL encoding), example: master or feature%2Fdev

Implementation Reference

  • Handler for the 'get_branch' tool. Parses input arguments and delegates to getBranchFunc to retrieve branch details.
    case "get_branch": {
      const args = types.GetBranchSchema.parse(request.params.arguments);
      const branch = await branches.getBranchFunc(
        args.organizationId,
        args.repositoryId,
        args.branchName
      );
      return {
        content: [{ type: "text", text: JSON.stringify(branch, null, 2) }],
      };
    }
  • Registration of the 'get_branch' tool, specifying name, description, and input schema.
      name: "get_branch",
      description: "[Code Management] Get information about a branch in a Codeup repository",
      inputSchema: zodToJsonSchema(types.GetBranchSchema),
    },
  • Zod schema definition for 'get_branch' tool input validation.
    export const GetBranchSchema = 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)"),
      branchName: z.string().describe("Branch name (if it contains special characters, use URL encoding), example: master or feature%2Fdev"),
    });
  • Core implementation function that handles URL encoding for repositoryId and branchName, makes GET request to Codeup API, and parses response with CodeupBranchSchema.
    export async function getBranchFunc(
        organizationId: string,
        repositoryId: string,
        branchName: string
    ): Promise<z.infer<typeof CodeupBranchSchema>>{
      // Automatically handle unencoded slashes in repositoryId
      if (repositoryId.includes("/")) {
        // Found unencoded slash, automatically URL encode it
        const parts = repositoryId.split("/", 2);
        if (parts.length === 2) {
          const encodedRepoName = encodeURIComponent(parts[1]);
          // Remove + signs from encoding (spaces are encoded as +, but we need %20)
          const formattedEncodedName = encodedRepoName.replace(/\+/g, "%20");
          repositoryId = `${parts[0]}%2F${formattedEncodedName}`;
        }
      }
    
      // Automatically handle unencoded slashes in branchName
      if (branchName.includes("/")) {
        branchName = encodeURIComponent(branchName);
      }
    
      const url = `/oapi/v1/codeup/organizations/${organizationId}/repositories/${repositoryId}/branches/${branchName}`;
    
      const response = await yunxiaoRequest(url, {
        method: "GET",
      });
      return CodeupBranchSchema.parse(response);
    }
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It only states the action ('Get information') without details on permissions, rate limits, error handling, or return format. For a read operation with no annotation coverage, this is insufficient, as it omits critical 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?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it highly concise and well-structured for quick understanding.

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?

Given the complexity of a read operation with no annotations and no output schema, the description is incomplete. It lacks information on what specific branch information is returned, error conditions, or authentication needs. For a tool with three parameters and no structured output, more context is needed to be fully helpful.

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?

The input schema has 100% description coverage, clearly documenting all three required parameters. The description adds no additional meaning beyond the schema, such as examples or constraints. With high schema coverage, the baseline score of 3 is appropriate, as the schema handles parameter documentation adequately.

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 tool's purpose: 'Get information about a branch in a Codeup repository.' It specifies the verb ('Get information') and resource ('branch'), but does not differentiate from sibling tools like 'list_branches' or 'get_commit', which could retrieve similar or related information. This makes it clear but not fully distinct.

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?

The description provides no guidance on when to use this tool versus alternatives. It does not mention sibling tools like 'list_branches' for listing multiple branches or 'get_commit' for commit details, nor does it specify prerequisites or exclusions. This lack of context leaves usage ambiguous.

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