send_to_terminal
Send text into a terminal's running program without focusing it, with optional submit. Use for typing or pasting commands into any terminal buffer.
Instructions
Type text into a terminal buffer's running program (usually a shell) by writing to its job channel. This is a mutation tool — the text reaches the program's stdin as if typed, but is not executed unless submit is true.
text: the text to send, raw. In most shells an embedded newline acts
like pressing Enter, so multi-line text may execute line by line.
When submit is false, trailing newlines are stripped so nothing
runs by accident.
terminal: which terminal to target — a buffer number or buffer name,
as listed under terminals in get_state / get_state_brief.
Names match exactly first, then by unique substring. Omit it when
exactly one terminal exists; with several open, omitting it
returns an error listing them.
submit: false (default) leaves the text at the prompt for the user
to review and press Enter. true appends a carriage return so the
program executes it immediately. NEVER pass submit=true unless
the user has explicitly asked for the command to be run — "put",
"paste", "type", or "prepare" a command always means
submit=false. Suggesting a command yourself is not permission to
run it. When in doubt, use submit=false and let the user press
Enter.
Use this whenever text needs to go into a terminal. It works
regardless of focus, mode, or visibility and never moves the user's
cursor — unlike send_keys, which requires focusing the terminal
and juggling modes. Terminal buffers cannot be edited with the
buffer tools.
Returns {sent, terminal, buf, submitted} on success — sent is the
byte count actually written. On failure returns {error}, including
a terminals list when the target was missing or ambiguous.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| submit | No | ||
| terminal | No |