push_changes
Commit and push LaTeX project changes from local machine to Overleaf using Git integration.
Instructions
Commit and push changes to Overleaf
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| localPath | Yes | The local path of the project | |
| message | Yes | Commit message |
Implementation Reference
- src/git-manager.ts:69-88 (handler)Core handler implementing git add, status check, commit, and push logic for the push_changes tool.async pushChanges(localPath: string, message: string) { if (!await fs.pathExists(localPath)) { throw new Error(`Directory ${localPath} does not exist`); } const git: SimpleGit = simpleGit(localPath); try { await git.add('.'); const status = await git.status(); if (status.staged.length === 0 && status.created.length === 0 && status.modified.length === 0 && status.deleted.length === 0 && status.renamed.length === 0) { return { success: true, message: 'No changes to commit' }; } await git.commit(message); await git.push(); return { success: true, message: 'Pushed changes to Overleaf' }; } catch (error: any) { throw new Error(`Failed to push changes: ${error.message}`); } }
- src/index.ts:143-149 (handler)MCP CallToolRequest handler case that extracts arguments and delegates to gitManager.pushChanges.case 'push_changes': { const { localPath, message } = request.params.arguments as any; const result = await gitManager.pushChanges(localPath, message); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
- src/index.ts:72-89 (registration)Tool registration in ListToolsRequestHandler, including name, description, and input schema.{ name: 'push_changes', description: 'Commit and push changes to Overleaf', inputSchema: { type: 'object', properties: { localPath: { type: 'string', description: 'The local path of the project', }, message: { type: 'string', description: 'Commit message', }, }, required: ['localPath', 'message'], }, },
- src/index.ts:75-88 (schema)Input schema definition for the push_changes tool, specifying localPath and message parameters.inputSchema: { type: 'object', properties: { localPath: { type: 'string', description: 'The local path of the project', }, message: { type: 'string', description: 'Commit message', }, }, required: ['localPath', 'message'], },