This protocol outlines a method for grafting a magnetic bead into the developing zebrafish heart through microsurgery, enabling the manipulation of mechanical forces in vivo and triggering mechanical stimulus-dependent calcium influx in endocardial cells.