Skip to main content
Glama
helmif

semantic-dom-mcp

by helmif

session_extract

Read-only

Capture the current page state as Semantic JSON, or diff it against a prior snapshot to get only added, removed, and changed nodes plus observed behavior.

Instructions

Snapshot the CURRENT state of an open session as Semantic JSON (same shape as extract_semantic_dom, plus snapshot_id). Pass diff_against: 'previous' (or a snapshot_id) to receive only what changed: added nodes (new toasts/dialogs/fields), removed nodes, changed properties (value, is_disabled, aria_invalid, described_by…) and the behavior observed in between — far smaller than a full re-extraction and exactly the assertion list for the step. Diff identity: frame + test-id, else id, else placeholder, else tag+role+accessible name (+ document-order index); a renamed node with no stable attribute shows as removed + added; primary_locator.playwright changes say which locator is valid in which state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNo'outline': the page as a map (regions with `selector`, structured tables, dialogs, alerts) in a few thousand characters; does not consume a snapshot id.nodes
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.
max_nodesNoCap on extracted nodes; truncation is flagged, never silent.
session_idYesFrom session_open.
diff_againstNoReturn only what changed since that snapshot_id (or 'previous' = the last snapshot in this session) instead of the full extraction — added/removed/changed nodes plus the behavior observed in between.
visible_onlyNoSkip hidden nodes entirely.
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. Addedv0.8.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, non-destructive, non-idempotent), and the description adds real behavioral context beyond them: truncation/omission is 'flagged, never silent', diffs are 'far smaller than a full re-extraction', the observed-behavior window between snapshots, and the diff-identity rules (frame+test-id → id → placeholder → tag+role+name) including that a renamed node appears as removed+added. The idempotentHint=false is implicitly explained by snapshot consumption. It stops short of auth/permission or rate-limit notes.

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?

Front-loads the core action and output shape, then the diff mode and its payoff, then the identity rules needed to interpret a diff. Dense but every sentence carries non-redundant information, and the long identity clause is the one piece that genuinely cannot be inferred from the schema.

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 11 parameters and no output schema, the description carries the return-value burden and largely discharges it: it names the output shape, the diff payload, the snapshot_id field, and primary_locator.playwright state validity. It leaves the full node/table/dialog output structure to the reader's knowledge of extract_semantic_dom, which is a minor gap for a tool this rich.

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, but the description adds meaning beyond the schema for the most consequential parameter: what diff_against actually returns (added/removed/changed nodes plus intervening behavior) and the identity rules that determine what counts as changed. It also clarifies that outline mode 'does not consume a snapshot id'. The remaining 9 parameters are left to their schema descriptions.

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 (snapshot/extract) on a specific resource (the CURRENT state of an open session), names the exact output shape (Semantic JSON) and explicitly differentiates it from the sibling extract_semantic_dom by the added `snapshot_id` and the diff capability. An agent can tell it apart from extract_semantic_dom/extract_semantic_dom_after without opening the schema.

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?

Gives concrete usage context: pass diff_against: 'previous' to get 'exactly the assertion list for the step', implying the verification-step workflow, and the schema documents outline mode as a low-cost alternative. It does not, however, state when to prefer this over extract_semantic_dom or extract_semantic_dom_after, so the alternative-selection guidance is implied rather than explicit.

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