Skip to main content
Glama

eval

Run JavaScript in the open three.js page to inspect the scene, measure models, or test geometry changes before editing source, returning JSON with results and console logs.

Instructions

Runs JavaScript in the open page and returns what it returns, as JSON, then up to 5 lines it logged (console.log, warn, info) and up to 5 console errors. In scope: scene, camera, renderer, find(name), stats(target) (vertices, triangles, bounds, closed, volume, genus per mesh), realNow(), window, and THREE on a page that loads three through an import map. performance.now, Date and timers run on the harness's paused clock (code that awaits a timer or frame steps it until done), so to time code here use realNow() (real milliseconds), and end GPU work before reading it (a 1-pixel gl.readPixels; on WebGPU, await renderer.backend.device.queue.onSubmittedWorkDone()). Use it to inspect the scene, try a change before writing it into the source, measure an imported model, or check procedural geometry with stats after each step; changes vanish on reload. A thrown error names where it threw: a line of this code or of the page's own files. Code that keeps the page busy for 30 s (longer on a busy host) is stopped and the page kept: split long work across calls, or await a 0 ms timer every few hundred iterations.

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": {
      "code": "<code>"
    },
    "name": "eval"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesThe body of an async function; return the value to see.
gameNoThe name the game was opened under with the `open` tool, to act on ("main" by default; a subagent uses its own).
saveNoWrite what the code returns (an ArrayBuffer, typed array, Blob, canvas or data URL) to this path under cwd, e.g. assets/baked.glb or data/mask.png, and reply with its size instead of the bytes: baked geometry, a painted canvas, measured tables.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

A4.4/5.0
Behavior5/5

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

Goes far beyond the readOnlyHint=false / openWorldHint=true annotations: it enumerates the injected scope (scene, camera, renderer, find, stats, realNow, THREE), discloses that performance.now/Date/timers run on a paused clock and how to get real time, explains how to flush GPU work before reading pixels, and states that mutations are discarded on reload. It even documents the 30 s busy-page cutoff and the recovery behavior ('the page kept'), with a mitigation strategy for long work.

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 with the purpose and return shape, and nearly every clause carries operational value (clock semantics, GPU flush, timeout, error attribution). It is a dense single block with heavy parenthetical nesting, which makes it slower to scan than a lightly structured version would be, but there is little genuine waste.

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

Completeness5/5

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

For an arbitrary-code-execution tool with no output schema, the description covers everything an agent needs: what is in scope, what the return value looks like, how logs and errors are surfaced, side-effect persistence, timing semantics, and failure/timeout behavior. Nothing material is left to inference.

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 coverage is 100%, so the schema already explains code, game, and save individually. The description adds one genuinely useful nuance — that thrown errors name where they threw, a line of this code or of the page's own files — but says nothing about the game or save parameters beyond what the schema provides, so the baseline 3 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?

States a specific verb and resource — 'Runs JavaScript in the open page and returns what it returns, as JSON' — plus what comes back alongside it (up to 5 log lines, up to 5 console errors). That return-shape detail distinguishes it cleanly from siblings like interact, look, or observe, which act on the page rather than executing arbitrary code in it.

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 concrete use cases: inspect the scene, try a change before writing it into the source, measure an imported model, check procedural geometry with stats after each step. It also warns that changes vanish on reload, which implicitly bounds when this is preferable to editing source. It does not name an alternative tool or say when not to use it, so it stops short of explicit routing.

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