Skip to main content
Glama

debugger-inspect-element

Identify the React component at any screen coordinate and trace its parent hierarchy, with source file locations. Use to locate and edit the exact component tapped on device.

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). Default shows 35 items which covers all app-specific code; use maxItems=70+ to also see the navigation/screen structure.

Uses getInspectorDataForViewAtPoint + _debugStack + Metro /symbolicate. Set resolveSourceMaps to false to skip symbolication and get raw bundled locations instead. Set includeSkipped=true to see filtered items annotated with skip reasons. Use when you need the source file and line for a component at a tap coordinate. Fails if the app is not connected or the coordinate is outside the screen.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesLogical X coordinate on device screen
yYesLogical Y coordinate on device screen
portNoMetro 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.
maxItemsNoMaximum 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.
device_idYesDevice id from list-devices — the SAME id you passed to debugger-connect (iOS simulator UDID or Android serial).
contextLinesNoLines of source context to include around the component definition
includeSkippedNoWhen true, items that would normally be filtered are kept in the response with skipped=true and a skipReason. Useful for understanding what was pruned.
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 symbolication or source reading.

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
  2. 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)."
  3. First observedv0.15.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It reveals ordering semantics (lowest indices are most specific), default limits (35 items), the internal mechanism (getInspectorDataForViewAtPoint, _debugStack, Metro symbolication), option effects (resolveSourceMaps, includeSkipped), and explicit failure modes. This is comprehensive for a read-only inspection 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 detailed yet tightly written, with the core purpose and output behavior front-loaded. Every sentence earns its place: ordering, defaults, options, use case, and failure conditions are all useful and non-redundant. The structure moves naturally from what it does, to return semantics, to configuration knobs, to when to use it.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Even without an output schema, the description explains what the response contains (components, source file:line, code fragment), how to interpret ordering, how to get more items, and what happens on failure. Parameter coverage is fully handled by the schema. This is a complete, self-contained definition for the tool's 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?

The input schema already documents all 8 parameters at 100% coverage, so the baseline is 3. The description adds meaningful semantics beyond the schema: maxItems=70+ for navigation context, resolveSourceMaps=false for raw locations, and includeSkipped for filtered items with skip reasons. It doesn't add value for port, device_id, or contextLines, but the schema covers those adequately.

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 states a specific verb and resource: 'Inspect the React component hierarchy at a screen coordinate (x, y)' and explains the output in concrete terms ('components from the tapped element upward through its parent hierarchy, each with its source file:line and a code fragment'). This clearly differentiates it from sibling tools like debugger-component-tree by anchoring on a tap coordinate and source mapping.

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 includes an explicit use case: 'Use when you need the source file and line for a component at a tap coordinate.' It also warns about failure conditions (app not connected, coordinate outside the screen). However, it doesn't explicitly contrast this with sibling alternatives such as debugger-component-tree or native-view-at-point, so it falls 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.