Make sure you have SWS Extensions installed https://www.sws-extension.org/
This one is the code from the advanced GUI Midi Snap Tool.
Any extra notes will be moved into the next octave, if you want to Mute the notes instead look at the top of the script
Code:
octave_notes_opt = 2 -- 2 to move extra notes to next octave and 1 to mute extra notes

keyswitch_opt = "No" -- "Yes" if you have keyswitches you don't won't moved "No" no keyswitches

If you have a lot of small midi items it works best if you select all of them and right click> Glue
Any notes that are muted should un-mute if you change the region to another chord and run script on it again.
Use Action "View: Toggle show media cues in items" to show hide Markers in items.
Download: ReaTrak snap midi takes in region to chords.zip

Zoom++