Skip to main content
Glama

evaluate_expression

Evaluate JavaScript expressions in a specific call frame or global context to inspect variables, test logic, and understand program state during debugging.

Instructions

Evaluates a JavaScript expression in the context of a specific call frame or global context. Use this to inspect variables, test expressions, or understand the program state. The expression is evaluated in the JavaScript runtime, so you can call methods, access properties, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYesID of the debugging session.
expressionYesJavaScript expression to evaluate. Examples: "myVariable", "array.length", "JSON.stringify(data)", "obj.method()"
call_frame_idNoOptional call frame ID to evaluate in. If not provided, evaluates in the global context. Obtain call_frame_id from get_call_stack. Evaluating in a frame provides access to local variables.
return_by_valueNoWhether to return the result by value (serialised) or as a remote object reference. Defaults to true. Set to false for large objects to avoid serialisation overhead.
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses that the expression runs in the JavaScript runtime, can call methods and access properties, and mentions the return_by_value option's serialization behavior. This is sufficient for a debugger 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?

The description is two sentences, front-loaded with the core purpose, and each sentence adds necessary detail. No wasted words.

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?

With 4 parameters and no output schema, the description adequately covers evaluation behavior, parameter usage, and context. It could mention that the result is a RemoteObject, but the return_by_value parameter covers serialization. Overall complete for its complexity.

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?

Input schema has 100% description coverage, but the description adds value by providing usage examples for the 'expression' parameter and clarifying that 'call_frame_id' can be obtained from get_call_stack. The examples help an agent form correct expressions.

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?

The description clearly states the tool evaluates JavaScript expressions in a debugging context, with explicit examples like 'myVariable', 'array.length', and 'JSON.stringify(data)'. It distinguishes itself from siblings by specifying it's for inspecting variables, testing expressions, and understanding program 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?

The description explains when to use the tool (inspect variables, test expressions) and provides context about call frames vs global context. However, it does not explicitly state when not to use it or contrast with sibling tools like get_scope_variables or set_variable_value.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/johngrimes/mcp-js-debugger'

If you have feedback or need assistance with the MCP directory API, please join our Discord server