Skip to main content
Glama
dwgx

SmartCLI

by dwgx

wait_any

Read-onlyIdempotent

Wait for any of several text patterns to appear on a terminal screen and return which one matched. Handles conditional prompts, errors, and login prompts in CLI sessions.

Instructions

Wait for ANY of patterns to appear on screen (pexpect expect([...]) style).

Race several possible outcomes at once — e.g. patterns=[">>> ", "Error", "Password:"] — and learn WHICH happened. Patterns are scanned in list order each poll, so the earliest in the list wins a same-poll tie (put the most specific first). Screen lines are right-padded with spaces — end-anchored patterns never match; use unanchored markers. Returns {"ok", "index", "matched", "alive", "text", "json"} where index is the 0-based position of the matched pattern. Timeout is not an error: the call returns ok=true with index=-1 and matched=false plus the final screen snapshot.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sidYes
patternsYes
timeout_msNo
Behavior5/5

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

Beyond the readOnlyHint and idempotentHint annotations, the description discloses critical behavioral traits: list-order tie-breaking, screen-line right-padding making end-anchored patterns never match, and timeout not being an error. These details are crucial for correct invocation and are not present in annotations or schema.

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 front-loaded with the core purpose, then efficiently covers edge cases. Every sentence adds value: example, tie-breaking, padding caveat, return format, timeout semantics. No fluff or redundancy.

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?

Despite lacking an output schema, the description fully explains the return object and its key field `index`. It covers the tricky aspects of pattern matching, timeout behavior, and screen padding. The tool is complex (multiple outcomes, tie-breaking, non-error timeout), and the description addresses all of these, making it complete for an agent.

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 compensates for the most important parameters: it explains the semantics of `patterns` (list ordering, tie-breaking) and `timeout_ms` (returns success with index=-1 on timeout). It does not explicitly explain `sid`, but that is a standard session identifier likely inferred from context. Overall, it adds significant meaning beyond the raw schema.

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 opens with a specific verb and resource: 'Wait for ANY of `patterns` to appear on screen.' It clearly distinguishes from sibling tools like wait_regex (single pattern) and wait_change by emphasizing racing multiple patterns. The pexpect reference and example make the purpose unmistakable.

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 explains when to use this tool: 'Race several possible outcomes at once' and gives a concrete example. It also provides ordering and timeout behavior, but does not explicitly contrast with alternative wait tools. The context is clear enough for an agent to decide, though exclusions are absent.

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/dwgx/SmartCLI'

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