Skip to main content
Glama

list_repository_branches

Retrieve a list of branches in a specified repository by providing the owner, repository name, and optional pagination parameters for organized results.

Instructions

List branches in a repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner, typically referred to as 'username'. Case-insensitive.
pageNoPage number
per_pageNoNumber of results per page
repoYesRepository name. Case-insensitive.

Implementation Reference

  • The main handler function that implements the logic for listing repository branches by making an API request to AtomGit.
    /** * Retrieves lists of all branches of a repo. * @param owner - Repository owner * @param repo - Repository name * @param per_page - Number of items per page * @param page - Page number */ export async function getBranchList( owner: string, repo: string, page?: number, per_page?: number ) { const query = new URLSearchParams(); if (page) query.append("page", page.toString()); if (per_page) query.append("per_page", per_page.toString()); return atomGitRequest( `https://api.atomgit.com/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/branches?${query.toString()}`, { method: "GET", } ); }
  • Zod schema for input validation of the list_repository_branches tool parameters.
    export const ListBranchListSchema = z.object({ owner: z.string().describe("Repository owner, typically referred to as 'username'. Case-insensitive."), repo: z.string().describe("Repository name. Case-insensitive."), per_page: z.number().describe("Number of results per page").optional(), page: z.number().describe("Page number").optional(), });
  • index.ts:162-166 (registration)
    Registration of the list_repository_branches tool in the MCP server's tool list, providing name, description, and schema.
    { name: "list_repository_branches", description: "List branches in a repository", inputSchema: zodToJsonSchema(branch.ListBranchListSchema), },
  • index.ts:429-435 (registration)
    Dispatch case in the MCP server's callTool handler that invokes the branch.getBranchList function.
    case "list_repository_branches": { const args = branch.ListBranchListSchema.parse(request.params.arguments); const result = await branch.getBranchList(args.owner, args.repo, args.page, args.per_page); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }

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/kaiyuanxiaobing/atomgit-mcp-server'

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