How to read query arguments from query in tampermonkey script?

I’m new to tampermonkey. I’m trying to write a script like this:

I match a url like this:

// @match        *://example.domain.com/path*

The website should have url like this:

https://example.domain.com/path?arg1=foo&arg2=bar

I want to read the query arguments like arg1 inside the script. How can I do it?