It could just be much easier, you could just make it so if the player is holding a tool named something, it drops something specific;
on break:
if event-block is [block]
cancel drops
if players tool is a diamond pickaxe named "[name]":
set {_amount} to random integer between [fortune number and [fortune number]
set {_drop} to {_amount} of [item] named "optional"
drop {_drop} at event-blocks location