Skip to main content
Glama

browser_run_code

Destructive

Execute Playwright browser automation code to interact with web pages, scrape data, fill forms, and test functionality programmatically.

Instructions

Run Playwright code snippet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesA 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(); }`
Behavior4/5

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

The description doesn't contradict the annotations (which show destructiveHint=true, readOnlyHint=false, openWorldHint=true). While the annotations already indicate this is a destructive, non-read-only operation, the description adds useful context by specifying it runs 'Playwright code snippet' - implying execution of arbitrary browser automation code, which aligns with the open-world nature.

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 extremely concise at just 4 words, front-loading the essential information with zero wasted words. Every element ('Run', 'Playwright', 'code', 'snippet') contributes directly to understanding the tool's purpose.

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

Completeness2/5

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

For a destructive tool (destructiveHint=true) with no output schema, the description is insufficient. It doesn't explain what 'Run' entails operationally, what happens during execution, potential side effects, or what kind of results to expect. Given the complexity implied by arbitrary code execution and the destructive nature, more context is needed.

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?

With 100% schema description coverage, the input schema already fully documents the single 'code' parameter. The description doesn't add any additional parameter semantics beyond what's in the schema, so it meets the baseline for high schema coverage.

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 action ('Run') and the resource ('Playwright code snippet'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this from sibling tools like browser_evaluate or browser_click, which also execute browser actions.

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?

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention that this is for arbitrary Playwright code execution while siblings handle specific actions, nor does it provide any context about prerequisites or appropriate use cases.

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/Playwright-os/Playwright-MCP'

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