Skip to main content
Glama
helmif

semantic-dom-mcp

by helmif

extract_semantic_dom

Read-onlyIdempotent

Navigate to a staging URL and return Semantic JSON of interactive elements with Playwright locators and live state. Use before writing tests so selectors are real, not guessed.

Instructions

Navigate to a staging URL and return factual Semantic JSON of all interactive/test-relevant elements with Playwright-native locators and live state. Use this before writing any Playwright test so selectors are real, not guessed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe page to extract. Must be http/https and on an allowlisted host.
rolesNoKeep only nodes with these roles or tags (e.g. ['button','textbox','row']).
scopeNoCSS selector to extract within — take it from an outline region's `selector` (e.g. 'main table', '[role="dialog"]'). Everything outside is skipped.
viewportNoViewport preset — 'mobile' is 375x812 with touch, for responsive states.desktop
wait_forNoNavigation wait. 'auto' (default) waits for load, then until the DOM has been quiet for 500ms (max 6s) — works on SPAs that render after load and on pages whose analytics never let the network go idle. 'networkidle' times out on such pages.auto
max_nodesNoCap on extracted nodes; truncation is flagged, never silent.
visible_onlyNoSkip hidden nodes entirely.
wait_selectorNoOptional selector to await before extracting (for SPA content).
include_hiddenNoKeep hidden nodes flagged rather than dropping them.
include_tablesNoAttach structured `tables` (headers, row identity, cells) and `dialogs` (label/value fields) inside the scope, for value assertions.
max_output_charsNoBudget for the node list; nodes past it are dropped in document order and counted in `omitted` (never silent).
include_click_targetsNoOpt-in heuristic: also include cursor:pointer elements with content that match no other rule (JS-click product cards without anchors/roles/test-ids). Heuristic nodes carry a context_note.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changedv0.8.0
    • addedInput schema / properties / include_tables
      Added value: +{
      +  "default": false,
      +  "description": "Attach structured `tables` (headers, row identity, cells) and `dialogs` (label/value fields) inside the scope, for value assertions.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / max_output_chars
      Added value: +{
      +  "description": "Budget for the node list; nodes past it are dropped in document order and counted in `omitted` (never silent).",
      +  "exclusiveMinimum": 0,
      +  "type": "integer"
      +}
    • addedInput schema / properties / roles
      Added value: +{
      +  "description": "Keep only nodes with these roles or tags (e.g. ['button','textbox','row']).",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / scope
      Added value: +{
      +  "description": "CSS selector to extract within — take it from an outline region's `selector` (e.g. 'main table', '[role=\"dialog\"]'). Everything outside is skipped.",
      +  "type": "string"
      +}
    • addedInput schema / properties / visible_only
      Added value: +{
      +  "default": false,
      +  "description": "Skip hidden nodes entirely.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / wait_for / default
      Previous value: -"networkidle"New value: +"auto"
    • changedInput schema / properties / wait_for / description
      Previous value: -"Navigation wait condition."New value: +"Navigation wait. 'auto' (default) waits for load, then until the DOM has been quiet for 500ms (max 6s) — works on SPAs that render after load and on pages whose analytics never let the network go idle. 'networkidle' times out on such pages."
    • changedInput schema / properties / wait_for / enum
      Previous value: -[
      -  "load",
      -  "domcontentloaded",
      -  "networkidle"
      -]New value: +[
      +  "auto",
      +  "load",
      +  "domcontentloaded",
      +  "networkidle"
      +]
  2. First observedv0.4.0

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false and openWorldHint=false, so the safety profile is covered. The description adds that it navigates to a staging URL and captures 'live state', but it discloses nothing about auth/permission requirements, rate limits, timeout behavior, or execution cost. Useful context, but thin beyond the annotations.

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?

Two tightly constructed sentences: capability first, usage guidance second, no filler. Both sentences earn their place and nothing is buried.

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 no output schema, the description does sketch the return ('factual Semantic JSON... with Playwright-native locators and live state'), which is the key thing an agent needs to interpret results. It omits the output shape details (nodes, omitted counts, context_note) that the params hint at, so it is strong but not fully self-contained.

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% across 12 params, and the schema itself carries rich per-parameter guidance (wait_for semantics, scope selector sourcing, truncation flags). The description contributes no parameter detail at all, so the baseline 3 is appropriate.

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?

Specific verb ('Navigate... and return') plus a well-defined resource: Semantic JSON of interactive/test-relevant elements with Playwright-native locators. It is clearly distinguishable from extract_outline by emphasizing test-relevant elements and live state, but it never explicitly names or contrasts a sibling (e.g. extract_semantic_dom_after), so it stops short of a 5.

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 this before writing any Playwright test so selectors are real, not guessed' gives a clear triggering context and rationale. However it offers no when-not guidance and does not point to the obvious alternative, extract_semantic_dom_after, for post-interaction states.

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