Skip to main content
Glama

browser_run_code_unsafe

Destructive

Run arbitrary Playwright code to perform advanced browser actions, enabling custom automation when predefined tools fall short.

Instructions

Run a Playwright code snippet. Unsafe: executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoA JavaScript function containing Playwright code to execute. It will be invoked with a single argument, page, which you can use for any page interaction. For example: `async (page) => { await page.getByRole('button', { name: 'Submit' }).click(); return await page.title(); }`
filenameNoLoad code from the specified file. If both code and filename are provided, code will be ignored.
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description goes beyond the annotations by explicitly stating that it executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent. This is critical behavioral and security context that the annotations alone do not fully convey. It does not contradict the readOnlyHint=false, openWorldHint=true, or destructiveHint=true annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences with zero waste. The primary action is stated first, followed immediately by the essential safety warning. Every word earns its place, and the structure is front-loaded for quick agent comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a dangerous escape-hatch tool, the description covers the key facts: what it does, where the code executes, and why it is dangerous. The schema fully documents parameters, and annotations cover mutation/destructiveness. The only gap is that it does not describe the return value or how to use this tool in relation to the many sibling browser tools, but the core call-and-invoke information is present.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters (code and filename), including an example for code. The description adds no parameter-level detail, but the schema carries the full burden, so the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific action and resource: 'Run a Playwright code snippet.' It clearly identifies the tool's function and adds the critical context that it executes arbitrary JavaScript in the Playwright server process. It does not explicitly differentiate from the sibling browser_evaluate tool, though the server-process framing hints at the distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description warns that the tool is unsafe and RCE-equivalent, which implies it should be used with extreme caution, but it gives no explicit guidance on when to prefer this tool over alternatives like browser_evaluate. No when-to-use or when-not-to-use conditions are stated, and no alternative tools are named.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/1000carlospena-prog/playwright-mcp-render-mthnzbdq'

If you have feedback or need assistance with the MCP directory API, please join our Discord server