Skip to main content
Glama

eval

Execute a JavaScript expression in the current browser page to inspect or modify the DOM; use query for data extraction because strict CSP may block it.

Instructions

Run a JS expression in the page. NOTE: fails on any site with a strict CSP (no unsafe-eval) — most large sites. Prefer query for data extraction. Isolated world: sees the DOM, not the page's own JS variables.

Input Schema

NameRequiredDescriptionDefault
exprYes
tabIdNoTarget tab id. Omit to use the active controlled tab.
spaceIdNoPin this command to an owned BeatBrowser TaskSpace. Also pass its tabId.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.4.1

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden, and it does disclose two real behavioral traits: likely failure on CSP-restricted sites and isolated-world execution scope. It does not mention that the expression can mutate page/global state or how the return value is surfaced, which matters for an arbitrary-code-execution 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?

Three tight sentences with zero filler; the core action is front-loaded and the caveats are ordered by severity (hard failure first, preference second, scoping third).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a no-annotation, no-output-schema tool with a required expression parameter, the description covers failure modes and execution context well. It stops short of explaining what the agent gets back from the expression (serialization, return type), which is the one thing an agent cannot infer from structured fields here.

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?

Three parameters at 67% schema description coverage: tabId and spaceId are documented in the schema, but `expr` (the required one) has no description in either place. The description adds no parameter-level meaning, so the baseline 3 for middling coverage applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Names a specific verb and resource ('Run a JS expression in the page') and immediately distinguishes itself from the sibling `query` tool by naming the data-extraction case it does not serve. The isolated-world note further separates it from any tool that would reach page-level JS state.

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 explicit when-not conditions (strict CSP sites, page's own JS variables) and a named alternative ('Prefer `query` for data extraction'). What's missing is a positive statement of when eval is the right choice rather than query or `act`.

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