Skip to main content
Glama

ui_wait_for

ui_wait_for

Polls a JavaScript expression until it returns true or the timeout elapses, so you can wait for page rendering instead of repeatedly retrying assertions.

Instructions

Poll a JS expression until it becomes true or the timeout elapses. Use this to wait for the page to render instead of retrying ui_assert. Returning true is recorded as one action; timing out fails the session.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "condition": "<condition>"
    },
    "name": "ui_wait_for"
  }
}

Input Schema

NameRequiredDescriptionDefault
conditionYesJS expression evaluated in the page context
timeoutMsNoHow long to keep polling before giving up (max 60000ms)
session_idNoWhich open session to act on, as returned by ui_start_session. Optional with one open session; required when several are open.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

No annotations exist, so the description carries the full burden, and it does disclose key behavior: success is recorded as one action and a timeout fails the session. It leaves gaps on what happens if the expression throws, is invalid, or how frequently polling occurs.

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?

Three short sentences, front-loaded with the core behavior, followed by the routing hint and the outcome semantics. Every sentence contributes information and none is redundant.

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?

For a three-parameter tool with no annotations and no output schema, the description covers what an agent most needs: what it waits on, the alternative, the timeout consequence, and action accounting. Only error/edge-case behavior (invalid or throwing expressions) is unaddressed.

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%, so the schema already documents condition, timeoutMs, and session_id including defaults and bounds. The description only reinforces the truthiness/timeout semantics and adds no new format or syntax guidance beyond the schema.

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 and resource (poll a JS expression) plus the termination condition (becomes true or timeout). It also explicitly contrasts itself with ui_assert, so an agent can distinguish the two without opening schemas.

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 a clear usage rule: use this to wait for page render rather than retrying ui_assert, naming the alternative directly. It stops short of stating when this tool is the wrong choice (e.g., non-render waits or conditions that never become true), so it is not a full when/when-not/alternatives treatment.

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