How to make IntentFile work like the parameter in Show Result in AppIntents?

In Shortcuts, the Show Result action has two features that I cannot reproduce in my swift code.

  1. Show Result can connect to the previous action's result automatically when it's added. In my code, I added inputConnectionBehavior: .connectToPreviousIntentResult to my parameter, but it won't work.
    @Parameter(title: "input", supportedTypeIdentifiers: ["public.plain-text"], inputConnectionBehavior: .connectToPreviousIntentResult)
    var input: IntentFile
  1. The click of Result slot in Show Result allows users to select variable. In my code, the click of MyParameter will open the FileDialog rather than selecting variables.

So in whatever way I tried, I cannot make my action work exactly like the Show Result does.

How to make IntentFile work like the parameter in Show Result in AppIntents?
 
 
Q