Skip to main content
Glama
ceshine

Git Prompts MCP Server

by ceshine

git-commit-messages

Retrieve commit messages between a specified ancestor commit or branch and the current HEAD to review changes and track development history.

Instructions

Get commit messages between the ancestor and HEAD

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ancestorYesThe ancestor commit hash or branch name

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The FastMCP tool handler and registration for 'git-commit-messages'. It calls GitMethodCollection.get_commit_messages_data to execute the tool logic.
    @APP.tool(
        name="git-commit-messages",
        description="Get commit messages between the ancestor and HEAD",
    )
    async def git_commit_messages_tool(
        ancestor: str = Field(..., description="The ancestor commit hash or branch name"),
    ) -> list[dict[str, str]]:
        return await GIT_METHOD_COLLETION.get_commit_messages_data(ancestor)
  • Core handler logic in GitMethodCollection that retrieves commits between ancestor and HEAD using gitpython and formats them as a list of dicts.
    async def get_commit_messages_data(self, ancestor: str) -> list[dict[str, str]]:
        if not ancestor:
            raise ValueError("Ancestor argument required")
        try:
            commits = _get_commit_history(self.repo, ancestor)
            return _format_commit_history_as_json_obj(commits)
        except git.GitCommandError as e:
            raise ValueError(f"Error executing Git command: {str(e)}")
  • Helper function to iterate and list git commits from ancestor to HEAD.
    def _get_commit_history(repo: git.Repo, ancestor: str) -> list[git.Commit]:
        return list(repo.iter_commits(rev=f"{ancestor}..HEAD"))
  • Helper function to convert list of git Commit objects to JSON-serializable list of dicts with commit details.
    def _format_commit_history_as_json_obj(commits: list[git.Commit]) -> list[dict[str, str]]:
        return [
            {
                "hexsha": commit.hexsha,
                "author": str(commit.author),
                "create_time": commit.authored_datetime.astimezone(timezone.utc).isoformat(),
                "message": str(commit.message).strip(),
            }
            for commit in commits
        ]
  • Pydantic input schema for the 'ancestor' parameter using Field.
    ancestor: str = Field(..., description="The ancestor commit hash or branch name"),
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. It states the tool retrieves commit messages but doesn't describe key behaviors like whether it's read-only, safe to use, how it handles errors, or what the output format entails. For a tool with no annotations, this leaves significant gaps in understanding its operational traits.

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 a single, efficient sentence that directly states the tool's purpose without any wasted words. It's front-loaded and appropriately sized for the task, making it easy for an agent to parse quickly.

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

Completeness4/5

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

Given the tool's low complexity (one parameter, no nested objects) and the presence of an output schema (which handles return values), the description is reasonably complete. However, it lacks behavioral details and usage guidelines, which are needed for full contextual understanding, especially with no annotations provided.

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

Parameters3/5

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

The input schema has 100% description coverage, fully documenting the 'ancestor' parameter. The description adds no additional meaning beyond the schema, such as examples or constraints, but since the schema is comprehensive, the baseline score of 3 is appropriate as it doesn't need to compensate for gaps.

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

Purpose4/5

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

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('commit messages'), and specifies the scope ('between the ancestor and HEAD'). However, it doesn't explicitly differentiate from sibling tools like git-cached-diff or git-diff, which might also involve commit history or comparisons.

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, such as the sibling tools git-cached-diff or git-diff. It mentions the scope but doesn't clarify use cases, prerequisites, or exclusions, leaving the agent to infer usage from context 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/ceshine/git-prompts-mcp-server'

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