A downhole tool includes a top sub-assembly configured to couple to a downhole conveyance operable to move the downhole tool through a wellbore; a housing coupled to the top sub-assembly and including a retention sub-assembly mounted in the housing and a slot formed in a downhole end of the housing and shaped to engage a mudline abandonment cap; and a locking sleeve coupled to the retention sub-assembly and moveable, by the retention sub-assembly, to adjustably lock the slot to the mudline abandonment cap.