Skip to main content
Glama

evaluate_expression

Evaluate expressions in a debug session to read or modify program state. Uses the current frame unless a frame ID is provided.

Instructions

Evaluate expression in the current debug context. Without frameId, uses the same adopted top frame as stack and locals — at a breakpoint or step that is the frame the program stopped in even when the stack display would hide it — and discloses an automatic thread switch or a hidden paused frame in anchorNote; frame names the frame that was used, on success and on failure. Expressions can read and modify program state. Waits up to 30s by default

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
frameIdNoOptional authoritative stack frame ID from get_stack_trace. When provided, no automatic frame/thread selection occurs
timeoutNoMax time (ms) to wait for the evaluation to complete (default: 30000, max: 600000). On expiry the request fails but the expression may keep executing in the debuggee. Note: your MCP client may enforce its own overall request timeout
sessionIdYes
expressionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.25.1
    • changedInput schema / properties / frameId / description
      Previous value: -"Optional stack frame ID for evaluation context. Must be a frame ID from a get_stack_trace response. If not provided, uses the current (top) frame automatically"New value: +"Optional authoritative stack frame ID from get_stack_trace. When provided, no automatic frame/thread selection occurs"
    • addedInput schema / properties / timeout
      Added value: +{
      +  "description": "Max time (ms) to wait for the evaluation to complete (default: 30000, max: 600000). On expiry the request fails but the expression may keep executing in the debuggee. Note: your MCP client may enforce its own overall request timeout",
      +  "type": "number"
      +}
  2. First observed

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and largely meets it: it warns that expressions can read and modify program state, discloses automatic thread switches or hidden paused frames via anchorNote, and states frame naming on both success and failure. It does not cover error semantics beyond the frame name or any permission/authorization context, so a 5 is not warranted.

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?

The purpose is front-loaded in one sentence, and each following clause adds distinct information (frame adoption, anchorNote disclosure, frame naming, wait default). The embedded em-dash aside about breakpoints and hidden frames is convoluted enough to slow parsing, costing it the top score.

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 4-parameter, no-output-schema, no-annotation tool, the description compensates well by describing anchorNote, frame naming, and side-effect capability that an output schema would otherwise convey. Missing detail on failure modes other than frame naming and on timeout-expiry behavior (which is only in the schema) keeps it from 5.

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 50%: frameId and timeout are already documented in the schema. The description usefully restates the no-frameId fallback behavior and the default wait, but adds nothing for sessionId or expression. Against the coverage baseline this lands at 3.

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 ('Evaluate expression in the current debug context') and immediately distinguishes itself from sibling read tools by explaining that absent a frameId it adopts the same top frame as stack and locals. An agent can tell it apart from get_variables/get_stack_trace without opening a schema.

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?

Explains the key routing decision: pass an authoritative frameId from get_stack_trace to suppress automatic frame/thread selection, otherwise the adopted top frame is used. It implies but never explicitly says 'use this instead of locals when you need to compute or mutate an expression,' so it stops short of a full when/when-not statement.

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