Can "Summarize selection" work across multiple documents, or is it limited to only a single document at a time?
Also, the Notes app on macOS has a reasonably comprehensive AppleScript Dictionary associated with it for scripting; have you considered using osascript with either AppleScript (ugh) or JavaScript to expand your cross-document capabilities?