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
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | Whether to perform a dry run | |
| pointers | No | Whether to convert pointers to objects | |
| repo_path | Yes | The path to the local Git repository |
Implementation Reference
- src/handlers/other-operations.js:391-476 (handler)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, }; } }
- src/server.js:800-823 (schema)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, };
- src/handlers/index.js:85-85 (registration)Re-export of the handleGitLFSFetch handler from other-operations.js for use in server.js.handleGitLFSFetch,