Skip to main content
Glama

settle

Drains the JavaScript event loop to execute pending microtasks and timer callbacks, returning when the queue is empty or limits are reached.

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?

No annotations provided, so description bears full burden. It thoroughly explains the internal process: alternating microtasks and timers, sleeping to deadlines, and three stopping conditions (empty queue, max_ms, max_iters). Defaults are also specified.

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 only, each serving a distinct purpose: process explanation, stopping conditions, usage guidance. No unnecessary words. Front-loaded with the core action.

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?

Covers behavior and parameters thoroughly. However, it does not describe the return value or expected output. Since there is no output schema, the description should ideally mention what the tool returns (e.g., boolean or void) for full completeness.

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%, but description adds value by stating defaults (max_ms=2000, max_iters=50) and explaining the meaning of 'iterations' in the context of the drain loop. This supplements the schema effectively.

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?

Description uses specific verb 'Drain the JS event loop' and clearly identifies the resource and action. Unambiguously states what the tool does and distinguishes from sibling tools like 'eval' or 'click' which deal with other aspects of page interaction.

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?

Explicitly states when to use: 'Use after seeding the DOM (or after eval'd code that schedules timers) to let pending callbacks run.' This provides clear context and proper usage scenario.

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