Skip to main content
Glama
davidorex

Git File Forensics MCP

by davidorex

track_file_versions

Analyze complete version history of a specific file in a git repository, tracking renames and moves to understand its evolution.

Instructions

Track complete version history of a specific file, including renames and moves

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoPathYesPath to git repository
fileYesFile to analyze
outputPathYesPath to write analysis output

Implementation Reference

  • The primary handler function for the 'track_file_versions' tool. It fetches the complete Git history and renames for the specified file, generates a summary, writes the analysis as JSON to the output path, and returns a success message.
    private async handleFileVersions(args: FileVersionArgs) {
      const history = this.getCompleteFileHistory(args.repoPath, args.file);
      const renames = this.getFileRenames(args.repoPath, args.file);
      
      const analysis = {
        history,
        renames,
        summary: this.generateVersionSummary(history),
      };
    
      writeFileSync(args.outputPath, JSON.stringify(analysis, null, 2));
    
      return {
        content: [
          {
            type: 'text',
            text: `File version analysis written to ${args.outputPath}`,
          },
        ],
      };
    }
  • src/index.ts:146-167 (registration)
    Tool registration in the ListTools handler, including name, description, and input schema definition.
    {
      name: 'track_file_versions',
      description: 'Track complete version history of a specific file, including renames and moves',
      inputSchema: {
        type: 'object',
        properties: {
          repoPath: {
            type: 'string',
            description: 'Path to git repository',
          },
          file: {
            type: 'string',
            description: 'File to analyze',
          },
          outputPath: {
            type: 'string',
            description: 'Path to write analysis output',
          },
        },
        required: ['repoPath', 'file', 'outputPath'],
      },
    },
  • TypeScript interface defining the input parameters for the track_file_versions tool.
    interface FileVersionArgs {
      repoPath: string;
      file: string;
      outputPath: string;
    }
  • Runtime validation function to check if arguments match FileVersionArgs shape before calling the handler.
    private isFileVersionArgs(args: unknown): args is FileVersionArgs {
      return (
        typeof args === 'object' &&
        args !== null &&
        'repoPath' in args &&
        'file' in args &&
        'outputPath' in args &&
        typeof (args as FileVersionArgs).repoPath === 'string' &&
        typeof (args as FileVersionArgs).file === 'string' &&
        typeof (args as FileVersionArgs).outputPath === 'string'
      );
    }
  • Helper function that executes Git command to retrieve the complete version history of the file, including follow for renames.
    private getCompleteFileHistory(repoPath: string, file: string) {
      const output = execSync(
        `cd "${repoPath}" && git log --follow --format="%H|%aI|%an|%s" -- "${file}"`,
        { encoding: 'utf8' }
      );
    
      return output.trim().split('\n').filter(Boolean).map(line => {
        const [hash, date, author, message] = line.split('|');
        return { hash, date, author, message };
      });
    }
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. While 'track' implies a read-only operation, the description doesn't specify whether this tool requires specific permissions, how it handles errors, or what the output entails (e.g., format, location). For a tool with three parameters and 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 a single, efficient sentence that front-loads the core purpose without unnecessary details. It avoids redundancy and wastes no words, making it highly concise and well-structured for quick understanding.

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 complexity (three required parameters, no annotations, no output schema), the description is incomplete. It doesn't explain the output format, error handling, or behavioral traits like rate limits or authentication needs. For a tool that likely involves file system operations and version tracking, more context is needed to ensure proper usage.

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?

Schema description coverage is 100%, so the input schema already documents all three parameters ('repoPath', 'file', 'outputPath') with descriptions. The description adds no additional meaning beyond what the schema provides, such as examples or constraints. Baseline 3 is appropriate when the schema handles parameter documentation adequately.

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: 'Track complete version history of a specific file, including renames and moves.' It specifies the verb ('track'), resource ('version history of a specific file'), and scope ('including renames and moves'). However, it doesn't explicitly differentiate from sibling tools like 'analyze_file_context' or 'analyze_file_diff,' which likely focus on different aspects of file analysis.

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. It lacks any mention of prerequisites, context for usage, or comparisons to sibling tools such as 'analyze_file_context' or 'analyze_file_diff.' This absence leaves the agent without clear direction on tool selection.

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/davidorex/git-file-forensics'

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