Skip to main content
Glama

get_commit_details

Retrieve detailed commit information including code changes to analyze impact and understand what was actually done in commits for CV/resume building.

Instructions

Get detailed commit information including code changes (diff) to analyze impact. Use this to understand what was actually done in commits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_nameNoName of the repository (use 'default' for single repo or first repo)
commit_hashYesCommit hash (short or full)
max_linesNoMaximum lines of diff to return (default: 500)

Implementation Reference

  • The main handler function that implements the 'get_commit_details' tool logic. It resolves the repository path, executes 'git show --stat --format=fuller' to retrieve commit details including stats and diff, limits the output lines if necessary, and returns the result as TextContent.
    async def get_commit_details(commit_hash: Optional[str], repo_name: str, max_lines: int) -> list[TextContent]:
        """Get detailed commit information including code changes (diff)."""
        if not commit_hash:
            return [TextContent(type="text", text="Error: commit_hash is required")]
        
        # Resolve repo
        if repo_name == "default" or not repo_name:
            repo_name = list(REPO_DICT.keys())[0] if REPO_DICT else "default"
        
        if repo_name not in REPO_DICT:
            available = ", ".join(REPO_DICT.keys())
            return [TextContent(
                type="text",
                text=f"Repository '{repo_name}' not found.\n\nAvailable repositories: {available}"
            )]
        
        repo_path = REPO_DICT[repo_name]
        
        try:
            # Get commit details
            cmd_show = [
                "git", "show",
                "--stat",
                "--format=fuller",
                commit_hash
            ]
            
            result = subprocess.run(
                cmd_show,
                cwd=repo_path,
                capture_output=True,
                text=True,
                check=True
            )
            
            output = result.stdout
            
            # Limit output if too long
            lines = output.split('\n')
            if len(lines) > max_lines:
                output = '\n'.join(lines[:max_lines])
                output += f"\n\n... (truncated, showing first {max_lines} lines)"
            
            return [TextContent(
                type="text",
                text=f"Commit Details from '{repo_name}':\n\n{output}"
            )]
        
        except subprocess.CalledProcessError as e:
            return [TextContent(type="text", text=f"Git error: {e.stderr}")]
  • The tool registration in list_tools(), defining the name, description, and input schema for 'get_commit_details'.
    Tool(
        name="get_commit_details",
        description="Get detailed commit information including code changes (diff) to analyze impact. Use this to understand what was actually done in commits.",
        inputSchema={
            "type": "object",
            "properties": {
                "repo_name": {
                    "type": "string",
                    "description": "Name of the repository (use 'default' for single repo or first repo)"
                },
                "commit_hash": {
                    "type": "string",
                    "description": "Commit hash (short or full)"
                },
                "max_lines": {
                    "type": "number",
                    "description": "Maximum lines of diff to return (default: 500)",
                    "default": 500
                }
            },
            "required": ["commit_hash"]
        }
    ),
  • The input schema defining parameters: repo_name (optional string), commit_hash (required string), max_lines (optional number, default 500).
    inputSchema={
        "type": "object",
        "properties": {
            "repo_name": {
                "type": "string",
                "description": "Name of the repository (use 'default' for single repo or first repo)"
            },
            "commit_hash": {
                "type": "string",
                "description": "Commit hash (short or full)"
            },
            "max_lines": {
                "type": "number",
                "description": "Maximum lines of diff to return (default: 500)",
                "default": 500
            }
        },
        "required": ["commit_hash"]
  • Dispatch handler in the main call_tool() function that routes calls to 'get_commit_details' and passes arguments.
    elif name == "get_commit_details":
        return await get_commit_details(
            arguments.get("commit_hash"),
            arguments.get("repo_name", "default"),
            arguments.get("max_lines", 500)
        )
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 mentions that the tool returns 'detailed commit information including code changes (diff)' and is for 'analyze impact,' but it lacks critical behavioral details such as whether this is a read-only operation (implied by 'Get' but not stated), potential rate limits, authentication needs, or how the diff is formatted. For a tool with no annotations, this is a significant gap in transparency.

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 appropriately sized and front-loaded: two concise sentences that directly state the purpose and usage. The first sentence defines the tool's function, and the second provides a brief guideline. There is no wasted text, making it efficient and easy to parse.

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

Completeness3/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 (3 parameters, no output schema, no annotations), the description is partially complete. It covers the basic purpose and usage but lacks details on behavioral traits, output format, or how it integrates with sibling tools. Without annotations or an output schema, the description should do more to compensate, but it provides a minimal viable explanation, leaving gaps in full context.

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, so the schema already documents all parameters (repo_name, commit_hash, max_lines) with their types and defaults. The description adds no additional parameter semantics beyond what's in the schema—it doesn't explain parameter interactions, constraints, or usage examples. With high schema coverage, the baseline is 3, as the description doesn't compensate but also doesn't detract.

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: 'Get detailed commit information including code changes (diff) to analyze impact.' It specifies the verb ('Get'), resource ('commit information'), and scope ('including code changes (diff)'). However, it doesn't explicitly differentiate from sibling tools like 'get_git_log' or 'analyze_commits_impact', which might have overlapping functionality, so it doesn't reach a 5.

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

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance: 'Use this to understand what was actually done in commits.' This suggests the tool is for analyzing commit details, but it doesn't explicitly state when to use it versus alternatives like 'get_git_log' (which might list commits) or 'analyze_commits_impact' (which might assess broader effects). No exclusions or specific contexts are mentioned, so it's not fully explicit.

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/eyaab/cv-resume-builder-mcp'

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