Skip to main content
Glama

git_diff

Compare changes between Git branches or commits to review modifications before merging or deploying code.

Instructions

Shows differences between branches or commits

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes
targetYes

Implementation Reference

  • Core handler function that computes the git diff against the specified target using repo.git.diff(target). Called by the MCP tool dispatcher.
    def git_diff(repo: git.Repo, target: str) -> str: return repo.git.diff(target)
  • Pydantic input schema for the git_diff tool, defining repo_path and target parameters.
    class GitDiff(BaseModel): repo_path: str target: str
  • Registration of the 'git_diff' tool (GitTools.DIFF) in the list_tools() method, including name, description, and input schema.
    Tool( name=GitTools.DIFF, description="Shows differences between branches or commits", inputSchema=GitDiff.schema(), ),
  • MCP call_tool dispatcher case for git_diff: extracts target, calls git_diff helper, formats and returns TextContent response.
    case GitTools.DIFF: diff = git_diff(repo, arguments["target"]) return [TextContent( type="text", text=f"Diff with {arguments['target']}:\n{diff}" )]
  • Enum definition providing the tool name constant GitTools.DIFF = "git_diff" used in registration and dispatch.
    class GitTools(str, Enum): STATUS = "git_status" DIFF_UNSTAGED = "git_diff_unstaged" DIFF_STAGED = "git_diff_staged" DIFF = "git_diff" COMMIT = "git_commit" ADD = "git_add" RESET = "git_reset" LOG = "git_log" CREATE_BRANCH = "git_create_branch" CHECKOUT = "git_checkout" SHOW = "git_show" INIT = "git_init"

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/martinsky999/mcp-git-py'

If you have feedback or need assistance with the MCP directory API, please join our Discord server