Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

send_keys

Send keys (commands or text) to a tmux pane.

Use this for raw interactive input: TUI keys, control sequences, partial shell input, or persistent shell state. Use send_keys_batch when you need several ordered raw-input operations.

For authored shell commands that need completion, exit status, or captured output, use run_command instead. For custom completion outside that shape, compose tmux wait-for -S <channel> into the shell command and call wait_for_channel. For repeated observation after input, prefer capture_since; reserve wait_for_text for output the agent does not author.

Do NOT call capture_pane immediately — both the read and the pattern-match paths race the pane’s PTY draw.

All Python tools · JSON · Source

Arguments

enter optional · boolean
Whether to press Enter after sending keys. Default True.

Default: true.

keys required · string
The keys or text to send.
literal optional · boolean
Whether to send keys literally (no tmux interpretation). Default False.

Default: false.

pane_id optional
Pane ID (e.g. '%1').

Default: null.

session_id optional
Session ID (e.g. '$1') for pane resolution.

Default: null.

session_name optional
Session name for pane resolution.

Default: null.

socket_name optional
tmux socket name.

Default: null.

suppress_history optional · boolean
Suppress shell history by prepending a space; only effective where the shell ignores space-prefixed commands. Default False.

Default: false.

window_id optional
Window ID for pane resolution.

Default: null.

Schemas

The schema defines required fields, nested values, defaults, and validation constraints.

Input schema
{
"additionalProperties": false,
"properties": {
"enter": {
"default": true,
"description": "Whether to press Enter after sending keys. Default True.",
"type": "boolean"
},
"keys": {
"description": "The keys or text to send.",
"type": "string"
},
"literal": {
"default": false,
"description": "Whether to send keys literally (no tmux interpretation). Default False.",
"type": "boolean"
},
"pane_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Pane ID (e.g. '%1')."
},
"session_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Session ID (e.g. '$1') for pane resolution."
},
"session_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Session name for pane resolution."
},
"socket_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "tmux socket name."
},
"suppress_history": {
"default": false,
"description": "Suppress shell history by prepending a space; only effective where\nthe shell ignores space-prefixed commands. Default False.",
"type": "boolean"
},
"window_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Window ID for pane resolution."
}
},
"required": [
"keys"
],
"type": "object"
}
Output schema
{
"properties": {
"result": {
"type": "string"
}
},
"required": [
"result"
],
"type": "object",
"x-fastmcp-wrap-result": true
}
Tool annotations
{
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": false
}
Esc

Type to search.