Skip to main content
Glama

git_diff

Compare differences between branches or commits in a Git repository to analyze changes and identify updates efficiently using the MCP Git Server.

Instructions

Shows differences between branches or commits

Input Schema

NameRequiredDescriptionDefault
repo_pathYes
targetYes

Input Schema (JSON Schema)

{ "properties": { "repo_path": { "title": "Repo Path", "type": "string" }, "target": { "title": "Target", "type": "string" } }, "required": [ "repo_path", "target" ], "title": "GitDiff", "type": "object" }

Implementation Reference

  • Execution handler for the 'git_diff' tool within the call_tool method, invoking the git_diff helper and formatting the response.
    case GitTools.DIFF: diff = git_diff(repo, arguments["target"]) return [TextContent( type="text", text=f"Diff with {arguments['target']}:\n{diff}" )]
  • Pydantic input schema for the 'git_diff' tool, defining repo_path and target parameters.
    class GitDiff(BaseModel): repo_path: str target: str
  • Tool registration for 'git_diff' in the list_tools handler, specifying name, description, and input schema.
    Tool( name=GitTools.DIFF, description="Shows differences between branches or commits", inputSchema=GitDiff.schema(), ),
  • Helper function implementing the core git diff logic using dulwich repo.git.diff(target).
    def git_diff(repo: git.Repo, target: str) -> str: return repo.git.diff(target)

Other Tools

Related Tools

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