Skip to main content
Glama
microsoft

Playwright MCP Server

Official
by microsoft

browser_run_code

Destructive

Execute Playwright code snippets to automate browser interactions, test web applications, or extract data from web pages 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 annotations already indicate this is a destructive, open-world operation that isn't read-only. The description doesn't contradict these annotations, and it adds useful context by specifying that the code will be invoked with a 'page' argument for browser interactions, which helps users understand the execution environment beyond what annotations provide.

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 perfectly concise at just four words, front-loading the essential information with zero wasted words. Every element earns its place by communicating the core functionality efficiently.

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

Completeness3/5

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

For a destructive, open-world tool with no output schema, the description adequately covers the basic purpose but lacks important context about execution scope, error handling, or return values. Given the complexity of running arbitrary code and the rich annotation set, more behavioral details would be helpful for safe usage.

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 with examples. The description doesn't add any additional parameter semantics beyond what's in the schema, so it meets the baseline expectation but doesn't provide extra value.

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 'Run Playwright code snippet' clearly states the action (run) and resource (Playwright code), making the purpose immediately understandable. However, it doesn't distinguish this general-purpose code execution tool from more specific sibling tools like browser_click or browser_type, which perform specific browser interactions.

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 provides no guidance on when to use this tool versus the many specific sibling tools. It doesn't mention that this is for custom Playwright scripts when predefined actions aren't sufficient, nor does it warn about potential misuse when simpler alternatives exist.

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

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