Skip to main content
Glama
narayana-reddy-circles

MCP Git Status Server

git-status

Check the current git status of a repository to view changes, staged files, and branch information. Specify a directory path to analyze any git project.

Instructions

Get the current git status of the repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryNoDirectory path to check git status (defaults to current directory)

Implementation Reference

  • Handler for the 'git-status' tool: executes git status --porcelain=v1, git branch --show-current, and git remote -v commands in the specified directory (or cwd), formats the output including branch and remotes, handles errors.
    if (name === "git-status") {
      const { directory }: { directory?: string } = args || {};
      
      try {
        // Change to the specified directory if provided, otherwise use current directory
        const cwd = directory || process.cwd();
        
        // Execute git status command
        const gitStatus = execSync("git status --porcelain=v1", {
          cwd: cwd,
          encoding: "utf-8",
          stdio: ["pipe", "pipe", "pipe"]
        });
    
        // Also get the branch information
        const gitBranch = execSync("git branch --show-current", {
          cwd: cwd,
          encoding: "utf-8",
          stdio: ["pipe", "pipe", "pipe"]
        }).trim();
    
        // Get additional git info
        const gitRemote = execSync("git remote -v", {
          cwd: cwd,
          encoding: "utf-8",
          stdio: ["pipe", "pipe", "pipe"]
        });
    
        // Format the response
        let statusText = `Git Status for: ${cwd}\n`;
        statusText += `Current branch: ${gitBranch}\n`;
        statusText += `\nStatus:\n`;
        
        if (gitStatus.trim() === "") {
          statusText += "Working directory clean - no changes detected\n";
        } else {
          statusText += gitStatus;
        }
        
        statusText += `\nRemotes:\n${gitRemote}`;
    
        return {
          content: [{
            type: "text",
            text: statusText
          }]
        };
        
      } catch (error) {
        // Handle errors (e.g., not a git repository, git not installed, etc.)
        const errorMessage = error instanceof Error ? error.message : String(error);
        
        return {
          content: [{
            type: "text",
            text: `Error running git status: ${errorMessage}\n\nPlease ensure:\n1. You are in a git repository\n2. Git is installed and available in PATH\n3. You have proper permissions to access the directory`
          }],
          isError: true
        };
      }
    }
  • Input schema for git-status tool: object with optional 'directory' string property.
    {
      name: "git-status",
      description: "Get the current git status of the repository",
      inputSchema: {
        type: "object",
        properties: {
          directory: {
            type: "string",
            description: "Directory path to check git status (defaults to current directory)"
          }
        }
      }
    },
  • src/index.ts:27-63 (registration)
    Tool list registration handler that declares the 'git-status' tool along with its description and input schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: "git-status",
            description: "Get the current git status of the repository",
            inputSchema: {
              type: "object",
              properties: {
                directory: {
                  type: "string",
                  description: "Directory path to check git status (defaults to current directory)"
                }
              }
            }
          },
          {
            name: "git-log",
            description: "Get recent git commit history",
            inputSchema: {
              type: "object",
              properties: {
                directory: {
                  type: "string",
                  description: "Directory path to check git log (defaults to current directory)"
                },
                count: {
                  type: "number",
                  description: "Number of recent commits to show (default: 10)",
                  default: 10
                }
              }
            }
          }
        ]
      };
    });
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a read operation ('Get'), but doesn't mention whether it requires git repository initialization, what happens with non-git directories, error conditions, or output format. The description is minimal and lacks important 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, efficient sentence that directly states the tool's purpose with zero wasted words. It's appropriately sized for a simple tool and front-loads the essential information.

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

Completeness3/5

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

For a simple read operation with one optional parameter and no output schema, the description is minimally adequate. However, without annotations and with a sibling tool present, it should provide more context about differentiation and behavioral expectations to be truly complete.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already fully documents the single optional parameter. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score for high schema coverage.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('current git status of the repository'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from the sibling tool 'git-log', which likely shows commit history rather than current status.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'git-log' or other git operations. It states what the tool does but offers no context about appropriate use cases or limitations.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/narayana-reddy-circles/mcp-git-status'

If you have feedback or need assistance with the MCP directory API, please join our Discord server