session_wait_for
Wait for a specific regex pattern to appear in a terminal session's output, returning when matched or after a timeout. Use this targeted approach to read session output when you know what to expect.
Instructions
Read output from a session until a regex pattern matches or timeout expires. Use this instead of session_read when you know what output to expect.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"session_id": "<session_id>",
"pattern": "<pattern>"
},
"name": "session_wait_for"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | Regex pattern to wait for in output | |
| timeout | No | Max seconds to wait | |
| session_id | Yes | Session ID | |
| strip_ansi | No | Strip ANSI escape sequences | |
| truncation | No | Truncation mode for output |