Skip to main content
Glama

read_until_prompt

Read serial output until a device prompt appears, capturing full multi-page responses for interactive CLI sessions. Avoids truncation by continuously buffering until timeout.

Instructions

Read accumulated output until a prompt appears, or until timeout.

This is the right tool for interactive CLI sessions (routers, switches, shells). It reads from the background buffer until prompt is seen, then returns everything up to and including it, leaving anything after the prompt in the buffer for the next read. Because the reader runs continuously, large multi-page outputs are captured in full rather than being cut off by a fixed delay.

Typical flow: send_text("show version", line_ending="LF", clear_buffer_first=True) read_until_prompt(prompt="# ")

Args: prompt: The text that marks the end of output. Literal by default, e.g. "# ", "> ", "login: ", "$ ", "Password:". Common device prompts end in "# " (enable) or "> " (user). Note the match is searched in everything received, including the echo of your own command, so prefer a prompt with its trailing space over a bare "#" or ">" when the command text itself could contain that character. timeout: Max seconds to wait for the prompt to appear. regex: Treat prompt as a Python regular expression instead of literal text (e.g. r"[\w.-]+[#>] ?$" to match a hostname-style prompt).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regexNo
promptNo#
timeoutNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations provided, the description bears full responsibility for behavioral disclosure. It thoroughly explains the continuous reader, that output is returned up to and including the prompt, that trailing content remains in the buffer, and the echo-matching warning. This goes well beyond a basic 'reads until prompt.

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 well-organized with a summary sentence, context, a typical flow, and a clean Args section. Every sentence carries operational value; the length is justified by the amount of necessary guidance, 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?

For a tool with three optional parameters, no annotations, and an output schema, the description covers all necessary ground: prompt semantics, timeout behavior, regex mode, buffer mechanics, and a concrete usage example. The output schema exists, so not detailing return values is acceptable.

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?

The input schema has 0% description coverage, so the description compensates fully. Every parameter is documented with examples and edge-case guidance, such as the warning about matching the echo of the sent command and the regex example for hostname-style prompts. This adds substantial meaning beyond the bare schema properties.

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 precise statement: 'Read accumulated output until a prompt appears, or until timeout.' It names the resource (accumulated output) and the termination condition. The phrase 'This is the right tool for interactive CLI sessions' clearly positions it among siblings like read_available.

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 explicitly states when to use the tool: interactive CLI sessions such as routers, switches, and shells. It also explains the advantage over a fixed delay for multi-page outputs and provides a typical send_text/read_until_prompt flow. It does not explicitly name alternative sibling tools or list exclusion cases, but the usage context is unambiguous.

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