Skip to main content
Glama
davidorex

Git Forensics MCP

by davidorex

analyze_time_period

Analyze development activity patterns within a specific time period in git repositories to identify trends and changes.

Instructions

Analyze detailed development activity in a specific time period

Input Schema

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

Implementation Reference

  • The primary handler function for the 'analyze_time_period' tool. It processes the input arguments, retrieves commits within the specified time range for each branch using helper methods, generates activity summaries, compiles the results, writes them to the output file, and returns a success message.
    private async handleTimePeriodAnalysis(args: TimePeriodArgs) {
      const analysis = args.branches.map(branch => {
        const commits = this.getCommitsInRange(args.repoPath, branch, args.timeRange);
        return {
          branch,
          commits,
          activitySummary: this.summarizeActivity(commits),
        };
      });
    
      const result = {
        analysis,
        summary: this.generateTimePeriodSummary(analysis),
      };
    
      writeFileSync(args.outputPath, JSON.stringify(result, null, 2));
    
      return {
        content: [
          {
            type: 'text',
            text: `Time period analysis written to ${args.outputPath}`,
          },
        ],
      };
    }
  • src/index.ts:94-124 (registration)
    Registers the 'analyze_time_period' tool in the MCP server's listTools response, including name, description, and input schema.
    {
      name: 'analyze_time_period',
      description: 'Analyze detailed development activity in a specific time period',
      inputSchema: {
        type: 'object',
        properties: {
          repoPath: {
            type: 'string',
            description: 'Path to git repository',
          },
          branches: {
            type: 'array',
            items: { type: 'string' },
            description: 'Branches to analyze',
          },
          timeRange: {
            type: 'object',
            properties: {
              start: { type: 'string' },
              end: { type: 'string' },
            },
            required: ['start', 'end'],
          },
          outputPath: {
            type: 'string',
            description: 'Path to write analysis output',
          },
        },
        required: ['repoPath', 'branches', 'timeRange', 'outputPath'],
      },
    },
  • Dispatcher case in the CallToolRequestSchema handler that validates input parameters using the TimePeriodArgs type and delegates to the main handleTimePeriodAnalysis function.
    case 'analyze_time_period': {
      const args = request.params.arguments as TimePeriodArgs;
      if (!args?.repoPath || !args?.branches || !args?.timeRange || !args?.outputPath) {
        throw new McpError(ErrorCode.InvalidParams, 'Missing required parameters');
      }
      return await this.handleTimePeriodAnalysis(args);
    }
  • TypeScript interface defining the input arguments structure for the 'analyze_time_period' tool, matching the inputSchema.
    interface TimePeriodArgs {
      repoPath: string;
      branches: string[];
      timeRange: {
        start: string;
        end: string;
      };
      outputPath: string;
    }
  • Helper function that executes git log to fetch commits within the specified time range for a given branch, parsing them into structured objects. Called by the main handler.
    private getCommitsInRange(
      repoPath: string,
      branch: string,
      timeRange: { start: string; end: string }
    ) {
      const output = execSync(
        `cd "${repoPath}" && git log --format="%H|%aI|%s" ` +
        `--after="${timeRange.start}" --before="${timeRange.end}" ${branch}`,
        { encoding: 'utf8' }
      );
    
      return output.trim().split('\n').filter(Boolean).map(line => {
        const [hash, date, message] = line.split('|');
        return { hash, date, message, branch };
      });
    }
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 'analyzes' activity, implying a read-only operation, but doesn't clarify if it writes output (as suggested by the 'outputPath' parameter), requires specific permissions, has rate limits, or what the analysis entails. This is inadequate for a tool with no annotation coverage.

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, clear sentence that efficiently conveys the core purpose without unnecessary words. It's front-loaded with the main action and resource, making it easy to parse and understand quickly.

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 no annotations, no output schema, and a tool with 4 parameters (including a nested object), the description is incomplete. It doesn't explain what 'analyze' means in practice, what the output contains, or how it differs from siblings, leaving significant gaps for an agent to use the tool effectively.

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 75% (3 out of 4 parameters have descriptions), so the baseline is 3. The description adds no additional parameter semantics beyond what the schema provides, such as explaining the format of 'timeRange' or the nature of 'outputPath'. It doesn't compensate for the 25% gap in coverage for the nested 'timeRange' object.

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 verb 'analyze' and the resource 'detailed development activity in a specific time period', which is specific enough to understand the tool's function. However, it doesn't explicitly differentiate from sibling tools like 'analyze_file_changes' or 'get_branch_overview', which might also analyze development activity but with different scopes or methods.

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 like 'analyze_file_changes' or 'get_branch_overview'. It mentions analyzing 'detailed development activity' but doesn't specify what that entails or when this tool is preferred over others, leaving the agent to guess based on tool names 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/davidorex/git-forensics-mcp'

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