Skip to main content
Glama

Wait for something to happen

wait_for_event

Blocks until the computer reports an event like a window opening, a command exiting, or the machine going idle, replacing screenshot polling loops. Returns every event up to the match, in order.

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.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "wait_for_event"
  }
}

Input 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. Changed1 schema field changedv0.18.0
    • addedInput schema / properties / pid / maximum
      Added value: +9007199254740991
  2. First observedv0.13.1

TDQS

A4.8/5.0
Behavior5/5

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

Goes well past the annotations (destructiveHint=false, idempotentHint=false): it discloses the timeout cap rationale (below the 60s MCP client request timeout so calls aren't cancelled), that no events are lost across calls because the server holds the stream open, that the result is ordered and cumulative up to the match, and that unemittable types are rejected immediately rather than consuming the timeout. These are exactly the non-obvious behaviors an agent needs.

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?

Front-loaded with the core contract and organized as mechanism, event list, return shape, stream persistence, then exclusions. Dense and nearly every sentence earns its place, though the long inline event enumeration and the 'the list grows' aside make it longer than strictly necessary.

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 six optional parameters, no output schema, and a blocking/long-poll style call, the description covers return shape (ordered, everything up to and including the match), timeout semantics, cross-call continuity, and error behavior for unsupported types. Nothing material is left for the agent to guess.

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 83%, so much of the parameter meaning is already structured. The description still adds useful framing — passing no types waits for anything, and the short timeout is safe because re-calling resumes exactly where the last read ended — though the limit parameter is never mentioned and the timeout rationale overlaps the schema text.

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?

Opens with a specific verb+resource+mechanism: block until the computer reports an event, explicitly contrasting with screenshotting in a loop. The enumeration of concrete event types (window.opened, process.exited, computer.idle, ...) makes the resource unambiguous and separates it from siblings like screenshot, poll_events, 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?

States the positive case (replaces polling, pass no types for anything) and an explicit exclusion with the remedy: do not use it for a click landing or a page painting, use a screenshot instead. That is a named when-not plus an alternative, which is the top of the scale.

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