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
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner, typically referred to as 'username'. Case-insensitive. | |
| page | No | Page number | |
| per_page | No | Number of results per page | |
| repo | Yes | Repository name. Case-insensitive. |
Implementation Reference
- operations/branch.ts:17-41 (handler)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", } ); }
- operations/branch.ts:4-9 (schema)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) }], }; }