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); }, });

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