Is it possible to get a hold of redirect state parameter within a rule?

I need to redirect to an external service on login, but I don’t fully control the other end. In the rule that I write I would like to get the state parameter and put it into my signed JWT as part of a return url. According to the documentation neither rules nor actions can access that state parameter. Because the param is generated after the rules/action executes.
Are there any workarounds for this scenario that would help avoid writing a dedicated backend for it?

In other words, in the rule code:

  context.redirect = {
    url: "" // ?state=<state> will be added here, how to get this value in the rule?