add_repo
Add a git repository to the Claude interface status bar for monitoring branches and tracking development or reference repositories.
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:41-54 (handler)The handler function for the `add_repo` tool, responsible for validating inputs and updating the configuration.
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"}]` }] }; } - src/tools/config-tools.ts:35-40 (schema)The Zod schema definition for the `add_repo` tool arguments.
{ 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"), }, - src/tools/config-tools.ts:32-55 (registration)Registration of the `add_repo` tool within the McpServer instance.
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"}]` }] }; } );