Skip to main content
Glama
abhishekbhakat

mcp-server-code-assist

git_log

View git commit history to track changes and understand project evolution. Specify repository path and optional limit to display recent commits.

Instructions

Shows git commit history

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes
max_countNo

Implementation Reference

  • Core implementation of git_log tool: fetches recent commits using gitpython Repo.iter_commits and formats commit details (hash, author, date, message).
    async def log(self, repo_path: str, max_count: int = 10) -> str:
        """Show git commit history."""
        repo = git.Repo(repo_path)
        commits = list(repo.iter_commits(max_count=max_count))
        log = []
        for commit in commits:
            log.append(f"Commit: {commit.hexsha}\nAuthor: {commit.author}\nDate: {commit.authored_datetime}\nMessage: {commit.message}\n")
        return "\n".join(log)
  • Pydantic model defining input schema for git_log tool: repo_path (required) and optional max_count (default 10).
    class GitLog(BaseModel):
        repo_path: str
        max_count: int = 10
  • Registers the git_log tool in the MCP server.list_tools() with name, description, and input schema.
    Tool(
        name=CodeAssistTools.GIT_LOG,
        description="Shows git commit history",
        inputSchema=GitLog.model_json_schema(),
    ),
  • Handler dispatch in server.call_tool(): parses arguments into GitLog model and delegates to git_tools.log.
    case CodeAssistTools.GIT_LOG:
        model = GitLog(repo_path=arguments["repo_path"], max_count=arguments.get("max_count", 10))
        result = await git_tools.log(model.repo_path, model.max_count)
        return [TextContent(type="text", text=result)]
  • Factory function to get singleton GitTools instance, used by server to invoke git_log.
    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
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Shows git commit history' implies a read-only operation, but it doesn't specify output format (e.g., list of commits with metadata), pagination behavior (handled by max_count), or potential errors (e.g., invalid repo_path). For a tool with two parameters and no annotation coverage, this is insufficient.

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 extremely concise—a single three-word phrase—with zero wasted words. It's front-loaded with the core purpose. While brevity risks under-specification, every word ('Shows git commit history') directly contributes to understanding the tool's function, making it efficient in structure.

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

Completeness2/5

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

Given the tool's moderate complexity (two parameters, no output schema, no annotations), the description is incomplete. It lacks details on parameter usage, output format, error conditions, and differentiation from sibling git tools. For a tool that interacts with version control systems, more context is needed to ensure reliable agent invocation.

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

Parameters2/5

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

Schema description coverage is 0%, so the schema provides no parameter descriptions. The tool description adds no information about parameters—it doesn't explain what 'repo_path' means (e.g., local path to git repository) or how 'max_count' affects output (e.g., limits number of commits shown). With two undocumented parameters, the description fails to compensate for the schema gap.

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

Purpose3/5

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

The description 'Shows git commit history' clearly states the tool's function with a specific verb ('Shows') and resource ('git commit history'), distinguishing it from non-git siblings like file operations. However, it doesn't differentiate from other git tools (git_diff, git_show, git_status), leaving ambiguity about its specific scope within git operations.

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

Usage Guidelines2/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. It doesn't mention when to prefer git_log over git_show (for viewing specific commits) or git_status (for current state), nor does it specify prerequisites like needing a git repository. This lack of context leaves the agent to infer usage from the tool name alone.

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