Skip to main content
Glama

browser_eval

Execute JavaScript in the main world of a live Chrome or Brave page to inspect or modify content; optionally target a specific tab or frame.

Instructions

Evaluate JavaScript in the page main world. Nonzero frameId targets that Chrome frame when available to CDP.

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_eval"
  }
}

Input Schema

NameRequiredDescriptionDefault
tabIdNoOptional browser tab id to act on instead of the focused tab.
frameIdNo
timeoutMsNo
expressionYes
awaitPromiseNo
returnByValueNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.6.0

TDQS

C2.8/5.0
Behavior2/5

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

With no annotations, the description carries the full behavioral burden; it usefully discloses main-world execution and conditional CDP frame targeting. It does not address possible page side effects, what happens when a frame is unavailable, evaluation errors, timeouts, promise handling, or result serialization.

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 definition is front-loaded and compact, with the core purpose first and the frame-targeting qualification second. Both sentences contribute useful information without filler or repetition.

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?

For a six-parameter JavaScript evaluation tool with no annotations or output schema, purpose and frame routing alone leave material gaps. An agent can construct a basic call but must still infer promise, return-value, timeout, failure, and side-effect behavior.

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

Parameters2/5

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

Schema description coverage is only 17%, and the description compensates mainly by clarifying that expression contains JavaScript and how a nonzero frameId affects targeting. It adds nothing for timeoutMs, awaitPromise, or returnByValue, leaving most parameter behavior to inference.

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?

“Evaluate JavaScript in the page main world” states a specific action, resource, and execution context. It does not explicitly distinguish the tool from sibling browser operations, so it falls short of 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 Guidelines2/5

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

The main-world wording implies a technical use context, and the second sentence explains one frameId condition. However, there is no guidance on when to choose script evaluation over other browser tools, when not to use it, or any prerequisites or alternatives.

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