Skip to main content
Glama

js.evaluate

Run JavaScript expressions in a Chromium DevTools console, including $, $$, and $x helpers, and await promises by default to inspect or probe live page state.

Instructions

Run an expression exactly as typing it into the DevTools console would, command-line helpers ($, $$, $x) included. Awaits promises by default.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "js.evaluate"
  }
}

Input Schema

NameRequiredDescriptionDefault
fileNoRead the code from this path on the daemon host instead. Use for long probes, where escaping into JSON is error-prone.
frame_idNo
max_charsNo
target_idNoTarget handle (tgt_*). Omit for the active page.
browser_idNoBrowser handle (br_*). Omit to use the only running browser, or auto-launch one.
expressionNoThe code to run. Omit when using file.
timeout_msNo
await_promiseNo
return_by_valueNo
command_line_apiNo
bypass_module_cacheNoCache-bust dynamic import() calls. Without this the page can return a module it loaded earlier, so a probe silently reports stale values.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

With readOnlyHint=false and openWorldHint=true already declaring that this executes arbitrary code against a live page, the description adds real value by disclosing that promises are awaited by default and that console helpers are in scope. It does not, however, warn that evaluated code can mutate page state, describe timeouts, or say how results are surfaced.

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. The console-equivalence claim comes first because it governs how the agent should think about the tool, and the promise-awaiting default follows as the one behavior most likely to change a call.

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?

This is an 11-parameter, open-world code-execution tool with no output schema, and the description never explains what comes back or how return_by_value / max_chars shape the result. Roughly half the parameters are undocumented everywhere, and for a tool whose main risk is arbitrary execution on a live page, that is a substantial gap.

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 only 45% across 11 parameters, so the description must compensate, and it does for two of the most consequential: "awaits promises by default" documents the default of await_promise, and the $ / $$ / $x mention maps to command_line_api. It still leaves frame_id, max_chars, timeout_ms, and return_by_value entirely unexplained in both schema and prose.

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 (run/evaluate) and resource (an expression in the page's console context), and pins the semantics with a concrete analogy: "exactly as typing it into the DevTools console would." That analogy plus the mention of $ / $$ / $x helpers lets an agent distinguish it from a debugger-frame evaluator, though it never names a sibling.

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 rather than stated: the DevTools-console framing tells an agent this is for ad-hoc page-context probing, but there is no explicit when-to-use/when-not, and no pointer to debugger.evaluate_on_frame for paused-frame evaluation. The agent must infer the boundary from the description's analogy alone.

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

Deploy Server

Other Tools