To get the closest bone to a given location you would need to iterate through all the bone locations of the character then check and return the one with the closest distance.
example (untested):