Skip to main content
Glama

wait_for

Polls a JavaScript condition in Electron renderer processes until it evaluates as true, then returns the result. Use to wait for DOM elements, application states, or other conditions before proceeding.

Instructions

Poll a JavaScript predicate in the renderer until it returns truthy, then return its value. The predicate is a function body; use return to yield a value. Example body: return document.querySelectorAll(".item").length >= 3.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jsYesFunction body. Use `return` to yield the predicate result.
timeoutMsNoDefault 5000.
pollMsNoPoll interval, default 100.
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains the polling mechanism, timeout, and poll interval behavior, which is helpful. However, it lacks details on error handling, what happens if the predicate never returns truthy, or performance implications of frequent polling, leaving some behavioral aspects unclear.

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?

The description is concise and well-structured: two sentences that efficiently explain the tool's purpose and provide a practical example. Every sentence adds value without redundancy, making it easy to understand quickly.

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?

Given the tool's complexity (polling with JavaScript) and no output schema, the description is mostly complete: it covers the main functionality and parameters. However, it could improve by mentioning return values or error cases, as there's no output schema to fill those gaps.

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 description coverage is 100%, so the schema already documents all parameters. The description adds value by explaining the 'js' parameter as a 'function body' with an example, clarifying its semantics beyond the schema's basic description. It also implies the purpose of polling and timeout parameters, though not explicitly detailing them.

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?

The description clearly states the tool's purpose: 'Poll a JavaScript predicate in the renderer until it returns truthy, then return its value.' It specifies the verb ('poll'), resource ('JavaScript predicate'), and scope ('in the renderer'), distinguishing it from sibling tools like 'wait' or 'wait_for_selector' by focusing on custom JavaScript evaluation rather than element waiting.

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?

The description provides clear context for usage: it's for polling a JavaScript predicate until truthy, with an example illustrating when to use it (e.g., checking for DOM elements). However, it does not explicitly state when not to use it or name alternatives like 'wait_for_selector' for simpler element-based waiting, leaving some room for improvement.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mesomya/electron-driver'

If you have feedback or need assistance with the MCP directory API, please join our Discord server