Skip to main content
Glama
aliyun

AlibabaCloud DevOps MCP Server

Official
by aliyun

delete_branch

Remove branches from Codeup repositories to maintain clean codebases and manage development workflows in Alibaba Cloud DevOps.

Instructions

[Code Management] Delete a branch from 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 (use URL-Encoder for encoding, example: feature%2Fdev)

Implementation Reference

  • Handler case for the delete_branch tool. Parses input arguments using DeleteBranchSchema and delegates to branches.deleteBranchFunc, returning the result as JSON text.
    case "delete_branch": {
      const args = types.DeleteBranchSchema.parse(request.params.arguments);
      const result = await branches.deleteBranchFunc(
        args.organizationId,
        args.repositoryId,
        args.branchName
      );
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
  • Zod schema defining the input parameters for the delete_branch tool: organizationId, repositoryId, and branchName.
    export const DeleteBranchSchema = 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 (use URL-Encoder for encoding, example: feature%2Fdev)"),
    });
  • Tool registration entry for delete_branch, including name, description, and input schema reference.
      name: "delete_branch",
      description: "[Code Management] Delete a branch from a Codeup repository",
      inputSchema: zodToJsonSchema(types.DeleteBranchSchema),
    },
  • Core implementation function deleteBranchFunc that constructs the API URL (handling URL encoding for repositoryId and branchName) and makes a DELETE request to the Codeup API to delete the branch.
    export async function deleteBranchFunc(
        organizationId: string,
        repositoryId: string,
        branchName: string
    ): Promise<DeleteBranchResponse> {
      // 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: "DELETE",
      });
    
      return {
        branchName: branchName
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Delete' implies a destructive mutation, the description doesn't specify whether this requires special permissions, if deletion is permanent/reversible, what happens to associated data, or any rate limits/constraints. It provides minimal behavioral context beyond the obvious destructive nature.

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 extremely concise (one sentence) and front-loaded with the core action. However, it's arguably too brief for a destructive operation with no annotations, leaving important behavioral details unspecified that could justify additional explanation.

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?

For a destructive mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after deletion, error conditions, permissions required, or consequences. The context signals show 3 required parameters with good schema coverage, but the behavioral aspects are critically under-specified.

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?

Schema description coverage is 100%, so all parameters are documented in the schema. The description adds no additional parameter semantics beyond what's already in the schema (organizationId, repositoryId, branchName). The baseline score of 3 reflects adequate coverage through schema alone.

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 ('Delete') and resource ('a branch from a Codeup repository'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'delete_file' or explain what distinguishes branch deletion from other deletion operations in this context.

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 like 'delete_file' or other destructive operations. It mentions the category '[Code Management]' but gives no specific context about prerequisites, when deletion is appropriate, or what happens after deletion.

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