Adaptive Inverse Kinematics Framework for Learning Variable-Length Tool Manipulation in Robotics