Skip to main content
Glama

Evaluate an expression

evaluate

Runs JavaScript expressions in a paused or running Node.js debug session to inspect frame locals, call functions, mutate state, or await promises.

Instructions

Evaluate a JavaScript expression. While paused it runs in the chosen frame (default innermost) and can see locals; while running it runs in the global scope with require available (paths relative to the process cwd) and awaits promises. Side effects are allowed, so this can also mutate state or call functions. If the expression calls into code that hits a breakpoint, the pause is reported and the process stays paused there.

Input Schema

NameRequiredDescriptionDefault
frameNoFrame index to evaluate in (paused only).
expressionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and delivers: it discloses that side effects are allowed and state can be mutated, that promises are awaited, that `require` paths are relative to the process cwd, and that a breakpoint hit inside the expression reports a pause and leaves the process paused. These are exactly the non-obvious behaviors an agent needs before invoking an eval tool.

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?

Three dense sentences, no filler, with the core verb front-loaded and the paused/running distinction organized in parallel clauses. It is information-rich rather than padded, though the single paragraph is heavy for a two-parameter tool.

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 debugger eval tool with no annotations and no output schema, the description covers scope, side effects, async behavior, and nested-pause semantics thoroughly. It stops short of describing what happens when the expression throws or what the result payload looks like, which is the remaining gap given no output schema exists.

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 50%: `expression` has no schema description at all, so the description must compensate, and it does by explaining what the expression sees in each execution mode. It also adds the default frame value ('innermost') that the schema's bare 'Frame index to evaluate in (paused only)' does not provide.

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+resource ('Evaluate a JavaScript expression') and immediately characterizes the execution context, which is the crux of the tool. It never names or contrasts with the closely related siblings (get_properties, get_scopes, get_output), so an agent must infer the boundary itself, keeping it below a 5.

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?

It clearly states the two contexts of use and what each implies: paused runs in the chosen frame (default innermost) with locals visible, running executes in global scope with `require` available. That is real when-to-use guidance, but there are no exclusions or explicit 'use X instead' routing against siblings like get_properties.

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