Skip to main content
Glama
aliyun

AlibabaCloud DevOps MCP Server

Official
by aliyun

create_branch

Create a new branch in a Codeup repository to organize development work, using a source branch as the starting point for changes.

Instructions

[Code Management] Create a new 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)
branchYesName of the branch to be created
refNoSource branch name, the new branch will be created based on this branch, default value is mastermaster

Implementation Reference

  • MCP tool handler for 'create_branch': parses arguments using CreateBranchSchema and delegates to branches.createBranchFunc, returning the result as JSON text.
    case "create_branch": {
      const args = types.CreateBranchSchema.parse(request.params.arguments);
      const branch = await branches.createBranchFunc(
        args.organizationId,
        args.repositoryId,
        args.branch,
        args.ref
      );
      return {
        content: [{ type: "text", text: JSON.stringify(branch, null, 2) }],
      };
    }
  • Tool registration entry for 'create_branch' including name, description, and input schema derived from CreateBranchSchema.
    {
      name: "create_branch",
      description: "[Code Management] Create a new branch in a Codeup repository",
      inputSchema: zodToJsonSchema(types.CreateBranchSchema),
    },
  • Zod input schema definition for create_branch tool parameters: organizationId, repositoryId, branch, ref.
    export const CreateBranchSchema = 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)"),
      branch: z.string().describe("Name of the branch to be created"),
      ref: z.string().default("master").describe("Source branch name, the new branch will be created based on this branch, default value is master"),
    });
  • Core helper function createBranchFunc that constructs the API URL, handles repositoryId encoding, makes POST request to create branch, and parses response with CodeupBranchSchema.
    export async function createBranchFunc(
        organizationId: string,
        repositoryId: string,
        branch: string,
        ref: string = "master"
    ): 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}`;
        }
      }
    
      const baseUrl = `/oapi/v1/codeup/organizations/${organizationId}/repositories/${repositoryId}/branches`;
    
      // Build query parameters
      const queryParams: Record<string, string | number | undefined> = {
        branch: branch,
        ref: ref
      };
    
      const url = buildUrl(baseUrl, queryParams);
      console.error("createBranchFunc url:" + url);
    
      const response = await yunxiaoRequest(url, {
        method: "POST",
      });
      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 carries full burden for behavioral disclosure. It states the tool creates a branch, implying a write/mutation operation, but fails to mention critical behavioral aspects: whether it requires specific permissions, if it's idempotent (e.g., handling existing branch names), what happens on success/failure, or any rate limits. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. However, it could be slightly more structured by including key behavioral hints (e.g., 'mutates repository state') to improve clarity, but it avoids redundancy and waste.

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 mutation tool with no annotations and no output schema, the description is incomplete. It doesn't cover behavioral traits (e.g., permissions, idempotency), usage context, or expected outcomes, leaving the agent with insufficient information to invoke it safely and effectively in a real-world scenario.

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 schema description coverage is 100%, with all parameters well-documented in the input schema (e.g., organizationId, repositoryId, branch, ref with default). The description adds no additional parameter semantics beyond what's in the schema, such as explaining relationships between parameters or usage examples. Baseline 3 is appropriate when the schema does the heavy lifting.

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 new branch') and resource ('in a Codeup repository'), which is specific and unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'create_file' or 'delete_branch' beyond the obvious resource difference, missing an opportunity to clarify its unique role in branch management versus other creation operations.

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 doesn't mention prerequisites (e.g., needing an existing repository or source branch), compare to similar tools like 'list_branches' or 'get_branch', or specify scenarios where it's appropriate (e.g., starting new feature development). This leaves the agent without context for selection among siblings.

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