Click in terminal
terminal_clickClick a specific terminal cell to interact with mouse-aware TUIs; preview coordinates first with a magenta ring, then execute the click when confirmed.
Instructions
Deliver a left mouse-button click at a cell in the terminal. Only works when the program currently in the foreground has opted into mouse tracking (vim with set mouse=a, fzf, lazygit, less with mouse mode, etc.) — at a plain shell prompt mouse mode is off and the click would just print escape sequences as text, so we refuse the actual click in that case.
Coordinates are 1-indexed and refer to the live screen viewport: col 1, row 1 is the top-left cell, and the bottom-right cell is (terminal width, terminal height) which you can see via terminal_read's state header.
PREVIEW MODE (default preview: true): does NOT click. Returns a PNG with a bright magenta ring + dot drawn around the target cell so you can verify your coordinates. Always do this first when you are not 100% sure where the click should land — TUIs often have destructive actions one click away (delete branch, kill process, etc.).
EXECUTE MODE (preview: false): actually sends the mouse press+release sequence and settles for output. Use this only after you've previewed and confirmed, or when you're confident.
CAVEATS: idleMs and maxWaitMs are ignored in preview mode (preview doesn't settle). When the target cell is near the right edge of the viewport, the coordinate label drawn next to the magenta ring may be clipped — the ring itself is always within frame, so trust it over the label.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| col | Yes | 1-indexed column. Column 1 is the leftmost cell on the visible viewport. | |
| row | Yes | 1-indexed row. Row 1 is the top of the visible viewport. | |
| idleMs | No | ||
| preview | No | When true (DEFAULT), render a PNG with a bright magenta ring around the target cell WITHOUT actually clicking. When false, deliver the click and settle for output. Set to false explicitly when you are confident about the coordinates. | |
| filePath | No | Preview only: absolute path to write the PNG to. If unset, image is inlined as base64. | |
| maxWaitMs | No | ||
| sessionId | Yes | Numeric id of the session to target. Get one by calling terminal_create. Use terminal_list to enumerate currently-known ids. |