Skip to main content
Glama

git_lfs_fetch

Fetch Git LFS objects from remote repositories to manage large files in Git workflows, supporting dry runs and pointer conversion.

Instructions

Fetch LFS objects from the remote repository.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYesThe path to the local Git repository
dry_runNoWhether to perform a dry run
pointersNoWhether to convert pointers to objects

Implementation Reference

  • Core implementation of the git_lfs_fetch tool. Executes 'git lfs fetch' in the repository directory with optional --dry-run and --pointers flags using execPromise. Handles output parsing, errors, and special case for missing Git LFS installation.
    export async function handleGitLFSFetch({ repo_path, dry_run = false, pointers = false, }) { try { // Build the command let command = `cd "${repo_path}" && git lfs fetch`; if (dry_run) { command += " --dry-run"; } if (pointers) { command += " --pointers"; } // Execute the command const { stdout, stderr } = await execPromise(command); // Parse the output const output = stdout.trim(); const errors = stderr.trim(); if (errors && !output) { return { content: [ { type: "text", text: JSON.stringify({ error: errors }, null, 2), }, ], isError: true, }; } return { content: [ { type: "text", text: JSON.stringify( { success: true, message: "Git LFS fetch completed", output: output, dry_run: dry_run, }, null, 2 ), }, ], }; } 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 fetch LFS objects: ${error.message}` }, null, 2 ), }, ], isError: true, }; } }
  • Tool schema definition including name, description, and inputSchema with properties repo_path (required), dry_run, and pointers.
    { name: "git_lfs_fetch", description: "Fetch LFS objects from the remote repository.", inputSchema: { type: "object", properties: { repo_path: { type: "string", description: "The path to the local Git repository", }, dry_run: { type: "boolean", description: "Whether to perform a dry run", default: false, }, pointers: { type: "boolean", description: "Whether to convert pointers to objects", default: false, }, }, required: ["repo_path"], }, },
  • src/server.js:925-925 (registration)
    Maps the tool name 'git_lfs_fetch' to its handler function handleGitLFSFetch in the central handlersMap used by the MCP server.
    git_lfs_fetch: handleGitLFSFetch,
  • src/server.js:36-38 (registration)
    Imports the handleGitLFSFetch function from handlers/index.js into the server module.
    handleGitLFSFetch, handleGitRevert, } from "./handlers/index.js";
  • Re-exports handleGitLFSFetch from other-operations.js for centralized import in server.js.
    handleGitLFSFetch,

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