get_branch_status
Check current git branch status across multiple repositories to monitor development progress and track changes in real-time.
Instructions
Return the current git branch for every configured repo. Respects the enabled flag and showReferenceRepos toggle.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/branches.ts:23-52 (handler)The handler for the 'get_branch_status' tool, which gathers branch info for all visible git repositories and formats the output.
// --- get_branch_status --- server.tool( "get_branch_status", "Return the current git branch for every configured repo. Respects the enabled flag and showReferenceRepos toggle.", {}, async () => { const config = loadConfig(); if (!config.statusbar.enabled) { return { content: [{ type: "text", text: "Status bar is disabled. Use toggle_statusbar to enable it." }] }; } const visible = config.repos.filter((r) => { if (!r.show) return false; if (r.type === "reference" && !config.statusbar.showReferenceRepos) return false; return true; }); const branches = getAllBranchInfo(visible); const lines = branches.map((b) => { const tag = b.type === "reference" ? " [ref]" : ""; const status = b.error ? `ERROR: ${b.error}` : (b.branch ?? "HEAD detached"); return `${b.label}${tag}: ${status}`; }); const statusLine = formatStatusLine(branches, config.statusbar.showReferenceRepos); return { content: [ { type: "text", text: lines.join("\n") || "(no visible repos)" }, { type: "text", text: `\nStatus line preview:\n${statusLine}` }, ], }; } ); - src/tools/branches.ts:22-22 (registration)The registration function that orchestrates the registration of all branch-related tools, including 'get_branch_status'.
export function registerBranchTools(server: McpServer): void {