Skip to main content
Glama

browser_evaluate

Run JavaScript expressions in the current page and get results as JSON to read state that snapshots hide, such as document.title, localStorage values, or window flags.

Instructions

Run a JavaScript expression in the page and get the result as JSON. Useful for reading state the snapshot hides (e.g. document.title, localStorage, window flags).

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
expressionYesJavaScript expression, e.g. document.title

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.6/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 burden. It says the result comes back as JSON, but gives no indication of whether arbitrary JS side effects are allowed, whether promises are awaited, or how evaluation errors are surfaced — all critical for an execute-arbitrary-code tool.

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, front-loaded with the action and followed by the discriminating use case. No filler or redundant restatement of the tool name.

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?

Adequate for a one-parameter tool with no output schema: it names the return format and gives example usages. It stops short of covering error behavior and async/side-effect semantics, which are the main unknowns for an arbitrary-evaluation tool.

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?

Only one parameter exists and the schema already documents it at 100% coverage with the same 'document.title' example. The description's added value is showing the broader state-reading use case rather than syntax details, which is a modest but real contribution given how little there is to specify.

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 a JavaScript expression in the page and get the result as JSON.' It also implicitly contrasts with browser_snapshot ('reading state the snapshot hides'), which helps an agent pick between the two, though no other sibling is mentioned.

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?

Gives a clear use context with concrete examples (document.title, localStorage, window flags) and frames it as the fallback when the snapshot is insufficient. It does not state when NOT to use it or warn that full scripted interactions should go through browser_click/browser_type instead.

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