evaluate_script

Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON so returned values have to JSON-serializable. Inline JSON results are bounded; use outputFile for exact large results. When execution is paused at a breakpoint, automatically evaluates in the paused ca...

Server JS Reverse MCP zhizhuodemao/js-reverse-mcp
Category Execute
Risk class High
Parameters 00 required

What evaluate_script does on JS Reverse MCP

AI agents invoke evaluate_script to trigger actions in JS Reverse MCP. What it does depends on the arguments the agent supplies, and its effects often reach beyond the immediate call — builds kicked off, notifications sent, workflows started.

Why evaluate_script needs a policy

This tool executes arbitrary JavaScript in the context of a web page. An AI agent could misuse this to run any code in the browser context, including stealing credentials/cookies, modifying page content, making unauthorized network requests, or exfiltrating sensitive data. The ability to evaluate arbitrary JS in a live page context is extremely high risk with a very large blast radius.

From the tool's definition Evaluate a JavaScript function inside the currently selected page

Questions about evaluate_script

What does the evaluate_script tool do? +

Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON so returned values have to JSON-serializable. Inline JSON results are bounded; use outputFile for exact large results. When execution is paused at a breakpoint, automatically evaluates in the paused call frame context. Use localFilePath when the function needs one local data file, commonly a network body or JSON exported by another tool. The MCP server reads the file and passes it as localFile; browser JavaScript does not read local paths. It is categorised as a Execute tool in the JS Reverse MCP MCP Server, which means it can trigger actions or run processes. Use rate limits and argument validation.

How do I enforce a policy on evaluate_script? +

Register the JS Reverse MCP server in PolicyLayer and add a rule for evaluate_script: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches JS Reverse MCP. Nothing to install.

What risk level is evaluate_script? +

evaluate_script is a Execute tool with high risk. Execute tools should be rate-limited and have argument validation enabled.

Can I rate-limit evaluate_script? +

Yes. Add a rate_limit block to the evaluate_script rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.

How do I block evaluate_script completely? +

Set action: deny in the PolicyLayer policy for evaluate_script. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.

What MCP server provides evaluate_script? +

evaluate_script is provided by the JS Reverse MCP server (zhizhuodemao/js-reverse-mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.