Skip to main content
Glama
bsreeram08

Git Repo Browser MCP

git_lfs

Manage Git Large File Storage (LFS) by installing, tracking, untracking, or listing large files in Git repositories to handle binary assets efficiently.

Instructions

Manage Git LFS (Large File Storage).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYesThe path to the local Git repository
actionYesLFS action (install, track, untrack, list)list
patternsNoFile patterns for track/untrack

Implementation Reference

  • Main handler function that executes the git_lfs tool logic. Handles actions: install, track, untrack, list for Git LFS.
    export async function handleGitLFS({ repo_path, action, patterns = [] }) {
      try {
        // Make sure patterns is an array
        const patternsArray = Array.isArray(patterns) ? patterns : [patterns];
    
        switch (action) {
          case "install":
            // Install Git LFS in the repository
            const { stdout: installOutput } = await execPromise(
              `cd "${repo_path}" && git lfs install`
            );
    
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify(
                    {
                      success: true,
                      message: "Git LFS installed successfully",
                      output: installOutput.trim(),
                    },
                    null,
                    2
                  ),
                },
              ],
            };
    
          case "track":
            if (patternsArray.length === 0) {
              return {
                content: [
                  {
                    type: "text",
                    text: JSON.stringify(
                      {
                        error: "At least one pattern is required for track action",
                      },
                      null,
                      2
                    ),
                  },
                ],
                isError: true,
              };
            }
    
            // Track files with LFS
            const trackResults = [];
    
            for (const pattern of patternsArray) {
              const { stdout: trackOutput } = await execPromise(
                `cd "${repo_path}" && git lfs track "${pattern}"`
              );
              trackResults.push({
                pattern: pattern,
                output: trackOutput.trim(),
              });
            }
    
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify(
                    {
                      success: true,
                      message: `Tracked ${patternsArray.length} pattern(s) with Git LFS`,
                      patterns: patternsArray,
                      results: trackResults,
                    },
                    null,
                    2
                  ),
                },
              ],
            };
    
          case "untrack":
            if (patternsArray.length === 0) {
              return {
                content: [
                  {
                    type: "text",
                    text: JSON.stringify(
                      {
                        error:
                          "At least one pattern is required for untrack action",
                      },
                      null,
                      2
                    ),
                  },
                ],
                isError: true,
              };
            }
    
            // Untrack files from LFS
            const untrackResults = [];
    
            for (const pattern of patternsArray) {
              const { stdout: untrackOutput } = await execPromise(
                `cd "${repo_path}" && git lfs untrack "${pattern}"`
              );
              untrackResults.push({
                pattern: pattern,
                output: untrackOutput.trim(),
              });
            }
    
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify(
                    {
                      success: true,
                      message: `Untracked ${patternsArray.length} pattern(s) from Git LFS`,
                      patterns: patternsArray,
                      results: untrackResults,
                    },
                    null,
                    2
                  ),
                },
              ],
            };
    
          case "list":
            // List tracked patterns
            const { stdout: listOutput } = await execPromise(
              `cd "${repo_path}" && git lfs track`
            );
    
            // Parse the output to extract patterns
            const trackedPatterns = listOutput
              .split("\n")
              .filter((line) => line.includes("("))
              .map((line) => {
                const match = line.match(/Tracking "([^"]+)"/);
                return match ? match[1] : null;
              })
              .filter(Boolean);
    
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify(
                    {
                      success: true,
                      tracked_patterns: trackedPatterns,
                    },
                    null,
                    2
                  ),
                },
              ],
            };
    
          default:
            return {
              content: [
                {
                  type: "text",
                  text: JSON.stringify(
                    { error: `Unknown LFS action: ${action}` },
                    null,
                    2
                  ),
                },
              ],
              isError: true,
            };
        }
      } catch (error) {
        // Special handling for "git lfs not installed" error
        if (error.message.includes("git: lfs is not a git command")) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(
                  { error: "Git LFS is not installed on the system" },
                  null,
                  2
                ),
              },
            ],
            isError: true,
          };
        }
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                { error: `Failed to perform LFS operation: ${error.message}` },
                null,
                2
              ),
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition and tool metadata for the git_lfs tool used in MCP tool listing.
    {
      name: "git_lfs",
      description: "Manage Git LFS (Large File Storage).",
      inputSchema: {
        type: "object",
        properties: {
          repo_path: {
            type: "string",
            description: "The path to the local Git repository",
          },
          action: {
            type: "string",
            description: "LFS action (install, track, untrack, list)",
            default: "list",
            enum: ["install", "track", "untrack", "list"],
          },
          patterns: {
            type: "array",
            description: "File patterns for track/untrack",
            items: { type: "string" },
          },
        },
        required: ["repo_path", "action"],
      },
    },
  • src/server.js:924-925 (registration)
    Maps the 'git_lfs' tool name to its handler function handleGitLFS in the server's handlersMap.
    git_lfs: handleGitLFS,
    git_lfs_fetch: handleGitLFSFetch,
  • src/server.js:35-38 (registration)
    Imports the handleGitLFS handler into the server module.
      handleGitLFS,
      handleGitLFSFetch,
      handleGitRevert,
    } from "./handlers/index.js";
  • Re-exports the handleGitLFS function from other-operations.js for use in server.js.
      handleGitLFS,
      handleGitLFSFetch,
      handleGitRevert,
    } from "./other-operations.js";
Behavior2/5

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

No annotations are provided, so the description carries full burden. 'Manage' implies mutation capabilities, but it doesn't disclose behavioral traits like whether actions require specific permissions, what 'install' does to the repository, or how errors are handled. This is a significant gap for a tool with multiple actions including writes.

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 with zero waste. It's appropriately sized and front-loaded, though it could benefit from more detail given the lack of annotations and output schema.

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 complexity of managing Git LFS with multiple actions, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns, error conditions, or behavioral nuances, leaving significant gaps for an agent to understand how to use it effectively.

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%, providing clear documentation for all parameters. The description adds no additional meaning beyond the schema, which already details repo_path, action with enum values, and patterns. Baseline 3 is appropriate as the schema does the heavy lifting.

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

Purpose3/5

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

The description 'Manage Git LFS (Large File Storage)' states the general purpose but is vague about specific actions. It mentions the resource (Git LFS) but lacks a specific verb beyond 'manage', and doesn't distinguish from sibling tools like git_lfs_fetch which handles a specific LFS operation.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention when to choose this over git_lfs_fetch or other Git tools, nor does it specify prerequisites or contexts for LFS management.

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