Skip to main content
Glama

check_if_condition

Determine if a page element is present or visible, or if specific text is currently visible, returning an immediate True/False without waiting.

Instructions

Check the current state of an element or text without waiting for the condition to become true.

Use this tool when you need an immediate boolean observation of the current page state. Use wait_for_condition when the condition may become true later and the workflow should wait for it. Use assert_condition when the condition is an expected requirement and failure should be treated as an assertion error.

Args: check: The element state to inspect when text is not provided: - "present": Return True when at least one matching element exists. - "visible": Return True when the matching element is visible. check is ignored when text is provided.

selector:
    CSS selector or SeleniumBase selector identifying the element.

text:
    Optional text to check for visibility within `selector`. When
    provided, this takes precedence over `check`; the tool checks text
    visibility instead of element presence or visibility. Use this when
    the question is "Is this text currently visible?" rather than
    whether the element itself is present or visible.

Returns: True or False indicating whether the requested condition is currently satisfied. Missing elements return False rather than raising an exception. If there's an error, returns a string with error details.

Tool selection: - Immediate boolean observation -> use check_if_condition. - Wait for a state/content transition -> use wait_for_condition. - Verify an expected condition -> use assert_condition. - Need element details of matching elements -> use find_elements. - Need to read page or element content -> use get_content.

Notes: This tool does not intentionally wait for elements or text to appear. It is intended for checking the current state only. If page timing or asynchronous loading matters, use wait_for_condition instead.

When `text` is provided, `check` is ignored.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textNo
checkNovisible
selectorNobody

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.3.4

TDQS

A4.6/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 burden and does well: it discloses that the tool does not wait for elements, that missing elements return False rather than raising, and that errors return a string. It omits any note on permissions or rate/timing guarantees beyond the non-waiting statement, so it is strong but not exhaustive.

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?

Well front-loaded with the purpose first and structured sections afterward, but the precedence rule ('check' is ignored when 'text' is provided) is stated twice, once in Args and again in Notes, which is redundant for the value delivered.

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

Completeness5/5

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

An output schema exists, so the 'Returns' text is a bonus rather than a necessity, and the description still covers the non-waiting semantics, error behavior, and precedence rules an agent needs. Nothing required to invoke it correctly is missing.

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

Parameters4/5

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

Schema coverage is 0%, so the description must compensate, and it largely does: it defines the 'present'/'visible' enum meanings precisely and explains that 'text' takes precedence and causes 'check' to be ignored. It leaves the two schema defaults (check='visible', selector='body') unstated, which is the only gap.

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 ('Check the current state of an element or text') with the distinguishing constraint 'without waiting for the condition to become true' front-loaded. An agent can separate it from wait_for_condition and assert_condition without opening any schema.

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?

Provides an explicit tool-selection block naming each alternative (wait_for_condition, assert_condition, find_elements, get_content) alongside the condition that selects it. When-to-use and when-not-to-use are both spelled out, including the timing caveat.

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