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