LibBossIDs-1.0 provides a table that flags mobIDs true if the mob linked to the ID is a boss.
Example:
if LibStub("LibBossIDs-1.0").BossIDs[tonumber(mobID)] then print("Found a boss!") end
One can get the mobID from a GUID in the following way:
local _, _, _, _, _, mobID = strsplit("-", UnitGUID("target"))
Target macro:
/run print(tonumber((select(6, strsplit("-", UnitGUID("target"))))))