Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Rephrase "relevant global state" with "observable side effects", which I believe to be a more precise wording. E.g., I wouldn't generally consider data that has been successfully written to an output stream part of "global state", but I would consider it an "observable side effect".
I might at some point write a "real" answer if I get the time, but I have two points: You phrase this question as how to pass all this information to the function cleanly, but I think you should look at if it is the function itself that needs all this data because it is doing too much? But without a more concrete example, it's difficult to tell. Secondly, the type of object you are referring to, I would call a "Request Object". There are good uses for a such, but I normally only use them at the outer boundaries of the system. That didn't seem to be the case in your scenario.