Skip to main content
Glama
Pagewright (browser-mcp)

Pagewright (browser-mcp)

by zamansheikh

browser_evaluate

Runs JavaScript in a browser tab and returns JSON results, enabling custom DOM extraction or page-state checks with top-level await support.

Instructions

Run JavaScript in the page and return the JSON result. Supports top-level await. Example: "document.querySelectorAll('a').length". Not available when the extension was installed from the Chrome Web Store (browser_status shows evaluateAvailable); prefer the other tools.

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": {
      "expression": "<expression>"
    },
    "name": "browser_evaluate"
  }
}

Input Schema

NameRequiredDescriptionDefault
tabIdNoTab to act on. Defaults to the tab last opened/selected by an agent, else the active tab.
expressionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.1

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does real work: it discloses await support, that results come back as JSON, and a hard availability gate tied to installation channel. It omits error/exception behavior, timeouts, and whether non-serializable return values are coerced or rejected, which matters for an arbitrary-code-execution tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences: capability first, then the await detail, then an example and the availability caveat. Nothing is wasted, though the availability restriction is arguably important enough to lead with rather than trail.

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

Completeness5/5

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

No output schema exists, so the description must cover the return path, and it does ('return the JSON result'). Combined with the await note and the availability gate, an agent has enough to invoke it correctly and to know when it must fall back to other tools.

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?

Schema coverage is 50%: tabId is documented in the schema while expression is bare. The description partially compensates by supplying a concrete example expression and stating that await is permitted, but it does not describe evaluation context, serialization constraints, or what the expression should resolve to.

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 names a specific verb and resource: run JavaScript in the page and return the JSON result. It goes beyond the name by adding top-level await support and an inline example expression, so an agent knows exactly what capability this exposes relative to read-only siblings like browser_get_content.

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?

It states an explicit when-not-to-use condition (unavailable for Chrome Web Store installs, checkable via browser_status's evaluateAvailable flag) and a general routing rule ('prefer the other tools'). It stops short of naming which sibling to use for which task, leaving the agent to infer the mapping.

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