Skip to main content
Glama

settle

Processes pending microtasks and timer callbacks to drain the JavaScript event loop. Use after DOM modifications or eval to ensure scheduled callbacks are executed.

Instructions

Drain the JS event loop: alternately runs queued microtasks (Promise resolutions) and fires expired setTimeout/setInterval callbacks, sleeping to the next deadline when only timers remain. Returns when the queue is empty OR max_ms elapses OR max_iters iterations complete. Defaults: max_ms=2000, max_iters=50. Use after seeding the DOM (or after eval'd code that schedules timers) to let pending callbacks run.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
max_itersNoMax iterations of the drain loop (default 50)
max_msNoMax wall-clock ms to spend (default 2000)
Behavior5/5

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

With no annotations provided, the description fully carries the burden. It details the algorithm (alternates microtasks and timers, sleeps for timers), stopping conditions (queue empty, max_ms, max_iters), and defaults. This is highly transparent.

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 (four sentences), front-loaded with the main purpose, and each sentence adds essential information. No redundant or vague phrasing.

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?

Given no annotations or output schema, the description alone makes the tool usage clear. It explains behavior, parameters, defaults, and use cases (after DOM seeding/eval). No gaps for an agent to misinterpret.

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 100% with descriptions, but the description adds default values (2000, 50) and explains they limit iteration and time, which goes beyond the schema. This provides practical guidance for parameter usage.

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 drains the JS event loop by alternately running microtasks and timer callbacks, returning when conditions are met. The verb 'drain' and specific resource ('JS event loop') are precise, and it distinguishes from siblings like 'click' or 'type' which are direct actions.

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 explicitly says 'Use after seeding the DOM (or after eval'd code that schedules timers) to let pending callbacks run,' providing clear when-to-use guidance. It does not discuss when not to use or compare to alternatives, but the context is sufficiently clear.

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/protostatis/unbrowser'

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