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