Skip to main content
Glama

debugger-inspect-element

Read-only

Inspect the React component hierarchy at an (x, y) screen point, returning components from the tapped element upward with source file, line, and code fragment for debugging.

Instructions

Inspect the React component hierarchy at a screen coordinate (x, y). Returns components from the tapped element upward through its parent hierarchy, each with its source file:line and a code fragment. The first items (lowest indices) are the most specific: the exact component under the tap point and its direct parents. Higher indices are broader context (page, navigator). Use when you need the source file and line for a component at a point. Convert fractions from debugger-component-tree using the width and height in its Screen line. Fails if the app is disconnected or the point is outside the screen.

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>",
      "x": "<x>",
      "y": "<y>"
    },
    "name": "debugger-inspect-element"
  }
}

Input Schema

NameRequiredDescriptionDefault
xYesHorizontal position in logical pixels from the left edge of the screen.
yYesVertical position in logical pixels from the top edge of the screen.
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.
maxItemsNoMaximum number of hierarchy items to return, most specific first. The default covers all app-specific code; increase to 70+ to also see the navigation/screen structure. Default: 35.
device_idYesDevice id used with debugger-connect.
contextLinesNoLines of source context to include around the component definition. Default: 3.
includeSkippedNoWhen true, items that would normally be filtered are kept in the response with skipped=true and a skipReason. Default: false.
resolveSourceMapsNoWhen true, resolves bundled frame locations to original source files via Metro symbolication and includes a code fragment. When false, returns the raw bundled frame info (file, line, column) without a code fragment. Default: true.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • changedInput schema / properties / contextLines / description
      Previous value: -"Lines of source context to include around the component definition"New value: +"Lines of source context to include around the component definition. Default: 3."
    • changedInput schema / properties / device_id / description
      Previous value: -"Device id from list-devices — the SAME id you passed to debugger-connect (iOS simulator UDID or Android serial)."New value: +"Device id used with debugger-connect."
    • changedInput schema / properties / includeSkipped / description
      Previous value: -"When true, items that would normally be filtered are kept in the response with skipped=true and a skipReason. Useful for understanding what was pruned."New value: +"When true, items that would normally be filtered are kept in the response with skipped=true and a skipReason. Default: false."
    • changedInput schema / properties / maxItems / description
      Previous value: -"Maximum number of hierarchy items to return, counted from the bottom (most specific component first). The hierarchy walks from the tapped element up to the root — the first items are the most relevant for editing. Increase to 70+ if you need to understand the broader navigation/screen structure."New value: +"Maximum number of hierarchy items to return, most specific first. The default covers all app-specific code; increase to 70+ to also see the navigation/screen structure. Default: 35."
    • 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."
    • changedInput schema / properties / resolveSourceMaps / description
      Previous value: -"When true, resolves bundled frame locations to original source files via Metro symbolication and includes a code fragment. When false, returns the raw bundled frame info (file, line, column) without symbolication or source reading."New value: +"When true, resolves bundled frame locations to original source files via Metro symbolication and includes a code fragment. When false, returns the raw bundled frame info (file, line, column) without a code fragment. Default: true."
    • changedInput schema / properties / x / description
      Previous value: -"Logical X coordinate on device screen"New value: +"Horizontal position in logical pixels from the left edge of the screen."
    • changedInput schema / properties / y / description
      Previous value: -"Logical Y coordinate on device screen"New value: +"Vertical position in logical pixels from the top edge of the screen."
  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"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 logicalDeviceId from debugger-connect (iOS simulator UDID or Android logicalDeviceId)."New value: +"Device id from list-devices — the SAME id you passed to debugger-connect (iOS simulator UDID or Android serial)."
  4. First observedv0.15.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true, and the description adds substantial behavior beyond that: the ordering semantics (lowest indices are the most specific, higher indices are page/navigator context), the shape of each item (source file:line plus a code fragment), and two concrete failure modes (app disconnected, point outside the screen).

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, then return ordering, then usage and failure conditions — a sensible progression with no filler. It is somewhat dense in a single block, but every sentence carries information an agent needs.

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 an 8-parameter tool with no output schema, the description covers return structure, item ordering, coordinate conversion, and failure conditions. Remaining details such as truncation behavior when maxItems is hit or the format of the code fragment are left implicit.

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 100%, so the baseline is 3; the description earns above baseline by explaining that x/y must be logical pixel fractions converted using the width and height from debugger-component-tree's Screen line. It does not elaborate on maxItems, contextLines, or includeSkipped, which the schema already covers.

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 (inspect the React component hierarchy) plus the exact input domain (a screen coordinate x, y), and clarifies the return ordering. An agent can distinguish it from debugger-component-tree because this one resolves a single point to source file:line.

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 the source file and line for a component at a point" gives an explicit trigger condition, and it explains how to convert coordinates coming from debugger-component-tree. It does not explicitly state when to prefer debugger-component-tree instead, so it stops short of full alternative routing.

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