Skip to main content
Glama
Playwright Smart MCP

Playwright Smart MCP

by jaystarz1

browser_execute_code

Execute JavaScript in the current browser page context to bypass complex UI components when standard interactions fail.

Instructions

Execute JavaScript code in the current browser page context. Use this when standard interactions fail due to complex UI components.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "browser_execute_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesJavaScript code to execute in the page

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

B3.4/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full disclosure burden and largely drops it. It never says whether the code's return value comes back to the caller, whether mutations to the page persist, whether execution is sandboxed or timed out, or what happens on a thrown exception. For arbitrary code execution in a live page, these are material omissions.

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?

Two sentences, both front-loaded: what it does first, then when to use it. Nothing is redundant or padded.

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?

This is a high-risk, high-power tool with no annotations and no output schema, so the description should explain result handling and side effects. Instead it covers only purpose and a one-line trigger, leaving an agent unsure how to retrieve the execution result or what state changes it may cause.

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?

There is a single required parameter with 100% schema description coverage, so the schema already explains that 'code' is JavaScript to run in the page. The description adds no format, async/await, or return-handling detail beyond that, which is the expected baseline here.

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?

States a specific verb and resource: 'Execute JavaScript code in the current browser page context.' That is concrete and distinguishable from extraction, interaction, and screenshot siblings. It stops short of naming a sibling, but the scope is unambiguous.

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

Usage Guidelines4/5

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

'Use this when standard interactions fail due to complex UI components' gives a clear trigger condition for reaching for this tool over normal interaction. It does not say when NOT to use it or name the alternative tools to try first, which keeps it from a 5.

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