Skip to main content
Glama
martinsky999

MCP Git Server

by martinsky999

git_log

View commit history in Git repositories to track changes and review project evolution. Specify repository path and optional limit for log entries.

Instructions

Shows the commit logs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYes
max_countNo

Implementation Reference

  • The handler function that retrieves the git commit history using gitpython, formats log entries with commit hash, author, date, and message, or returns an error message.
    def git_log(repo: git.Repo, max_count: int = 10) -> list[str]:
        try:
            commits = list(repo.iter_commits('HEAD', max_count=max_count))
            log_entries = []
            for commit in commits:
                log_entries.append(
                    f"commit {commit.hexsha}\n"
                    f"Author: {commit.author.name} <{commit.author.email}>\n"
                    f"Date:   {commit.committed_datetime}\n\n"
                    f"    {commit.message.strip()}\n"
                )
            return log_entries
        except Exception as e:
            return [f"Error running git log: {str(e)}"]
  • Pydantic BaseModel defining the input parameters for the git_log tool: repo_path (required string) and max_count (optional int default 10).
    class GitLog(BaseModel):
        repo_path: str
        max_count: int = 10
  • Registers the git_log tool in the MCP server with name from GitTools.LOG ("git_log"), description, and input schema from GitLog model.
    Tool(
        name=GitTools.LOG,
        description="Shows the commit logs",
        inputSchema=GitLog.schema(),
    ),
  • Enum value in GitTools defining the tool name "git_log".
    LOG = "git_log"
  • Tool dispatcher in call_tool() that invokes the git_log handler and formats the response as TextContent for MCP protocol.
    case GitTools.LOG:
        log = git_log(repo, arguments.get("max_count", 10))
        return [TextContent(
            type="text",
            text="Commit history:\n" + "\n".join(log)
        )]
Behavior2/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 the commit logs' implies a read-only operation, but it doesn't specify output format, pagination behavior, error conditions, or any constraints like authentication needs or rate limits. This leaves significant gaps in understanding how the tool behaves.

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 with just three words, front-loading the core purpose without any wasted text. While this brevity may lead to underspecification, it's structurally efficient and earns its place by stating the essential action.

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 (2 parameters, no output schema, no annotations), the description is incomplete. It lacks details on parameter usage, output format, behavioral traits, and differentiation from siblings, making it inadequate for an AI agent to reliably invoke the tool without additional context or assumptions.

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?

With 0% schema description coverage for the two parameters (repo_path and max_count), the description adds no meaning beyond what the schema provides. It doesn't explain what repo_path expects (e.g., local path, URL), what max_count defaults to or its range, or how they affect the output, failing to compensate for the schema's lack of descriptions.

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 the commit logs' clearly states the verb ('shows') and resource ('commit logs'), making the basic purpose understandable. However, it doesn't differentiate from sibling tools like git_show or git_status, which might also display commit-related information, leaving some ambiguity about its specific scope.

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. With siblings like git_show (which might show specific commits) and git_status (which shows working tree status), there's no indication of when git_log is preferred, leaving usage context entirely implicit.

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

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