git-monitor
Monitor Git repository activity by tracking logs, status changes, commit history, and contributor analysis to maintain project oversight and identify development patterns.
Instructions
Git monitoring and logging tool for log, status, commits, and contributors operations. Provides comprehensive repository analysis and monitoring capabilities.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | The Git monitoring operation to perform | |
| author | No | Filter by author name or email | |
| branch | No | Branch to analyze (default: current branch) | |
| detailed | No | Show detailed status information (for status operation) | |
| format | No | Commit format (for commits operation) | |
| graph | No | Show commit graph (for commits operation) | |
| grep | No | Filter by commit message pattern | |
| includeStats | No | Include detailed statistics (insertions/deletions) | |
| limit | No | Number of commits to show (1-1000, default: 10 for log, 50 for commits) | |
| projectPath | Yes | Absolute path to the project directory | |
| since | No | Date since when to show logs (e.g., "2024-01-01", "1 week ago") | |
| sortBy | No | Sort contributors by (for contributors operation) | |
| until | No | Date until when to show logs (e.g., "2024-01-01", "1 week ago") |
Implementation Reference
- src/tools/git-monitor.ts:69-127 (handler)Primary handler function for the git-monitor tool. Validates parameters and routes to specific operation handlers: log, status, commits, contributors.async execute(params: GitMonitorParams): Promise<ToolResult> { const startTime = Date.now(); try { // Validate basic parameters const validation = ParameterValidator.validateToolParams('git-monitor', params); if (!validation.isValid) { return OperationErrorHandler.createToolError( 'VALIDATION_ERROR', `Parameter validation failed: ${validation.errors.join(', ')}`, params.action, { validationErrors: validation.errors }, validation.suggestions ); } // Validate operation-specific parameters const operationValidation = this.validateOperationParams(params); if (!operationValidation.isValid) { return OperationErrorHandler.createToolError( 'VALIDATION_ERROR', `Operation validation failed: ${operationValidation.errors.join(', ')}`, params.action, { validationErrors: operationValidation.errors }, operationValidation.suggestions ); } // Route to appropriate handler switch (params.action) { case 'log': return await this.handleLog(params, startTime); case 'status': return await this.handleStatus(params, startTime); case 'commits': return await this.handleCommits(params, startTime); case 'contributors': return await this.handleContributors(params, startTime); default: return OperationErrorHandler.createToolError( 'UNSUPPORTED_OPERATION', `Operation '${params.action}' is not supported`, params.action, {}, ['Use one of: log, status, commits, contributors'] ); } } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; return OperationErrorHandler.createToolError( 'EXECUTION_ERROR', `Failed to execute ${params.action}: ${errorMessage}`, params.action, { error: errorMessage }, ['Check the error details and try again'] ); } }
- src/tools/git-monitor.ts:657-725 (schema)JSON schema definition for git-monitor tool inputs, including all parameters, types, enums, and descriptions for validation.static getToolSchema() { return { name: 'git-monitor', description: 'Git monitoring and logging tool for log, status, commits, and contributors operations. Provides comprehensive repository analysis and monitoring capabilities.', inputSchema: { type: 'object', properties: { action: { type: 'string', enum: ['log', 'status', 'commits', 'contributors'], description: 'The Git monitoring operation to perform' }, projectPath: { type: 'string', description: 'Absolute path to the project directory' }, limit: { type: 'number', description: 'Number of commits to show (1-1000, default: 10 for log, 50 for commits)', minimum: 1, maximum: 1000 }, branch: { type: 'string', description: 'Branch to analyze (default: current branch)' }, since: { type: 'string', description: 'Date since when to show logs (e.g., "2024-01-01", "1 week ago")' }, until: { type: 'string', description: 'Date until when to show logs (e.g., "2024-01-01", "1 week ago")' }, author: { type: 'string', description: 'Filter by author name or email' }, grep: { type: 'string', description: 'Filter by commit message pattern' }, detailed: { type: 'boolean', description: 'Show detailed status information (for status operation)' }, format: { type: 'string', enum: ['short', 'full', 'oneline', 'raw'], description: 'Commit format (for commits operation)' }, graph: { type: 'boolean', description: 'Show commit graph (for commits operation)' }, sortBy: { type: 'string', enum: ['commits', 'lines', 'name'], description: 'Sort contributors by (for contributors operation)' }, includeStats: { type: 'boolean', description: 'Include detailed statistics (insertions/deletions)' } }, required: ['action', 'projectPath'] } }; }
- src/server.ts:492-493 (registration)Registration and dispatch in the main server tool execution switch statement, calling GitMonitorTool.execute.case 'git-monitor': return await this.gitMonitorTool.execute(args);
- src/server.ts:136-136 (registration)Tool schema registration in the listTools handler for MCP tool discovery.GitMonitorTool.getToolSchema(),
- Helper validation configuration defining supported actions for git-monitor and confirming local-only operations (no remote).private static readonly TOOL_OPERATIONS: Record<string, string[]> = { 'git-workflow': ['init', 'commit', 'sync', 'status', 'backup', 'push', 'pull', 'create', 'list', 'get', 'update', 'delete', 'fork', 'search'], 'git-files': ['read', 'search', 'backup', 'list'], 'git-branches': ['create', 'list', 'get', 'delete', 'merge', 'compare'], 'git-issues': ['create', 'list', 'get', 'update', 'close', 'comment', 'search'], 'git-pulls': ['create', 'list', 'get', 'update', 'merge', 'close', 'review', 'search'], 'git-tags': ['create', 'list', 'get', 'delete', 'search'], 'git-release': ['create', 'list', 'get', 'update', 'delete', 'publish', 'download'], 'git-remote': ['add', 'remove', 'rename', 'show', 'set-url', 'prune', 'list'], 'git-reset': ['soft', 'mixed', 'hard', 'reset-to-commit', 'reset-branch'], 'git-stash': ['stash', 'pop', 'apply', 'list', 'show', 'drop', 'clear'], 'git-config': ['get', 'set', 'unset', 'list', 'edit', 'show'], 'git-monitor': ['log', 'status', 'commits', 'contributors'], 'git-backup': ['backup', 'restore', 'list', 'verify'], 'git-archive': ['create', 'extract', 'list', 'verify'], 'git-packages': ['list', 'get', 'create', 'update', 'delete', 'publish', 'download'], 'git-analytics': ['stats', 'commits', 'contributors'], 'git-sync': ['sync', 'status'], 'git-update': ['update', 'history', 'changelog', 'track', 'sync-providers', 'status', 'rollback', 'compare'], 'git-history': ['log', 'track', 'sync', 'export', 'auto'] }; private static readonly REMOTE_OPERATIONS: Record<string, string[]> = { 'git-workflow': ['create', 'list', 'get', 'update', 'delete', 'fork', 'search'], // git-files operations are local by default, remote only when provider is explicitly specified (read-only only) 'git-files': [], 'git-branches': [], // All branch operations are local for now 'git-issues': ['create', 'list', 'get', 'update', 'close', 'comment', 'search'], 'git-pulls': ['create', 'list', 'get', 'update', 'merge', 'close', 'review', 'search'], 'git-tags': [], // All tag operations are local 'git-release': ['create', 'list', 'get', 'update', 'delete', 'publish', 'download'], 'git-remote': [], // Remote operations are local Git commands 'git-reset': [], // Reset operations are local 'git-stash': [], // Stash operations are local 'git-config': [], // Config operations are local 'git-monitor': [], // Monitor operations are local 'git-backup': [], // Backup operations are local 'git-archive': [], // Archive operations are local 'git-packages': ['create', 'update', 'delete', 'publish', 'download'], // list and get are local 'git-analytics': [], // All analytics operations are local by default 'git-sync': [], // All sync operations are local by default 'git-update': ['sync-providers'], // Only sync-providers is remote 'git-history': ['sync'] // sync operation can be remote when using API method };