Skip to main content
Glama

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 }; }); }

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