Skip to main content
Glama

exec_expect

Execute shell, REPL, or bootloader commands and automatically wait for the prompt, returning structured results with output, exit code, and timeout.

Instructions

Execute a shell, REPL, or bootloader command and automatically wait for prompt to return. Output preserves original terminal stream (including command echo) as a causal anchor for AI analysis. ANSI escape codes are stripped for readability.

Returns a structured result with 'success', 'output', 'timeout', 'process_exited', 'exit_code', and 'elapsed_seconds' fields.

IMPORTANT: For long-running commands (e.g. apt-get install, make, large file transfers), use send instead to dispatch the command, then poll with read_buffer periodically to check progress. Do NOT use exec_expect for commands that may take more than a few seconds, as it will report a timeout.

Args: command: The command line to execute. prompts: Optional list of prompt patterns (defaults to standard shell and REPL prompts). timeout: Maximum seconds to wait for the prompt to return. session_id: Target session ID (defaults to currently active session).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes
promptsNo
timeoutNo
session_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses important behavior: automatic prompt waiting, terminal stream preservation, ANSI stripping, timeout reporting, and the structured return fields. It does not clearly state permission requirements, side-effect/reversibility risks, or security implications of executing arbitrary commands, leaving a meaningful gap for a shell-execution tool.

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 description is front-loaded with the core purpose, then a clearly marked behavioral caveat, return fields, and parameters. It is slightly verbose because it repeats return fields that an output schema already provides, but every section is easy to scan and the warning is appropriately prominent.

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?

Given the tool's complexity, 0% schema description coverage, no annotations, and an output schema, the description is largely complete. It covers purpose, timeout behavior, long-running alternatives, terminal output handling, and parameter meanings. It could be stronger by clarifying side effects and session permissions, but it provides enough for an agent to call the tool 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 description coverage is 0%, so the description must compensate. It explains each parameter: command is the command line to execute, prompts are optional prompt patterns defaulting to standard shell/REPL prompts, timeout is the maximum seconds to wait for the prompt, and session_id targets a session defaulting to the active one. It does not specify the expected prompt-pattern syntax or repeat the schema default timeout of 8 seconds, but it gives usable meaning for all four parameters.

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 states a specific verb ('Execute') and resource ('shell, REPL, or bootloader command') and adds the key behavior of waiting for a prompt to return. It clearly distinguishes the tool from siblings like send and read_buffer, which are named in the usage warning.

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?

The description gives explicit when-to-use guidance by naming send and read_buffer for long-running commands and explicitly warning not to use exec_expect for commands that may take more than a few seconds. The condition that triggers the alternative (long-running commands) is stated unambiguously.

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