Skip to main content
Glama

browser_run_code_unsafe

Destructive

Execute a custom Playwright JavaScript snippet to automate page interactions and return results. Use for advanced browser control when standard tools are insufficient.

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.77

TDQS

A4.2/5.0
Behavior5/5

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

The description explicitly warns that the tool 'executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.' This goes beyond the destructiveHint annotation by detailing the specific nature and severity of the risk, providing critical transparency for safe usage.

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 concise, consisting of a single purpose statement followed by a brief safety warning. It is front-loaded and contains no unnecessary fluff, making it easy to parse and act upon.

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?

The tool is well-covered given its complexity: parameters are thoroughly described, and the safety implication is clearly stated. No output schema exists, so not specifying return values is acceptable. A minor note about the function's return behavior could enhance completeness but is not essential.

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

Parameters4/5

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

Schema descriptions for both parameters are detailed: 'code' explains the expected function signature with the 'page' argument, and 'filename' clarifies its role and precedence over 'code'. Since schema coverage is 100% and descriptions are rich, the baseline is elevated; minor extra context could be added but is not necessary.

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

Purpose5/5

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

The description clearly states the tool's action ('Run a Playwright code snippet') and the specific object (Playwright code). It distinguishes itself from sibling browser tools by highlighting arbitrary JavaScript execution on the server side, making it unique among the listed tools.

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?

While the description provides a safety warning, it does not explicitly state when to use this tool versus alternatives such as browser_evaluate or other browser interaction tools. There is no guidance on scenarios that warrant arbitrary Playwright code over the more specific tools.

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/1000carlospena-prog/playwright-mcp-render-mthoinc7'

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