check_repo_branch
Retrieve the current git branch for a repository using its label or path to monitor development status and track active work.
Instructions
Get the current branch for a single repo by its label or path.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| identifier | Yes | Repo label or absolute path |
Implementation Reference
- src/tools/branches.ts:55-71 (handler)The implementation of the check_repo_branch tool. It looks up the repository by label or path in the configuration, retrieves the branch information using the getBranchInfo helper, and returns the result.
server.tool( "check_repo_branch", "Get the current branch for a single repo by its label or path.", { identifier: z.string().describe("Repo label or absolute path") }, async ({ identifier }) => { const config = loadConfig(); const repo = config.repos.find((r) => r.label === identifier || r.path === identifier); if (!repo) { return { content: [{ type: "text", text: `No repo found matching "${identifier}". Use list_repos to see all configured repos.` }] }; } const info = getBranchInfo(repo); const text = info.error ? `${info.label}: ERROR — ${info.error}` : `${info.label}: ${info.branch ?? "HEAD detached"}`; return { content: [{ type: "text", text }] }; } ); - src/tools/branches.ts:55-71 (registration)Registration of the check_repo_branch tool within the registerBranchTools function.
server.tool( "check_repo_branch", "Get the current branch for a single repo by its label or path.", { identifier: z.string().describe("Repo label or absolute path") }, async ({ identifier }) => { const config = loadConfig(); const repo = config.repos.find((r) => r.label === identifier || r.path === identifier); if (!repo) { return { content: [{ type: "text", text: `No repo found matching "${identifier}". Use list_repos to see all configured repos.` }] }; } const info = getBranchInfo(repo); const text = info.error ? `${info.label}: ERROR — ${info.error}` : `${info.label}: ${info.branch ?? "HEAD detached"}`; return { content: [{ type: "text", text }] }; } );