Skip to main content
Glama
aliyun

AlibabaCloud DevOps MCP Server

Official
by aliyun

get_file_blobs

Retrieve file content from Alibaba Cloud Codeup repositories using organization ID, repository ID, file path, and branch reference for code management workflows.

Instructions

[Code Management] Get file content 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
refYesReference name, usually branch name, can be branch name, tag name or commit SHA. If not provided, the default branch of the repository will be used, such as master

Implementation Reference

  • Handler case in handleCodeManagementTools function that validates input with GetFileBlobsSchema and invokes files.getFileBlobsFunc to retrieve file contents, then returns JSON stringified response.
    case "get_file_blobs": {
      const args = types.GetFileBlobsSchema.parse(request.params.arguments);
      const fileContent = await files.getFileBlobsFunc(
        args.organizationId,
        args.repositoryId,
        args.filePath,
        args.ref
      );
      return {
        content: [{ type: "text", text: JSON.stringify(fileContent, null, 2) }],
      };
    }
  • Core implementation function getFileBlobsFunc that encodes paths, constructs API URL, makes GET request to Codeup API for file content, and parses response with FileContentSchema.
    export async function getFileBlobsFunc(
      organizationId: string,
      repositoryId: string,
      filePath: string,
      ref: string
    ): Promise<z.infer<typeof FileContentSchema>> {
      // const { encodedRepoId, encodedFilePath } = handlePathEncoding(repositoryId, filePath);
      let encodedRepoId = repositoryId;
      let encodedFilePath = filePath;
      // 自动处理repositoryId中未编码的斜杠
      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> = {
        ref: ref
      };
    
      // 使用buildUrl函数构建包含查询参数的URL
      const url = buildUrl(baseUrl, queryParams);
    
      const response = await yunxiaoRequest(url, {
        method: "GET",
      });
    
      return FileContentSchema.parse(response);
    }
  • Tool registration entry in getCodeManagementTools array, specifying name, description, and input schema derived from GetFileBlobsSchema.
    {
      name: "get_file_blobs",
      description: "[Code Management] Get file content from a Codeup repository",
      inputSchema: zodToJsonSchema(types.GetFileBlobsSchema),
    },
  • Zod input schema definition for get_file_blobs tool parameters: organizationId, repositoryId, filePath, ref.
    export const GetFileBlobsSchema = 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"),
      ref: z.string().describe("Reference name, usually branch name, can be branch name, tag name or commit SHA. If not provided, the default branch of the repository will be used, such as master"),
    });
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions 'Get file content' but doesn't disclose behavioral traits such as rate limits, authentication requirements, error handling (e.g., for missing files), or return format (e.g., text vs. binary). This is inadequate for a tool with no annotation coverage.

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 waste. It front-loads the domain context and core action, making it easy to parse. Every word earns its place.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., file content as text, metadata, or error responses), which is critical for a 'get' operation. For a tool with 4 required parameters and no structured output, more context is needed.

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 the schema fully documents all four parameters. The description adds no additional parameter semantics beyond implying 'filePath' is for content retrieval. Baseline score of 3 is appropriate as 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 ('Get file content') and resource ('from a Codeup repository') with a specific domain context ('[Code Management]'). It distinguishes from siblings like 'get_branch' or 'get_commit' by focusing on file content retrieval. However, it doesn't explicitly differentiate from 'list_files' which might list files without content.

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 'list_files' (for file listings) or 'get_commit' (for commit details). It lacks context about prerequisites (e.g., needing repository access) or exclusions (e.g., not for binary files).

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