Skip to main content
Glama

browser_run_code_unsafe

Destructive

Execute Playwright JavaScript code to automate page interactions and control browser behavior.

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.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.0.80

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already mark the tool as destructive and not read-only. The description adds crucial context beyond the annotations by specifying that code executes in the Playwright server process and is RCE-equivalent. This clarifies the severity and location of execution, which is highly valuable.

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 a single, information-dense sentence that leads with the action and resource, then delivers the critical safety warning. Every word earns its place, with no redundant or filler content.

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 tool with only two parameters, rich annotations, and a 100% covered schema, the description covers the most important operational context: server-side execution, arbitrary JavaScript, and RCE risk. The lack of an explicit return-value description is minor given the code-driven return and absence of an output schema.

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%, with both 'code' and 'filename' thoroughly documented, including an example for 'code'. The tool description provides no additional parameter-level detail, so the schema carries the full burden and a 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 clearly states the tool "Run[s] a Playwright code snippet" and identifies the dangerous nature: it "executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent." This distinguishes it from page-context tools like browser_evaluate, though it does not explicitly name a sibling.

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

Usage Guidelines3/5

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

The description strongly communicates that the tool is unsafe and RCE-equivalent, implying it should only be used when necessary. However, it does not explicitly say when to prefer this tool over alternatives such as browser_evaluate, nor does it state any exclusions or prerequisites.

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

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/nludd25/playwright-mcp'

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