list_repos
Discover and retrieve all accessible ShadowGit repositories for debugging and code analysis. Start here to identify available repositories for detailed git history exploration.
Instructions
List all available ShadowGit repositories. Call this first to discover available repositories.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/handlers/list-repos-handler.ts:15-72 (handler)Core handler function that executes list_repos: fetches repositories from RepositoryManager, formats list, and returns detailed text response with workflow instructions.async handle(): Promise<MCPToolResponse> { const repos = this.repositoryManager.getRepositories(); if (repos.length === 0) { return createTextResponse( `No repositories found in ShadowGit. To add repositories: 1. Open the ShadowGit application 2. Click "Add Repository" 3. Select the repository you want to track ShadowGit will automatically create shadow repositories (.shadowgit.git) to track changes.` ); } const repoList = formatRepositoryList(repos); const firstRepo = repos[0].name; return createTextResponse( `🚀 **ShadowGit MCP Server Connected** ${'='.repeat(50)} 📁 **Available Repositories (${repos.length})** ${repoList} ${'='.repeat(50)} ⚠️ **CRITICAL: Required Workflow for ALL Changes** ${'='.repeat(50)} **You MUST follow this 4-step workflow:** 1️⃣ **START SESSION** (before ANY edits) \`start_session({repo: "${firstRepo}", description: "your task"})\` 2️⃣ **MAKE YOUR CHANGES** Edit code, fix bugs, add features 3️⃣ **CREATE CHECKPOINT** (after changes complete) \`checkpoint({repo: "${firstRepo}", title: "Clear commit message"})\` 4️⃣ **END SESSION** (to resume auto-commits) \`end_session({sessionId: "...", commitHash: "..."})\` ${'='.repeat(50)} 💡 **Quick Start Examples:** \`\`\`javascript // Check recent history git_command({repo: "${firstRepo}", command: "log -5"}) // Start your work session start_session({repo: "${firstRepo}", description: "Fixing authentication bug"}) \`\`\` 📖 **NEXT STEP:** Call \`start_session()\` before making any changes!` ); }
- src/shadowgit-mcp-server.ts:72-78 (registration)Registers the list_repos tool in the MCP server's ListToolsRequestHandler with name, description, and empty input schema.name: 'list_repos', description: 'List all available ShadowGit repositories. Use this first to discover which repositories you can work with.', inputSchema: { type: 'object', properties: {}, }, },
- src/shadowgit-mcp-server.ts:170-171 (registration)Dispatches list_repos tool calls to the ListReposHandler.handle() method in the CallToolRequestHandler switch statement.case 'list_repos': return await this.listReposHandler.handle();
- src/shadowgit-mcp-server.ts:41-41 (registration)Instantiates the ListReposHandler instance with the RepositoryManager dependency.this.listReposHandler = new ListReposHandler(this.repositoryManager);
- src/utils/response-utils.ts:40-45 (helper)Helper function used by the handler to format the repository list for display.export function formatRepositoryList(repos: Array<{ name: string; path: string }>): string { if (repos.length === 0) { return 'No repositories available.'; } return repos.map(r => ` ${r.name}:\n Path: ${r.path}`).join('\n\n'); }