list_repos
Discover available ShadowGit repositories to identify which codebases you can analyze for debugging and historical code review.
Instructions
List all available ShadowGit repositories. Use this first to discover which repositories you can work with.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/handlers/list-repos-handler.ts:15-72 (handler)Core handler implementation for the list_repos tool. Retrieves repositories, handles empty case, formats list, and returns comprehensive response with usage 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)Registration of list_repos tool in ListToolsRequestHandler, including schema definition (no input params required).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)Dispatch/execution routing for list_repos in the CallToolRequestHandler switch statement.case 'list_repos': return await this.listReposHandler.handle();
- src/utils/response-utils.ts:40-45 (helper)Supporting utility function used by list_repos handler to format repository list as a string.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'); }