This code was made for GroupTypes but there wouldn’t be much to change for Spectype, Give it a go
Hint for you*
# Collect the parameter groups and convert them to a string list
parameter_groups_enum = System.Enum.GetValues(BuiltInParameterGroup)
parameter_groups = [System.Enum.GetName(BuiltInParameterGroup, group) for group in parameter_groups_enum]