Skip to main content
Glama

page.expect

Read-only

Assert an element's state and get pass/fail plus the observed outcome; set a timeout to retry until it holds instead of failing on a race.

Instructions

Assert the state of one element and get pass/fail plus what was actually observed. Replaces the evaluate-then-eyeball-the-JSON loop. Give timeout_ms to retry until it holds instead of failing on a race.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "page.expect"
  }
}

Input Schema

NameRequiredDescriptionDefault
nthNoZero-based index when the locator matches several elements.
refNoSnapshot ref (eNN) from page.snapshot.
textNoVisible text of the element.
valueNo
xpathNoXPath expression.
checkedNo
enabledNo
focusedNo
poll_msNo
visibleNo
frame_idNoFrame to search within; see page.list_frames.
selectorNoCSS selector; pierces shadow DOM.
target_idNoTarget handle (tgt_*). Omit for the active page.
browser_idNoBrowser handle (br_*). Omit to use the only running browser, or auto-launch one.
timeout_msNoRetry until the expectations hold. Default 0: check once.
in_viewportNo
text_containsNo
backend_node_idNoCDP backendNodeId, e.g. from inspector.pick.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior4/5

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

The annotations declare readOnlyHint=true and openWorldHint=true, and nothing in the description contradicts that shift, so the tool is a safe read against live browser state. Beyond the annotations, the description discloses the return shape (pass/fail plus observed value) and the retry-until-holds behavior of timeout_ms, which is genuinely useful because there is no output schema; it does not cover failure timing or partial-match reporting.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences, front-loaded with the core assertion behavior, then the value proposition, then the timeout tip. Minimal waste; the 'evaluate-then-eyeball-the-JSON' line is slightly informal but earns its place as agent-targeted motivation.

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

Completeness3/5

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

For an 18-parameter assertion tool with no output schema and no required parameters, the description covers the return shape and the retry semantics but leaves the predicate parameter family unexplained. An agent can guess that visible/checked/text are assertions, yet combining them and dealing with an empty predicate set remains underspecified.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are 18 parameters at 56% schema description coverage, and the description explains only timeout_ms, whose schema already says 'Retry until the expectations hold. Default 0: check once.' The eight or nine predicate parameters (value, checked, enabled, focused, visible, in_viewport, text_contains, poll_ms) go undifferentiated in both schema and description, and the description never says that these expectations are combined or what an empty predicate set means.

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?

States a specific verb and scope: assert the state of ONE element and return pass/fail plus observed state. That reads clearly against page.observe and page.snapshot, which gather state rather than assert it, but no sibling is named explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives one concrete usage tip, namely to set timeout_ms so the call retries instead of failing on a race, plus a vague framing about replacing an evaluate-then-inspect loop. It never says when to choose page.expect over page.observe or page.snapshot, or what happens if no expectation parameters are supplied.

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

Deploy Server

Other Tools