Accessing http request in js-policy

Hi, I want to write a custom js-policy and want to access value of a custom header or a body field (not token) of http request in js script.
Can js-policy scripts do this?
AI gave me such code:

var customHeaderValue = event.request.getHeader("my-custom-header");

However this just doesnt work: “Caused by: :1 ReferenceError: “event” is not defined”

Don’t trust AI for IAM questions, just joking.
Here are some examples [1], or you can review the evaluation class [2] to explore the available methods.

[1] Authorization Services Guide
[2] Evaluation (Keycloak Docs Distribution 25.0.6 API)

thank you for your reply. I already reviewed all of theses though.
I am fine with writing js-based custom policy though.
I just couldnt figure out how to access content of http request in the js script.
and I couldnt see any method that allows access to http context in the given ‘Evaluation’ interface.
I decided to make this implementation in my backend code at the moment.
However, i still would like to learn how to do this with keycloak js-based policy if possible.