Gamma-Ray Imaging, Polarimetry and Spectroscopy (GRIPS) is a proposed space mission for gamma-ray astrophysics. It will be capable of imaging gamma-rays via Compton scattering and pair production in the energy range from ~200 keV up to ~50MeV. GRIPS will address fundamental astrophysical questions through observations of energetic gamma-ray phenomena such as gamma-ray bursts, blazars and supernovae in this unique energy window. The Medium-Energy Gamma-ray Astronomy library (MEGAlib) is an open-source object-oriented software library designed to simulate and analyse data from low-to-medium-energy gamma-ray telescopes, especially Compton telescopes such as GRIPS. The library comprises all necessary data analysis steps from initial simulations through to event reconstruction and image reconstruction. Simulations are being carried out to optimize the sensitivity of GRIPS to gamma-ray sources using MEGAlib and the results are presented here. GRIPS will offer an improvement in sensitivity in its operational energy range by a factor of ~40 compared with previous missions.