Your first snippet could be rewritten as
on run
tell application id "DNtp"
return recordNames to name of selected records
end tell
end run
The try
block is not useful here, imo.
Or in JavaScript
function run() {
const app = Application('DEVONthink 3');
return app.selectedRecords.name();
}