Magnet- or solenoid-actuated tool