Skip to main content
Glama

ui_assert

ui_assert

Evaluates a JavaScript expression against the current page and permanently fails the test session if false, enforcing strict assertions for application claims.

Instructions

Assert a JS expression against the current page. This is a HARD check: if it evaluates false the whole session is marked failed. Use it only for claims about the application under test. To wait for the page to become ready use ui_wait_for, and for a non-fatal observation use ui_check — do not call ui_assert in a retry loop, as the first false result permanently fails the run.

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_assert"
  }
}

Input Schema

NameRequiredDescriptionDefault
conditionYesJS expression evaluated in the page context
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.4/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden and does the important part well: it declares this is fatal, that a single false permanently fails the whole session, and that retry loops are harmful. What it leaves open is narrower — how the expression's value is interpreted (truthiness vs strict boolean), whether async/promise results or evaluation timeouts are handled, and what a passing call returns.

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 sentences, front-loaded with the core action and the fatal-failure consequence before the routing guidance. Every clause carries distinct information: what it does, how severe failure is, when to use instead, and the retry-loop hazard.

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 two-parameter tool with no output schema, the description covers the decision-critical facts: fatality, permanence, alternatives, and retry prohibition. The remaining gap is the success path (what a true result yields) and expression-evaluation details, which are useful but not blocking for correct invocation.

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 coverage is 100%, so both parameters (condition, session_id) are already documented in the schema, including the multi-session rule for session_id. The description adds only indirect meaning — that the expression runs "against the current page" — and never references session_id or the page-context evaluation model, so baseline 3 applies.

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?

"Assert a JS expression against the current page" is a specific verb (assert) plus resource (JS expression evaluated in page context), and the description immediately distinguishes the semantics from siblings by naming ui_wait_for (readiness) and ui_check (non-fatal observation). An agent can tell exactly which of the ui_* family to reach for.

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

Usage Guidelines5/5

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

Explicit positive scope ("claims about the application under test"), explicit negative scope ("do not call ui_assert in a retry loop"), and two named alternatives with the condition that selects each (ui_wait_for for readiness, ui_check for non-fatal). Nothing is left to inference.

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