See the question and my original answer on StackOverflow

The first line should work but, believe it or not, it's a 2 years bug that's been fixed yesterday: Can't access payload in action method

The issue is the payload (so here { searchString: "test" }) was simply not passed to the action's run method Fixes https://github.com/microsoft/monaco-editor/issues/2547 #176504 as shown here:

Fixes https://github.com/microsoft/monaco-editor/issues/2547 #176504

PS: The fix is not yet release in the downloadable version as of today.