Skip to main content
Glama
pm990320

ultimate-playwright-mcp

by pm990320

browser_evaluate

Execute JavaScript in the browser to interact with hidden or shadow DOM elements. Run arbitrary code to click, extract data, or manipulate the page, optionally scoped to a specific element.

Instructions

Execute JavaScript in the page context via Playwright's page.evaluate(). Use for interacting with elements not in the accessibility snapshot (portal divs, framework overlays, shadow DOM). Can run arbitrary JS — click hidden elements, extract data, manipulate the DOM. Optionally scope to a specific element via ref.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYesJavaScript expression or function body to evaluate in the browser. Can be a simple expression like `document.title` or a function like `() => document.querySelector('.menu').click()`. If ref is provided, receives the element as first argument: `(el) => el.textContent`.
refNoOptional element reference from snapshot (e.g., 'e1'). If provided, the expression receives the DOM element as its first argument.
targetIdNoTarget ID of the tab
Behavior4/5

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

With no annotations, the description carries full burden. It discloses that it can run arbitrary JS, click hidden elements, extract data, and manipulate the DOM. It does not cover async behavior, error handling, or return value, but covers key behavioral traits.

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?

Three sentences each add value: first states core action, second gives use case, third adds optional scoping. No wasted words.

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 description explains when and how to use the tool, but does not mention the return behavior (the expression's result is returned). Given no output schema, this is a minor gap.

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

Parameters5/5

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

The schema has 100% coverage, but the description adds significant value beyond schema by explaining that expression can be a function body and that ref passes the element as argument, with examples.

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 verb 'Execute JavaScript' and the resource 'in the page context'. It distinguishes from sibling tools by specifying it is for interacting with elements not in accessibility snapshots, such as portal divs and shadow DOM.

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?

The description explicitly says to use this tool for elements not in the accessibility snapshot, providing clear context. However, it does not mention when not to use it or suggest alternative tools like browser_click.

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

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