Skip to main content
Glama
bsreeram08

Git Repo Browser MCP

git_archive

Create compressed archives (zip or tar) from Git repositories to package code for distribution, backup, or sharing.

Instructions

Create a git archive (zip or tar).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYesThe path to the local Git repository
output_pathYesOutput path for the archive
formatNoArchive format (zip or tar)zip
prefixNoPrefix for files in the archive
treeishNoTree-ish to archive (default: HEAD)HEAD

Implementation Reference

  • The core handler function implementing git archive creation using simpleGit to generate zip or tar archives from a repository tree-ish.
    export async function handleGitArchive({
      repo_path,
      output_path,
      format = "zip",
      prefix = "",
      treeish = "HEAD",
    }) {
      try {
        const git = simpleGit(repo_path);
    
        // Validate format
        if (!["zip", "tar"].includes(format)) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  {
                    error: `Invalid archive format: ${format}. Use 'zip' or 'tar'.`,
                  },
                  null,
                  2
                ),
              },
            ],
            isError: true,
          };
        }
    
        // Build archive command
        const archiveArgs = ["archive", `--format=${format}`];
    
        if (prefix) {
          archiveArgs.push(`--prefix=${prefix}/`);
        }
    
        archiveArgs.push("-o", output_path, treeish);
    
        // Create archive
        await git.raw(archiveArgs);
    
        // Check if archive was created
        if (!(await fs.pathExists(output_path))) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  { error: "Failed to create archive: output file not found" },
                  null,
                  2
                ),
              },
            ],
            isError: true,
          };
        }
    
        // Get file size
        const stats = await fs.stat(output_path);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  success: true,
                  message: `Created ${format} archive at ${output_path}`,
                  format: format,
                  output_path: output_path,
                  size_bytes: stats.size,
                  treeish: treeish,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                { error: `Failed to create archive: ${error.message}` },
                null,
                2
              ),
            },
          ],
          isError: true,
        };
      }
    }
  • The input schema definition for the git_archive tool, including parameters, types, descriptions, defaults, and required fields.
      name: "git_archive",
      description: "Create a git archive (zip or tar).",
      inputSchema: {
        type: "object",
        properties: {
          repo_path: {
            type: "string",
            description: "The path to the local Git repository",
          },
          output_path: {
            type: "string",
            description: "Output path for the archive",
          },
          format: {
            type: "string",
            description: "Archive format (zip or tar)",
            default: "zip",
            enum: ["zip", "tar"],
          },
          prefix: {
            type: "string",
            description: "Prefix for files in the archive",
          },
          treeish: {
            type: "string",
            description: "Tree-ish to archive (default: HEAD)",
            default: "HEAD",
          },
        },
        required: ["repo_path", "output_path"],
      },
    },
  • src/server.js:919-919 (registration)
    Registration of the git_archive tool handler in the central handlersMap used by the MCP server to route tool calls.
    git_archive: handleGitArchive,
  • src/server.js:30-38 (registration)
    Import of the handleGitArchive handler function into the main server file.
      handleGitArchive,
      handleGitAttributes,
      handleGitBlame,
      handleGitClean,
      handleGitHooks,
      handleGitLFS,
      handleGitLFSFetch,
      handleGitRevert,
    } from "./handlers/index.js";
  • Re-export of handleGitArchive from other-operations.js via the handlers index module for centralized access.
    handleGitArchive,
    handleGitAttributes,
    handleGitBlame,
    handleGitClean,
    handleGitHooks,
    handleGitLFS,
    handleGitLFSFetch,
    handleGitRevert,
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. While 'Create' implies a write operation, it doesn't specify whether this creates a new file (destructive to disk space), what permissions are required, whether it overwrites existing files at output_path, or what happens on failure. For a tool with 5 parameters and no annotation coverage, this is a significant gap in 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 perfectly concise at 6 words, front-loading the essential action and resource. Every word earns its place with zero waste or redundancy, making it immediately scannable and understandable.

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

Completeness2/5

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

Given the tool has 5 parameters, no annotations, no output schema, and operates in a complex Git ecosystem with 25 sibling tools, the description is insufficiently complete. It doesn't explain what the tool returns (archive creation confirmation? error messages?), doesn't address behavioral aspects like file overwriting or permissions, and provides no context about when to use it versus other Git operations.

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?

The description mentions 'zip or tar' which corresponds to the 'format' parameter, adding minimal value beyond what the schema already provides (which has 100% coverage with detailed descriptions for all 5 parameters). Since schema_description_coverage is high, the baseline is 3 - the description doesn't add meaningful parameter semantics beyond what's already documented in the structured schema.

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 action ('Create') and resource ('git archive') with format specification ('zip or tar'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its many Git-related siblings (like git_commit, git_pull, etc.), which would require mentioning it's specifically for creating compressed archives rather than other repository operations.

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. With 25 sibling Git tools, there's no indication of when git_archive is appropriate compared to git_commit (for saving changes), git_pull (for fetching updates), or other archive-related operations that might exist elsewhere in the system.

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/bsreeram08/git-commands-mcp'

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