Skip to main content
Glama
abhishekbhakat

mcp-server-code-assist

git_diff

Compare code changes in Git repositories to identify modifications between commits, branches, or files for review and analysis.

Instructions

Shows git diff

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes
targetYes

Implementation Reference

  • Core implementation of git_diff tool executing git diff via gitpython library.
    async def diff(self, repo_path: str, target: str | None = None) -> str:
        """Show git diff."""
        repo = git.Repo(repo_path)
        return repo.git.diff(target) if target else repo.git.diff()
  • Pydantic model defining the input schema for the git_diff tool.
    class GitDiff(BaseModel):
        repo_path: str
        target: str
  • Registration of the git_diff tool in the MCP server's list_tools() function.
    Tool(
        name=CodeAssistTools.GIT_DIFF,
        description="Shows git diff",
        inputSchema=GitDiff.model_json_schema(),
    ),
  • MCP server @call_tool handler that validates input with GitDiff model and delegates to GitTools.diff.
    case CodeAssistTools.GIT_DIFF:
        model = GitDiff(repo_path=arguments["repo_path"], target=arguments.get("target", ""))
        result = await git_tools.diff(model.repo_path, model.target)
        return [TextContent(type="text", text=result)]
  • Singleton factory for GitTools instance used by git_diff handler.
    def get_git_tools(allowed_paths: list[str]) -> GitTools:
        """Get or create GitTools instance with given allowed paths.
    
        Args:
            allowed_paths: List of paths that tools can operate on
    
        Returns:
            GitTools instance with updated paths
        """
        global _git_tools
        if not _git_tools or not all(path in _git_tools.allowed_paths for path in allowed_paths):
            _git_tools = GitTools(allowed_paths=allowed_paths)
        return _git_tools
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Shows git diff' gives no information about whether this is a read-only operation, what permissions might be required, whether it modifies any state, what format the output takes, or any error conditions. For a tool with two required parameters and no output schema, this is completely inadequate behavioral transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is maximally concise at just two words. While this represents severe under-specification, from a pure conciseness perspective, it contains zero wasted words and is front-loaded with the core function. Every word earns its place, even though those words provide insufficient information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 2 required parameters, 0% schema description coverage, no annotations, no output schema, and multiple sibling git tools, the description is completely inadequate. 'Shows git diff' doesn't explain what the tool actually does, how to use its parameters, what behavior to expect, or how it differs from alternatives. This fails to provide the necessary context for an agent to effectively select and invoke this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage for both parameters (repo_path and target), the description provides absolutely no information about what these parameters mean or how they should be used. 'Shows git diff' doesn't mention parameters at all, leaving the agent with no guidance about what 'repo_path' and 'target' represent in the context of showing git differences.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Shows git diff' is essentially a tautology that restates the tool name with minimal elaboration. While it correctly identifies the verb ('shows') and resource ('git diff'), it lacks specificity about what 'git diff' means in this context or how it differs from similar operations like git_show or git_status among the sibling tools. The description doesn't clarify whether this shows differences between commits, branches, working directory changes, or other git comparisons.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like git_log, git_show, and git_status available, there's no indication of what scenarios warrant using git_diff over these other git-related tools. No context about prerequisites, typical use cases, or exclusions is mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/abhishekbhakat/mcp_server_code_assist'

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