BOING! This is the Hookshot! It extends and contracts and... BOING! It can grapple many things!
Agahnim's weakness? The Bug-Catching Net. Similar to another later (but optional) strategy with Ganon in Twilight Princess...
And using the shovel to fight the Agahnim-form of the final nightmare boss in Link's Awakening, or the bottle to fight Ganon in Ocarina of Time- all probably in reference to this, as they involve playing energy ball tennis with unconventional objects instead of your sword.