validate_repo_path
Verify if a filesystem path exists and contains a valid git repository. Use this tool to confirm repository paths before performing git operations.
Instructions
Check whether a given filesystem path exists and is a git repository.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to check |
Implementation Reference
- src/tools/branches.ts:73-87 (handler)The handler implementation for the `validate_repo_path` tool, which checks if a path exists and is a git repository.
// --- validate_repo_path --- server.tool( "validate_repo_path", "Check whether a given filesystem path exists and is a git repository.", { path: z.string().describe("Absolute path to check") }, async ({ path }) => { if (!existsSync(path)) { return { content: [{ type: "text", text: `Path does not exist: ${path}` }] }; } if (!isGitRepo(path)) { return { content: [{ type: "text", text: `Path exists but is not a git repo (no .git directory): ${path}` }] }; } return { content: [{ type: "text", text: `Valid git repository: ${path}` }] }; } );