Skip to main content
Glama

browser_eval

Evaluate a JavaScript expression in a rendered page and return JSON results to inspect page context during OSINT reconnaissance.

Instructions

Run a JavaScript expression inside a rendered page and return the JSON result.

Example: "JSON.stringify(Object.keys(localStorage))" or "document.querySelectorAll('script').length". Only evaluate expressions you trust; this executes arbitrary JS in the page context.

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

Input Schema

NameRequiredDescriptionDefault
urlYes
wait_msNo
expressionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0

TDQS

A3.6/5.0
Behavior4/5

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

With no annotations present, the description still discloses the key behavioral trait: it executes arbitrary JS in the page context, and results come back as JSON. It omits failure modes such as syntax errors, timeouts, or non-serializable return values, which is the main remaining gap for a full-burden case.

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?

Front-loaded statement of behavior followed by compact examples and a one-clause safety note; nothing is padded. A slightly clearer separation of examples from caution would improve scannability.

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?

No output schema exists, and the description does say the return value is JSON, which is helpful. However, for a three-parameter tool with 0% schema coverage, it leaves the url and wait_ms semantics and error behavior unexplained.

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 description coverage is 0% across three parameters, so the description must compensate. It adds real meaning for expression via two example strings, but says nothing about url or the wait_ms delay (default 1200), leaving two parameters opaque.

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?

The description opens with a specific verb plus resource: run a JavaScript expression inside a rendered page, returning the JSON result. That is clearly distinct from extraction-style siblings, though no sibling is named to sharpen the boundary.

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?

Two concrete expression examples imply when this beats higher-level tools, but there is no explicit when-to-use or when-not-to-use guidance relative to browser_extract or browser_crawl. The trust warning covers risk, not tool selection.

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