my-project-repo_get_push_history
Retrieve recent push history to verify changes haven't been pushed before proceeding with batch Git operations.
Instructions
[My Awesome Project] Get the last 5 push history records for repository "my-project-repo". This tool MUST be called before using mgit_push to ensure the current changes have not been pushed before. After calling this tool, you can proceed with mgit_push.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server-final.js:328-342 (handler)Handler function that implements the logic for the 'my-project-repo_get_push_history' tool. It marks push history as checked and returns the last 5 records from in-memory pushHistory array.async get_push_history(params) { // Mark that push history has been checked this.hasCheckedPushHistory = true; // Return last 5 push records const last5Records = pushHistory.slice(0, 5); return { total: pushHistory.length, records: last5Records, message: last5Records.length > 0 ? `Found ${last5Records.length} recent push record(s). Please review them to ensure your current changes have not been pushed before. After reviewing, you can proceed with mgit_push.` : 'No push history found. This appears to be the first push. You can now proceed with mgit_push.' }; }
- src/server-final.js:486-496 (registration)Registration of the tool in the 'tools/list' method response. The name is dynamically set to '${REPO_NAME}_get_push_history' (e.g., 'my-project-repo_get_push_history') if REPO_NAME is set. Includes schema (empty input).// Only include get_push_history tool if CHECK_PUSH_HISTORY is enabled if (CHECK_PUSH_HISTORY) { tools.push({ name: getToolName('get_push_history'), description: getToolDescription(`Get the last 5 push history records for repository "${REPO_NAME}". This tool MUST be called before using mgit_push to ensure the current changes have not been pushed before. After calling this tool, you can proceed with mgit_push.`), inputSchema: { type: 'object', properties: {} } }); }
- src/server-final.js:443-444 (helper)Helper function that prefixes tool names with REPO_NAME, creating 'my-project-repo_get_push_history' from 'get_push_history'.const getToolName = (baseName) => { return REPO_NAME ? `${REPO_NAME}_${baseName}` : baseName;
- src/server-final.js:115-132 (helper)Helper that records new push entries to the in-memory pushHistory array (used after mgit_push).const recordPushHistory = (message, result, error = null) => { const pushEntry = { id: Date.now(), timestamp: new Date().toISOString(), repo_name: REPO_NAME, message: message, success: !error, error: error ? error.toString() : null, exit_code: result ? result.exitCode : null }; pushHistory.unshift(pushEntry); if (pushHistory.length > MAX_PUSH_HISTORY) { pushHistory.splice(MAX_PUSH_HISTORY); } savePushHistory(); };
- src/server-final.js:13-13 (helper)In-memory storage for push history records, used by the get_push_history handler.const pushHistory = [];