get_branch_status
Check current git branches across configured repositories to monitor development status and manage repository visibility.
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:24-51 (handler)The handler function for the `get_branch_status` tool, which retrieves git branch info for configured repositories based on status bar settings.
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:24-27 (registration)Registration of the `get_branch_status` tool within the McpServer instance.
server.tool( "get_branch_status", "Return the current git branch for every configured repo. Respects the enabled flag and showReferenceRepos toggle.", {},