Skip to main content
Glama

Wait for something to happen

wait_for_event

Block until the computer reports events such as window opened, process exited, or computer ready, replacing screenshot polling and preserving event order across waits.

Instructions

Block until the computer reports something, instead of screenshotting in a loop to find out whether it has. This is the tool that replaces polling: a window opening, a background command exiting, the desktop coming up, the machine going idle or changing power state. Types are window.opened, window.closed, window.focused, window.blurred, clipboard.changed, file.changed, process.exited, computer.ready, computer.idle, computer.started, computer.stopped, computer.suspended, and the list grows — pass none to wait for the next thing of any kind. It returns everything that happened up to and including the match, in order, so the answer is what the computer did rather than one fact out of it. Nothing is lost between calls: this server holds the stream open across turns, so a wait that times out has missed nothing and calling again picks up exactly where it left off. That is why the timeout is short — waiting again is free. Do not use it to wait for a click to land or a page to paint: neither is an event, and a screenshot is still how you find out what the screen looks like.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidNoOnly a process.exited for this pid — the one exec with background: true handed you. Without it a wait for process.exited ends on whichever background command finishes first, which on a computer running several is usually not yours.
limitNo
sinceNoA cursor from an earlier call, to start from there instead of from where this session last read. You do not normally need it — with no cursor at all you are handed everything you have not already been given.
typesNoWait for any of these. Omit to wait for the next event of any kind. A type this computer cannot emit is refused at once rather than waited on — a guest with no window watcher will never send a window.* and this says so instead of spending your timeout.
timeout_sNoHow long to block. Capped below the 60s request timeout most MCP clients ship, because a call that outlives that is cancelled rather than answered late. Nothing is missed by a short wait: call again.
computer_idNoWhich computer. Defaults to the one selected with use_computer.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.13.1

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare idempotentHint=false and destructiveHint=false; the description adds substantial behavior the agent could not infer: the server holds the event stream open across turns, timeouts lose nothing, the timeout is deliberately short because re-waiting is free, results are returned in order up to and including the match, and unemittable types are rejected immediately rather than waited on. This is exactly the kind of non-obvious context that prevents misuse.

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?

The core purpose is front-loaded in the first sentence and each subsequent sentence carries real information (event types, stream persistence, timeout rationale, exclusions). It is on the long side and revisits the 'call again / nothing is lost' idea twice, but there is little pure filler.

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?

With no output schema and only weak annotations, the description carries the full burden and does so: it explains what is returned (all events up to the match, in order), how state persists across calls, how timeouts behave, and what the tool is not for. An agent has everything needed to call it correctly.

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 already 83%, so the baseline is 3, but the description meaningfully extends it: 'pass none to wait for the next thing of any kind' clarifies the types parameter's empty case, and it explains the pid/targeting logic and why a short timeout is safe. It stops short of restating the since cursor and limit semantics, which the schema already covers.

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 — 'Block until the computer reports something' — and immediately frames it as the replacement for polling/screenshotting loops. It enumerates the event types it matches, which pins the scope precisely and separates it from siblings like poll_events, wait, wait_for_computer, and wait_for_file_change.

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?

Gives explicit when-to-use (waiting for window/process/power/clipboard/file events) and explicit when-not-to-use ('Do not use it to wait for a click to land or a page to paint ... a screenshot is still how you find out what the screen looks like'). It also names the alternative behavior it replaces (screenshotting in a loop), so routing is unambiguous.

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

Deploy Server

Other Tools