Say a character is under the influence of the confusion spell and they roll a 7 or an 8 to determine their action. So they try to attack an adjacent character. Now say the character has at least 2 levels of barbarian so their have the option to perform a reckless attack. Do they have that option available to them under those circumstances? What if the character is wielding a finesse weapon, do they have the option of choosing between strength and dexterity for the attack and damage rolls? What if the character is wielding a two-handed weapon and has the great weapon fighting class feature? Can they choose whether they reroll any damage dice if they hit?
Spells do what they say they do
The creature uses its action to make a melee attack ...
They must make a “melee attack”; the spell requires nothing else. Therefore the details are up to the character - if they are targeting a friend they can make an unarmed strike to minimize damage, if they are targeting an enemy they can go all out.