read_until_prompt
Read serial console output until a specified prompt appears, ensuring full capture of interactive CLI responses without truncation.
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", 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:". Prefer a prompt with its
trailing space over a bare "#": the match is searched in everything
received, including the echo of your own command. Default: the
connection's prompt (from connect/preset), else "ends with #, >, $ or %".
timeout: Max seconds to wait for the prompt to appear.
regex: Treat prompt as a Python regular expression (e.g.
r"[\w.-]+[#>] ?$" for a hostname-style prompt).
auto_reply: Text to send automatically when a trigger shows up while
waiting, e.g. {"--More--": " "} to page through long output, or
{"[confirm]": "\r"}. Each occurrence is answered once.
connection: Which open connection (name). Default: the current one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| regex | No | ||
| prompt | No | ||
| timeout | No | ||
| auto_reply | No | ||
| connection | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |