Skip to main content
Glama

expect

Send an optional command, then match incoming session output against regex or substring patterns to synchronize prompts and automate multi-step authentication, SSH logins, and U-Boot interception.

Instructions

Atomically send an optional command and match incoming stream against prompt patterns. Ideal for multi-step authentication (SSH login/password), prompts, and U-Boot interception.

Args: patterns: List of regex/substring patterns to expect (e.g. ['password:', '# ']). command: Optional command/response to send before waiting. timeout: Maximum seconds to wait. Defaults to 10.0s. poll_cmd: Characters to repeatedly send during wait (e.g. ' ' for autoboot intercept). poll_interval: Interval between repeating poll_cmd. Defaults to 0.05s. session_id: Target session ID (defaults to currently active session).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandNo
timeoutNo
patternsYes
poll_cmdNo
session_idNo
poll_intervalNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden, and it delivers the key trait that this is an 'Atomic' operation plus polling semantics (poll_cmd repeatedly sent, poll_interval default). It does not describe what happens on timeout (error vs. empty return), though the presence of an output schema offsets part of that gap.

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 summary sentence is front-loaded and the Args block is scannable, with every line earning its place. There is minor duplication where defaults are restated (timeout 10.0s, poll_interval 0.05s), which the schema already encodes.

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?

For a six-parameter, interaction-heavy tool this covers the operation, poll behavior, session targeting, and every argument, and an output schema exists so return values need not be re-explained. Only failure/timeout semantics and explicit sibling routing remain unaddressed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does: each of the six parameters is explained with meaning, example values ('password:', '# ', ' ' for autoboot), and defaults. The session_id note ('defaults to currently active session') adds semantics the bare schema cannot express.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence gives a specific verb+resource ('send an optional command and match incoming stream against prompt patterns') and the 'Ideal for' clause scopes it to multi-step auth and U-Boot interception, which implicitly separates it from siblings like send or read_buffer. It stops short of naming a sibling or stating what it is not, so it is clear but not fully differentiated.

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?

'Ideal for multi-step authentication (SSH login/password), prompts, and U-Boot interception' supplies concrete use-case context that tells the agent when this tool applies. There are no explicit exclusions or named alternatives (e.g., when to prefer exec_expect or send instead), so guidance is clear but incomplete.

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