AzureSets has some code that does this, so we could likely tweak and reuse:
Quote: 
function get_current_spellset()
    --if not a BLU main, quit
    if windower.ffxi.get_player().main_job_id ~= 16 then return nil end
    --get set spells
    return T(windower.ffxi.get_mjob_data().spells)
    -- Returns all values but 512
    :filter(function(id) return id ~= 512 end)
    -- Transforms spells from IDs to lowercase English names
    :map(function(id) return spells[id].english:lower() end)
    -- Transform the keys from numeric x or xx to string 'slot0x' or 'slotxx'
    :key_map(function(slot) return 'slot%02u':format(slot) end)
end
Looks like you want to use windower.ffxi.get_mjob_data().spells:
Quote: 
windower.ffxi.get_mjob_data()
Returns a table containing main job info. May be empty if no job data is provided. Currently provides:
    PUP (attachments and Automaton stats)
    BLU (which spells are set)
    MON (species and instincts)
That'll return a full table that you'll have to loop over to check for either the hardcoded IDs or reuse the call to spells[id].english:lower() to return things like "magic fruit" and "white wind".
I didn't write the actual code here, so uh, let me know if that's not clear.