Skip to main content
Glama
aflsolutions

ShadowGit MCP Server

by aflsolutions

list_repos

List all accessible ShadowGit repositories to discover which ones you can analyze.

Instructions

List all available ShadowGit repositories. Use this first to discover which repositories you can work with.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The ListReposHandler class with the handle() method that executes the list_repos tool logic. It fetches repositories from RepositoryManager and formats them with workflow instructions.
    /**
     * Handler for list_repos tool
     */
    
    import { RepositoryManager } from '../core/repository-manager';
    import { createTextResponse, formatRepositoryList } from '../utils/response-utils';
    import type { MCPToolResponse } from '../types';
    
    export class ListReposHandler {
      constructor(private repositoryManager: RepositoryManager) {}
    
      /**
       * Handle list_repos tool execution
       */
      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!`
        );
      }
    }
  • Tool registration: name 'list_repos' is declared in the ListToolsRequestSchema handler with its description and empty inputSchema.
    private setupHandlers(): void {
      // List available tools
      this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
        tools: [
          {
            name: 'list_repos',
            description: 'List all available ShadowGit repositories. Use this first to discover which repositories you can work with.',
            inputSchema: {
              type: 'object',
              properties: {},
            },
          },
  • Tool dispatch: the CallToolRequestSchema switch-case routes 'list_repos' to listReposHandler.handle().
    switch (name) {
      case 'list_repos':
        return await this.listReposHandler.handle();
  • The formatRepositoryList() helper used by the handler to format repository names and paths 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');
    }
  • The getRepositories() method on RepositoryManager that provides the list of repositories displayed by list_repos.
    getRepositories(): Repository[] {
      return this.repositories;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. It implies a read-only, non-destructive operation by stating 'List' and 'Use this first', but it doesn't explicitly state that it has no side effects or return format. For a simple list tool, this is minimally adequate but lacks detailed behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence of 14 words. It is front-loaded with the tool's purpose and includes a usage hint. Every word contributes to the meaning, with no redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (no parameters, no output schema, no annotations), the description is sufficient. It clearly states what the tool does and when to use it relative to siblings. It doesn't describe return values, but for a straightforward listing tool, that is likely self-evident.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero parameters, and the schema coverage is trivially 100%. According to the rubric, a baseline of 4 applies for zero parameters since there are no parameter semantics to explain. The description adds no parameter information, but none is needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool 'List all available ShadowGit repositories' with a specific verb (list) and resource (repositories). It also indicates its role as the initial discovery step ('Use this first'), which distinguishes it from sibling tools like git_command or session management.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says 'Use this first to discover which repositories you can work with', providing clear context for when to utilize this tool. It doesn't mention when not to use it or alternatives, but for a discovery tool this is sufficient guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.