Skip to main content
Glama
aliyun

AlibabaCloud DevOps MCP Server

Official
by aliyun

delete_file

Remove files from Alibaba Cloud Codeup repositories to manage code changes and maintain repository organization.

Instructions

[Code Management] Delete a file 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)
filePathYesFile path, needs to be URL encoded, for example: /src/main/java/com/aliyun/test.java
commitMessageYesCommit message
branchYesBranch name

Implementation Reference

  • Handler for the 'delete_file' tool: parses input arguments using DeleteFileSchema and calls the deleteFileFunc helper to perform the deletion, then returns the result as JSON.
    case "delete_file": {
      const args = types.DeleteFileSchema.parse(request.params.arguments);
      const result = await files.deleteFileFunc(
        args.organizationId,
        args.repositoryId,
        args.filePath,
        args.commitMessage,
        args.branch
      );
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
  • Registers the 'delete_file' tool in the code management tools array, specifying name, description, and input schema.
    {
      name: "delete_file",
      description: "[Code Management] Delete a file from a Codeup repository",
      inputSchema: zodToJsonSchema(types.DeleteFileSchema),
    },
  • Core helper function that encodes parameters, constructs the API URL, sends DELETE request to Codeup API to delete the file, and parses the response.
    export async function deleteFileFunc(
      organizationId: string,
      repositoryId: string,
      filePath: string,
      commitMessage: string,
      branch: string
    ): Promise<z.infer<typeof DeleteFileResponseSchema>> {
      let encodedRepoId = repositoryId;
      let encodedFilePath = filePath;
    
      if (repositoryId.includes("/")) {
        // 发现未编码的斜杠,自动进行URL编码
        const parts = repositoryId.split("/", 2);
        if (parts.length === 2) {
          const encodedRepoName = encodeURIComponent(parts[1]);
          // 移除编码中的+号(空格被编码为+,但我们需要%20)
          const formattedEncodedName = encodedRepoName.replace(/\+/g, "%20");
          encodedRepoId = `${parts[0]}%2F${formattedEncodedName}`;
        }
      }
    
      // 确保filePath已被URL编码
      if (filePath.includes("/")) {
        encodedFilePath = encodeURIComponent(filePath);
      }
    
      const baseUrl = `/oapi/v1/codeup/organizations/${organizationId}/repositories/${encodedRepoId}/files/${encodedFilePath}`;
      
      // 构建查询参数
      const queryParams: Record<string, string | number | undefined> = {
        branch: branch,
        commitMessage: commitMessage
      };
    
      // 使用buildUrl函数构建包含查询参数的URL
      const url = buildUrl(baseUrl, queryParams);
    
      const response = await yunxiaoRequest(url, {
        method: "DELETE",
      });
    
      return DeleteFileResponseSchema.parse(response);
    }
  • Zod schema defining the input parameters for the delete_file tool: organizationId, repositoryId, filePath, commitMessage, branch.
    export const DeleteFileSchema = 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)"),
      filePath: z.string().describe("File path, needs to be URL encoded, for example: /src/main/java/com/aliyun/test.java"),
      commitMessage: z.string().describe("Commit message"),
      branch: z.string().describe("Branch name"),
    });
Behavior2/5

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

With no annotations provided, the description carries full burden but only mentions it's a deletion operation. It lacks critical behavioral details such as whether deletion is permanent, requires specific permissions, affects version history, or has side effects like triggering workflows. This is inadequate for a destructive mutation tool.

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 with zero wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly.

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 the deletion's impact, return values, error conditions, or how it interacts with version control (e.g., commits). This leaves significant gaps for safe and effective use.

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 implying 'filePath' is the target, which is already clear from the schema. This meets the baseline for high schema coverage.

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 target ('a file from a Codeup repository'), making the purpose unambiguous. However, it doesn't differentiate from sibling tools like 'delete_branch' or 'update_file' beyond the resource type, which prevents a perfect score.

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?

No guidance is provided on when to use this tool versus alternatives like 'update_file' or 'create_file', nor are prerequisites or exclusions mentioned. The description only states what it does, not when it's appropriate.

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