feat: use simple snapshot for auto_snapshot_mode

This commit is contained in:
Richard Tang
2026-04-30 10:43:14 -07:00
parent cc4213a942
commit 628ce9ca12
+36 -27
View File
@@ -104,7 +104,7 @@ def register_interaction_tools(mcp: FastMCP) -> None:
button: Literal["left", "right", "middle"] = "left",
double_click: bool = False,
timeout_ms: int = 5000,
auto_snapshot_mode: AutoSnapshotMode = "default",
auto_snapshot_mode: AutoSnapshotMode = "simple",
) -> dict:
"""
Click an element on the page.
@@ -123,12 +123,14 @@ def register_interaction_tools(mcp: FastMCP) -> None:
element will take longer than 5s to render for example
right after a navigation that triggers slow hydration.
auto_snapshot_mode: Controls the accessibility snapshot taken
0.5s after a successful click. ``"default"`` (the default)
returns the full tree; ``"simple"`` trims unnamed structural
nodes; ``"interactive"`` returns only controls (buttons,
links, inputs) for the tightest token footprint;
``"off"`` skips the capture entirely use when batching
multiple interactions.
0.5s after a successful click. ``"simple"`` (the default)
trims unnamed structural nodes keeps interactive elements
and named landmarks/content; ``"default"`` returns the full
tree (use when you need the structural skeleton);
``"interactive"`` returns only controls (buttons, links,
inputs) for the tightest token footprint; ``"off"`` skips
the capture entirely use when batching multiple
interactions.
Returns:
Dict with click result and coordinates. Includes ``snapshot``
@@ -305,7 +307,7 @@ def register_interaction_tools(mcp: FastMCP) -> None:
clear_first: bool = True,
timeout_ms: int = 30000,
use_insert_text: bool = True,
auto_snapshot_mode: AutoSnapshotMode = "default",
auto_snapshot_mode: AutoSnapshotMode = "simple",
) -> dict:
"""
Click a selector to focus it, then type text into it.
@@ -328,11 +330,12 @@ def register_interaction_tools(mcp: FastMCP) -> None:
reliable insertion into rich-text editors. Set False for
per-keystroke dispatch.
auto_snapshot_mode: Controls the accessibility snapshot taken
0.5s after successful typing. ``"default"`` returns the
full tree; ``"simple"`` trims unnamed structural nodes;
``"interactive"`` returns only controls for the tightest
token footprint; ``"off"`` skips the capture entirely
use when batching multiple interactions.
0.5s after successful typing. ``"simple"`` (the default)
trims unnamed structural nodes keeps interactive elements
and named landmarks/content; ``"default"`` returns the full
tree; ``"interactive"`` returns only controls for the
tightest token footprint; ``"off"`` skips the capture
entirely use when batching multiple interactions.
Returns:
Dict with type result. Includes ``snapshot`` unless
@@ -388,7 +391,7 @@ def register_interaction_tools(mcp: FastMCP) -> None:
tab_id: int | None = None,
profile: str | None = None,
timeout_ms: int = 30000,
auto_snapshot_mode: AutoSnapshotMode = "default",
auto_snapshot_mode: AutoSnapshotMode = "simple",
) -> dict:
"""
Fill an input element with a value (clears existing content first).
@@ -402,9 +405,11 @@ def register_interaction_tools(mcp: FastMCP) -> None:
profile: Browser profile name (default: "default")
timeout_ms: Timeout waiting for element (default: 30000)
auto_snapshot_mode: Controls the accessibility snapshot taken
0.5s after a successful fill. ``"default"`` returns the
full tree; ``"simple"`` / ``"interactive"`` return tighter
trees; ``"off"`` skips the capture use when batching.
0.5s after a successful fill. ``"simple"`` (the default)
trims unnamed structural nodes; ``"default"`` returns the
full tree; ``"interactive"`` returns only controls for the
tightest token footprint; ``"off"`` skips the capture
use when batching.
Returns:
Dict with fill result. Includes ``snapshot`` unless
@@ -429,7 +434,7 @@ def register_interaction_tools(mcp: FastMCP) -> None:
delay_ms: int = 1,
clear_first: bool = True,
use_insert_text: bool = True,
auto_snapshot_mode: AutoSnapshotMode = "default",
auto_snapshot_mode: AutoSnapshotMode = "simple",
) -> dict:
"""
Type text into the already-focused element.
@@ -448,9 +453,11 @@ def register_interaction_tools(mcp: FastMCP) -> None:
clear_first: Clear existing text before typing (default: True).
use_insert_text: Use CDP Input.insertText (default: True).
auto_snapshot_mode: Controls the accessibility snapshot taken
0.5s after successful typing. ``"default"`` returns the
full tree; ``"simple"`` / ``"interactive"`` return tighter
trees; ``"off"`` skips the capture use when batching.
0.5s after successful typing. ``"simple"`` (the default)
trims unnamed structural nodes; ``"default"`` returns the
full tree; ``"interactive"`` returns only controls for the
tightest token footprint; ``"off"`` skips the capture
use when batching.
Returns:
Dict with type result. Includes ``snapshot`` unless
@@ -848,7 +855,7 @@ def register_interaction_tools(mcp: FastMCP) -> None:
selector: str | None = None,
tab_id: int | None = None,
profile: str | None = None,
auto_snapshot_mode: AutoSnapshotMode = "default",
auto_snapshot_mode: AutoSnapshotMode = "simple",
) -> dict:
"""
Scroll the page or a specific scrollable container.
@@ -866,11 +873,13 @@ def register_interaction_tools(mcp: FastMCP) -> None:
tab_id: Chrome tab ID (default: active tab)
profile: Browser profile name (default: "default")
auto_snapshot_mode: Controls the accessibility snapshot taken
0.5s after a successful scroll. ``"default"`` returns the
full tree; ``"simple"`` / ``"interactive"`` return tighter
trees useful on virtual-scroll UIs that produce huge
default trees; ``"off"`` skips the capture use when
issuing many scrolls in a row.
0.5s after a successful scroll. ``"simple"`` (the default)
trims unnamed structural nodes well-suited to virtual-
scroll UIs that produce huge default trees; ``"interactive"``
tightens further to controls only; ``"default"`` returns
the full tree (use when you need the structural skeleton);
``"off"`` skips the capture use when issuing many scrolls
in a row.
Returns:
Dict with scroll result. Includes ``snapshot`` unless