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

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"),

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