Skip to main content
Glama
dwgx

SmartCLI

by dwgx

wait_regex

Read-onlyIdempotent

Wait for a regex pattern on a terminal screen, then snapshot; use to synchronize TUI readiness instead of blind delays after sending input.

Instructions

Block until pattern (a regex) appears on screen, then snapshot.

Returns {"ok", "matched", "alive", "exited", "text", "json"}. Timeout is not an error: the call returns ok=true with matched=false plus the final screen snapshot. exited is true only when the session was started with detect_child_exit AND the child died before the pattern appeared, in which case the wait returned at once instead of running to timeout_ms. Screen lines are right-padded with spaces — end-anchored patterns never match; use unanchored markers. This is the readiness sync — prefer it over a blind delay after send_line/send_keys.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sidYes
patternYes
timeout_msNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

A4.7/5.0
Behavior5/5

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

Adds substantial behavior beyond the annotations: timeout is not an error (ok=true, matched=false plus final snapshot), exited semantics depend on detect_child_exit and child death, and the screen-padding quirk means end-anchored patterns never match. These are non-obvious operational details that annotations do not convey.

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?

Front-loads the core action, then uses tight sentences for return shape, timeout semantics, exit behavior, and the padding caveat. Every sentence carries distinct, actionable information with no 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?

No output schema exists, but the description documents the return keys (ok, matched, alive, exited, text, json) and the key edge cases (timeout, early exit, padding). An agent has everything needed to invoke and interpret 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?

With 0% schema description coverage, the description must compensate, and it explains `pattern` as a regex and clarifies timeout_ms semantics (timeout not an error, runs to timeout_ms). The `sid` parameter is left undocumented, so it doesn't fully close the gap.

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+resource: block until a regex pattern appears on screen, then snapshot. This is precise and distinguishable from siblings like wait_change, wait_visual_change, wait_any, and wait_ready, which do not mention regex matching.

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?

Explicitly says to prefer this over a blind delay after send_line/send_keys, which gives clear when-to-use context. However, it does not directly differentiate itself from the closest siblings (wait_ready, wait_any, wait_change), leaving some routing ambiguity.

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