Skip to main content
Glama

debugger-evaluate

Evaluates JavaScript expressions in an app runtime to read state, call app functions, or test logic, returning JSON results.

Instructions

Run JavaScript in the app's runtime. React Native uses Hermes, including on Vega. Chromium uses V8. Returns the result serialized by value as JSON, with deviceName, appName, and logicalDeviceId. A returned Promise is awaited and its resolved value returned. Use when you need to read app state, including localStorage and sessionStorage on Chromium, call app functions, or test logic at runtime. Cyclic objects, which many RN runtime values are (fiber nodes, navigation refs, global), fail with a serialization error. Fails if the expression throws or the runtime is not connected. On React Native, a module that fails to load while the expression runs (e.g. a lazy react-native export whose native module the app lacks) fails the call with that module's error instead of opening the app's red box.

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": {
      "device_id": "<device_id>",
      "expression": "<expression>"
    },
    "name": "debugger-evaluate"
  }
}

Input Schema

NameRequiredDescriptionDefault
portNoMetro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. Range: 1 to 65535.
device_idYesDevice id used with debugger-connect.
expressionYesJavaScript expression to evaluate in the app runtime

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / device_id / description
      Previous value: -"Device id from list-devices — the SAME id you passed to debugger-connect (iOS simulator UDID, Android serial, Vega serial, or Chromium device id). The logicalDeviceId debugger-connect returns also resolves here, but prefer the stable list-devices id."New value: +"Device id used with debugger-connect."
    • changedInput schema / properties / port / description
      Previous value: -"Metro server port. Optional — omit it to use this device's port, 8081 by default. Ignored for Chromium, whose CDP port is encoded in device_id."New value: +"Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. Range: 1 to 65535."
  2. Changed5 schema fields changedv0.25.0
    • removedInput schema / properties / port / default
      Removed value: -8081
    • changedInput schema / properties / port / description
      Previous value: -"Metro server port (ignored for Chromium)"New value: +"Metro server port. Optional — omit it to use this device's port, 8081 by default. Ignored for Chromium, whose CDP port is encoded in device_id."
    • addedInput schema / properties / port / maximum
      Added value: +65535
    • addedInput schema / properties / port / minimum
      Added value: +1
    • changedInput schema / properties / port / type
      Previous value: -"number"New value: +"integer"
  3. Changed1 schema field changedv0.17.0
    • changedInput schema / properties / device_id / description
      Previous value: -"Device id from debugger-connect (iOS simulator UDID, Android logicalDeviceId, Vega serial, or Chromium device id)."New value: +"Device id from list-devices — the SAME id you passed to debugger-connect (iOS simulator UDID, Android serial, Vega serial, or Chromium device id). The logicalDeviceId debugger-connect returns also resolves here, but prefer the stable list-devices id."
  4. Changed1 schema field changedv0.16.0
    • changedInput schema / properties / device_id / description
      Previous value: -"Device id from debugger-connect (iOS simulator UDID, Android logicalDeviceId, or Chromium device id)."New value: +"Device id from debugger-connect (iOS simulator UDID, Android logicalDeviceId, Vega serial, or Chromium device id)."
  5. First observedv0.15.0

TDQS

A4.1/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 does so thoroughly: results are serialized by value as JSON, returned Promises are awaited, cyclic objects fail with a serialization error, the call fails if the expression throws or the runtime is not connected, and RN lazy-module load failures surface as that module's error rather than a red box. These are non-obvious failure modes an agent could not infer from the schema.

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 core action and return contract, then usage, then failure modes. Every sentence carries information, though the final sentence about RN lazy module loading is dense and slightly tangential compared to the rest.

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 three-parameter tool with no output schema and no annotations, the description covers the return shape, async semantics, and failure conditions well. It implies but does not explicitly state the prerequisite of an active debugger-connect session, leaving a small gap for first-time use.

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 description coverage is 100%, including port defaults/range and the device_id cross-reference to debugger-connect, so the schema already documents every parameter. The description adds no additional parameter meaning beyond the return payload fields (deviceName, appName, logicalDeviceId), so baseline 3 applies.

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?

Opens with a specific verb+resource ("Run JavaScript in the app's runtime") and enumerates the concrete purposes: reading app state including localStorage/sessionStorage on Chromium, calling app functions, and testing logic. It distinguishes itself from tree/inspection siblings implicitly by being expression evaluation rather than structural introspection, though no sibling is named directly.

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?

"Use when you need to read app state ... call app functions, or test logic at runtime" gives clear positive selection criteria. There are no explicit when-not conditions or named alternatives (e.g. pointing to debugger-component-tree or debugger-inspect-element for structural reads), so it stops short of full routing guidance.

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