add_repo
Add a git repository to the Claude status bar for tracking branches and changes. Specify the repository path, display label, and visibility settings.
Instructions
Add a repository to the status bar. The path must be an absolute filesystem path to a git repo root.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the git repo | |
| label | Yes | Short display label, e.g. 'payment-service' | |
| type | No | 'active' for dev repos, 'reference' for read-only refs | active |
| show | No | Whether to show this repo in the status bar immediately |
Implementation Reference
- src/tools/config-tools.ts:32-55 (handler)The implementation of the 'add_repo' tool, which accepts a path, label, type, and show flag, validates the path, updates the configuration, and saves it.
server.tool( "add_repo", "Add a repository to the status bar. The path must be an absolute filesystem path to a git repo root.", { path: z.string().describe("Absolute path to the git repo"), label: z.string().describe("Short display label, e.g. 'payment-service'"), type: z.enum(["active", "reference"]).default("active").describe("'active' for dev repos, 'reference' for read-only refs"), show: z.boolean().default(true).describe("Whether to show this repo in the status bar immediately"), }, async ({ path, label, type, show }) => { const config = loadConfig(); const exists = config.repos.find((r) => r.path === path || r.label === label); if (exists) { return { content: [{ type: "text", text: `Repo already configured: ${exists.label} (${exists.path}). Use set_repo_visibility or remove_repo first.` }] }; } if (!isGitRepo(path)) { return { content: [{ type: "text", text: `Warning: "${path}" does not appear to be a git repo. Added anyway — verify the path is correct.` }] }; } const repo: RepoConfig = { path, label, type, show }; config.repos.push(repo); saveConfig(config); return { content: [{ type: "text", text: `Added repo: ${label} (${path}) [${type}, ${show ? "visible" : "hidden"}]` }] }; } );