Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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.' }; }
  • 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: {} } }); }
  • 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;
  • 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(); };
  • In-memory storage for push history records, used by the get_push_history handler.
    const pushHistory = [];

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/liliangshan/mcp-server-mgit'

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