Skip to main content
Glama

analyze_time_period

Examine development activity within a specific time frame in a git repository. Analyzes branches, tracks changes, and generates detailed insights for targeted periods to inform project progress and decision-making.

Instructions

Analyze detailed development activity in a specific time period

Input Schema

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

Implementation Reference

  • The main handler function that executes the tool logic. It fetches commits in the specified time range for each branch using git log, summarizes the activity per branch, generates an overall summary, writes the analysis as JSON to the output path, 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)
    Tool registration in the 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'], }, },
  • TypeScript interface defining the input arguments structure for the tool.
    interface TimePeriodArgs { repoPath: string; branches: string[]; timeRange: { start: string; end: string; }; outputPath: string; }
  • src/index.ts:189-195 (registration)
    Dispatch case in the CallToolRequest handler that validates arguments and calls the main handler 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); }
  • Key helper function that executes git log to retrieve commits within the specified time range for a branch.
    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 }; }); }

Other Tools

Related 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