Skip to main content
Glama
1password-browser-mcp

1password-browser-mcp

Evaluate JavaScript

browser_evaluate

Runs JavaScript in the current browser page to extract data or inspect elements, optionally targeting a ref or selector, and returns the JSON-serialized result.

Instructions

Run JavaScript in the page. Provide an expression or a function body; with ref/selector the function receives the element as its argument. Returns the JSON-serialised result.

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
refNoElement ref from browser_snapshot, e.g. "e12"
selectorNoPlaywright selector (CSS, text=..., role=..., xpath=...) used when no ref is given
expressionYese.g. "document.title" or "(el) => el.textContent"

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It usefully discloses that the result is JSON-serialised, hinting at serialisation limits, but says nothing about side effects on page state, whether promises are awaited, what happens if the expression throws, or that this is arbitrary code execution.

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, no filler, with the core action and the element-argument rule front-loaded before the return-value note. Every clause earns its place.

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 code-execution tool with no annotations and no output schema, the definition covers the call shape and return format but leaves error behavior, async handling, and side-effect risk unstated. Adequate to invoke correctly for simple cases, incomplete for a tool of this power.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3, but the description genuinely adds meaning beyond the schema by explaining that expression can be a bare expression or a function body and that ref/selector change the call signature to pass the element as an argument. This is the key semantic the schema's terse examples only hint at.

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 ('Run JavaScript in the page') and clarifies the two expression forms plus the return shape. It does not explicitly contrast itself with siblings like browser_get_text or browser_find, which is the only thing keeping it from a 5.

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

Usage Guidelines3/5

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

Usage is implied through the ref/selector clause ('the function receives the element as its argument'), which tells the agent how to target an element, but there is no statement of when to prefer this over simpler siblings such as browser_get_text or browser_snapshot, and no when-not guidance.

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