git_show
Display git commit details including changes and metadata for specific revisions in a repository to review code history and modifications.
Instructions
Shows git commit details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes | ||
| revision | Yes |
Implementation Reference
- Core handler function that executes the git show command using the gitpython library, taking repo_path and revision as inputs.async def show(self, repo_path: str, revision: str | None = None, format_str: str | None = None) -> str: """Show various types of git objects. Args: repo_path: Path to git repository revision: Object to show (commit hash, tag, tree, etc.). Defaults to HEAD format_str: Optional format string for pretty-printing (e.g. 'oneline', 'short', 'medium', etc.) Returns: String output of git show command """ repo = git.Repo(repo_path) args = [] if format_str: args.extend([f"--format={format_str}"]) if revision: args.append(revision) return repo.git.show(*args)
- Pydantic BaseModel defining the input schema for the git_show tool, with repo_path and revision fields.class GitShow(BaseModel): repo_path: str revision: str
- src/mcp_server_code_assist/server.py:136-140 (registration)MCP tool registration in list_tools(), specifying name, description, and input schema for git_show.Tool( name=CodeAssistTools.GIT_SHOW, description="Shows git commit details", inputSchema=GitShow.model_json_schema(), ),
- MCP server call_tool handler case that parses arguments, instantiates the GitShow model, and delegates to GitTools.show().case CodeAssistTools.GIT_SHOW: model = GitShow(repo_path=arguments["repo_path"], revision=arguments["commit"]) result = await git_tools.show(model.repo_path, model.revision) return [TextContent(type="text", text=result)]
- src/mcp_server_code_assist/server.py:31-31 (registration)Enum definition for the git_show tool name in CodeAssistTools.GIT_SHOW = "git_show"