Skip to main content
Glama

get_branch

Retrieve specific branch details from a Gitee repository by providing the owner, repository, and branch name for efficient repository management.

Instructions

获取 Gitee 仓库中的特定分支信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
branchYesBranch name
ownerYesRepository owner path (enterprise, organization, or personal path)
repoYesRepository path

Implementation Reference

  • Implements the core logic to retrieve specific branch information from the Gitee API. Validates inputs, constructs the API URL, makes the request, and parses the response using GiteeCompleteBranchSchema.
    export async function getBranch(owner: string, repo: string, branch: string) {
      owner = validateOwnerName(owner);
      repo = validateRepositoryName(repo);
      branch = validateBranchName(branch);
    
      const url = `/repos/${owner}/${repo}/branches/${branch}`;
      const response = await giteeRequest(url);
    
      return GiteeCompleteBranchSchema.parse(response);
    }
  • Zod schema defining the input parameters for the get_branch tool: owner, repo, and branch.
    export const GetBranchSchema = z.object({
      // 仓库所属空间地址 (企业、组织或个人的地址 path)
      owner: z.string().describe("Repository owner path (enterprise, organization, or personal path)"),
      // 仓库路径 (path)
      repo: z.string().describe("Repository path"),
      // 分支名称
      branch: z.string().describe("Branch name"),
    });
  • index.ts:89-97 (registration)
    Registers the 'get_branch' tool with the MCP server, specifying name, description, input schema from branchOperations, and a thin wrapper handler that calls the core getBranch function.
    server.registerTool({
      name: "get_branch",
      description: "获取 Gitee 仓库中的特定分支信息",
      schema: branchOperations.GetBranchSchema,
      handler: async (params: any) => {
        const { owner, repo, branch } = params;
        return await branchOperations.getBranch(owner, repo, branch);
      },
    });
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 '获取' (get) implies a read operation, the description doesn't specify what information is returned (commit details? protection rules? last update?), whether authentication is required, rate limits, error conditions, or response format. For a read operation with zero annotation coverage, this leaves significant behavioral gaps.

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 in Chinese that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple read operation and front-loads the essential information.

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 read operation with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what branch information is returned, the response format, error handling, or authentication requirements. Given the complexity of Git operations and the lack of structured output documentation, more context is needed for effective tool 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%, with all three parameters (owner, repo, branch) clearly documented in the schema. The description doesn't add any parameter semantics beyond what's already in the schema - it doesn't explain the relationship between owner/repo/branch, provide examples, or clarify edge cases. 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.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '获取 Gitee 仓库中的特定分支信息' clearly states the action (获取/get) and resource (分支信息/branch information) with a specific scope (Gitee repository). However, it doesn't distinguish this tool from 'list_branches' which is a sibling tool - the description implies this retrieves information about a specific branch rather than listing multiple branches, but this distinction isn't explicitly stated.

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 about when to use this tool versus alternatives. There's no mention of when to use 'get_branch' versus 'list_branches' (which appears in the sibling tools), nor any prerequisites or context for usage. The agent must infer usage from the tool name alone.

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

Related 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/normal-coder/gitee-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server