terminal
Execute commands in a terminal and capture the output. Use the 'run' action to send a command, wait for completion, and retrieve the result in a single call.
Instructions
Purpose: Interact with a terminal window: read output, send input, or run+wait+read in one call. Details: action='run' is the recommended high-level workflow: send command → wait until quiet/pattern/timeout → read output. Returns completion={reason, elapsedMs} first-class. action='read' reads current text via UIA TextPattern (falls back to OCR); use sinceMarker for incremental diff. action='send' sends a command with focus management. Prefer: action='run' for command execution + result. Use action='read'/'send' for fine-grained control or when you need to interleave other actions. Caveats: Do not screenshot the terminal — terminal(action='read') is cheaper and structured. action='run' supports completion reasons: quiet | pattern_matched | timeout | window_closed | window_not_found. preferClipboard=true (send default) overwrites user clipboard. Examples: terminal({action:'run', windowTitle:'PowerShell', input:'npm test', until:{mode:'pattern', pattern:'npm test:'}}) → {output, completion:{reason:'pattern_matched'}} terminal({action:'run', windowTitle:'pwsh', input:'ls'}) → quiet 800ms wait, returns output terminal({action:'read', windowTitle:'PowerShell', sinceMarker:'...'}) → incremental diff terminal({action:'send', windowTitle:'PowerShell', input:'echo hello'}) → sends text + Enter
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||