Skip to main content
Glama

git_lfs_fetch

Fetch Git LFS objects from a remote repository to ensure access to large files. Specify the local repo path, and optionally perform a dry run or convert pointers to objects for efficient storage management.

Instructions

Fetch LFS objects from the remote repository.

Input Schema

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

Implementation Reference

  • The primary handler function that executes the 'git lfs fetch' command with support for dry-run and pointers options, handling errors including 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, }; } }
  • The input schema definition for the git_lfs_fetch tool, specifying parameters repo_path (required), dry_run, and pointers with descriptions and defaults.
    { 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-927 (registration)
    Registration of the handleGitLFSFetch function to the 'git_lfs_fetch' tool name in the server's handlers map.
    git_lfs_fetch: handleGitLFSFetch, git_revert: handleGitRevert, };
  • Re-export of the handleGitLFSFetch handler from other-operations.js for use 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