Skip to main content
Glama

git_local_changes

Identify and retrieve uncommitted changes in a local Git repository by specifying its path, enabling efficient tracking of modifications before commits.

Instructions

Get uncommitted changes in the working directory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYesThe path to the local Git repository

Implementation Reference

  • Core implementation of the git_local_changes tool: fetches Git status and per-file diffs using simpleGit for the given repo_path.
    export async function handleGitLocalChanges({ repo_path }) { try { // Use the provided local repo path const git = simpleGit(repo_path); // Get status information const status = await git.status(); // Get detailed diff for modified files let diffs = {}; for (const file of status.modified) { diffs[file] = await git.diff([file]); } return { content: [ { type: "text", text: JSON.stringify( { branch: status.current, staged_files: status.staged, modified_files: status.modified, new_files: status.not_added, deleted_files: status.deleted, conflicted_files: status.conflicted, diffs: diffs, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( { error: `Failed to get local changes: ${error.message}` }, null, 2 ), }, ], isError: true, }; } }
  • Input schema definition for git_local_changes tool, specifying repo_path as required string parameter.
    name: "git_local_changes", description: "Get uncommitted changes in the working directory.", inputSchema: { type: "object", properties: { repo_path: { type: "string", description: "The path to the local Git repository", }, }, required: ["repo_path"], }, },
  • src/server.js:905-905 (registration)
    Maps the tool name 'git_local_changes' to its handler function in the central handlersMap for quick lookup.
    git_local_changes: handleGitLocalChanges,
  • src/server.js:887-887 (registration)
    Registers 'git_status' as an alias for 'git_local_changes' in handlerAliases.
    git_status: "git_local_changes",
  • Re-exports handleGitLocalChanges from directory-operations.js for centralized imports.
    handleGitLocalChanges,

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