# send_keys_batch

Source: https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/

> Send an ordered batch of raw key/text operations to tmux panes.

tool MCPstable

MCP is in development

Server behavior and tool contracts may change. Tool availability depends on the server configuration.

* **send_keys_batch**( [on_error](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Fon_error)?: "stop" | "continue", [operations](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Foperations): [Array](https://json-schema.org/understanding-json-schema/reference/array "array (JSON Schema)")<[object](https://json-schema.org/understanding-json-schema/reference/object "object (JSON Schema)")>, [socket_name](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Fsocket_name)?: [string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"), [timeout](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Ftimeout)?: [number](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"), )

  tool \[[source](https://github.com/tmux-python/libtmux-mcp/blob/4daddc0dfca96c43bf521d818bf91564e1434760/src/libtmux_mcp/tools/pane_tools/__init__.py#L87)][¶](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch)

  Send an ordered batch of raw key/text operations to tmux panes.

  Use this for bulk TUI or persistent-shell input where each item is the same kind of low-level terminal interaction as [`send_keys`](https://libtmux.org/en/py/stable/mcp/tools/send_keys/). For authored shell commands that need exit status and captured output, use [`run_command`](https://libtmux.org/en/py/stable/mcp/tools/run_command/) instead. For repeated observation after sending input, use [`capture_since`](https://libtmux.org/en/py/stable/mcp/tools/capture_since/) with its returned cursor.

  This tool intentionally does not compose heterogeneous operations such as send → wait → capture. Keeping the batch homogeneous preserves clear per-operation error attribution and avoids embedding a workflow DSL in the MCP tool surface.

  * MCP request method

    `tools/call` Send `send_keys_batch` as the tool name, with the arguments below.

  ## Arguments[#](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.parameters)

  * **[`on_error`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Fon_error)**? = `"stop"` ("stop" | "continue")

    Whether to stop at the first failed operation or keep attempting later operations. Default “stop”.

  * **[`operations`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Foperations)** ([Array](https://json-schema.org/understanding-json-schema/reference/array "array (JSON Schema)")<[object](https://json-schema.org/understanding-json-schema/reference/object "object (JSON Schema)")>)

    Ordered raw-input operations to send.

    * **[Items](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Foperations%2Fitems)** ([object](https://json-schema.org/understanding-json-schema/reference/object "object (JSON Schema)"))

      One raw-input operation for batch sending.

      Used by `send_keys_batch`.

      * **[`enter`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Foperations%2Fitems%2Fproperties%2Fenter)**? = `true` ([boolean](https://json-schema.org/understanding-json-schema/reference/boolean "boolean (JSON Schema)"))

        Whether to press Enter after sending keys.

      * **[`keys`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Foperations%2Fitems%2Fproperties%2Fkeys)** ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)"))

        Keys or text to send.

      * **[`literal`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Foperations%2Fitems%2Fproperties%2Fliteral)**? = `false` ([boolean](https://json-schema.org/understanding-json-schema/reference/boolean "boolean (JSON Schema)"))

        Whether to send keys literally with no tmux key interpretation.

      * **[`pane_id`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Foperations%2Fitems%2Fproperties%2Fpane_id)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

        Pane ID (e.g. ‘%1’).

      * **[`session_id`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Foperations%2Fitems%2Fproperties%2Fsession_id)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

        Session ID (e.g. ‘$1’) for pane resolution.

      * **[`session_name`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Foperations%2Fitems%2Fproperties%2Fsession_name)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

        Session name for pane resolution.

      * **[`suppress_history`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Foperations%2Fitems%2Fproperties%2Fsuppress_history)**? = `false` ([boolean](https://json-schema.org/understanding-json-schema/reference/boolean "boolean (JSON Schema)"))

        Suppress shell history by prepending a space where the shell ignores space-prefixed commands.

      * **[`window_id`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Foperations%2Fitems%2Fproperties%2Fwindow_id)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

        Window ID for pane resolution.

      No other properties are accepted.

  * **[`socket_name`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Fsocket_name)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    tmux socket name.

  * **[`timeout`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.input%2Fproperties%2Ftimeout)**? = `null` ([number](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    Maximum time in seconds to allow the batch to run before aborting.

  No other arguments are accepted.

  ## Result[#](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.result)

  Returns [object](https://json-schema.org/understanding-json-schema/reference/object "object (JSON Schema)")

  * **[`failed`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.output%2Fproperties%2Ffailed)** ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)"))

    Number of operations that failed.

  * **[`results`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.output%2Fproperties%2Fresults)**? ([Array](https://json-schema.org/understanding-json-schema/reference/array "array (JSON Schema)")<[object](https://json-schema.org/understanding-json-schema/reference/object "object (JSON Schema)")>)

    Per-operation results in attempted order.

    * **[Items](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.output%2Fproperties%2Fresults%2Fitems)** ([object](https://json-schema.org/understanding-json-schema/reference/object "object (JSON Schema)"))

      Per-operation result from batch sending.

      Returned by `send_keys_batch`.

      * **[`elapsed_seconds`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.output%2Fproperties%2Fresults%2Fitems%2Fproperties%2Felapsed_seconds)** ([number](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)"))

        Time spent on this operation.

      * **[`error`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.output%2Fproperties%2Fresults%2Fitems%2Fproperties%2Ferror)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

        Error message for this operation, if it failed.

      * **[`index`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.output%2Fproperties%2Fresults%2Fitems%2Fproperties%2Findex)** ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)"))

        Zero-based index in the submitted operation list.

      * **[`pane_id`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.output%2Fproperties%2Fresults%2Fitems%2Fproperties%2Fpane_id)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

        Resolved pane ID, or None if target resolution failed.

      * **[`success`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.output%2Fproperties%2Fresults%2Fitems%2Fproperties%2Fsuccess)** ([boolean](https://json-schema.org/understanding-json-schema/reference/boolean "boolean (JSON Schema)"))

        True when this operation sent successfully.

  * **[`stopped_at`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.output%2Fproperties%2Fstopped_at)**? = `null` ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    Index where processing stopped because on_error=‘stop’, or None when all operations were attempted.

  * **[`succeeded`](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.output%2Fproperties%2Fsucceeded)** ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)"))

    Number of operations sent successfully.

  ## Annotations[#](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.annotations)

  * [`destructiveHint`](https://libtmux.org/en/py/stable/mcp/reference/glossary/#destructiveHint)

    `true`

  * [`idempotentHint`](https://libtmux.org/en/py/stable/mcp/reference/glossary/#idempotentHint)

    `false`

  * [`openWorldHint`](https://libtmux.org/en/py/stable/mcp/reference/glossary/#openWorldHint)

    `true`

  * [`readOnlyHint`](https://libtmux.org/en/py/stable/mcp/reference/glossary/#readOnlyHint)

    `false`

  ## Protocol data[#](https://libtmux.org/en/py/stable/mcp/tools/send_keys_batch/#mcp.tool.send_keys_batch.schemas)

  Use the complete advertised contract for validation and client integration.

  Input schema

  ```json
  {
    "additionalProperties": false,
    "properties": {
      "on_error": {
        "default": "stop",
        "description": "Whether to stop at the first failed operation or keep attempting\nlater operations. Default \"stop\".",
        "enum": [
          "stop",
          "continue"
        ],
        "type": "string"
      },
      "operations": {
        "description": "Ordered raw-input operations to send.",
        "items": {
          "additionalProperties": false,
          "description": "One raw-input operation for batch sending.\n\nUsed by :func:`~libtmux_mcp.tools.pane_tools.send_keys_batch`.",
          "properties": {
            "enter": {
              "default": true,
              "description": "Whether to press Enter after sending keys.",
              "type": "boolean"
            },
            "keys": {
              "description": "Keys or text to send.",
              "type": "string"
            },
            "literal": {
              "default": false,
              "description": "Whether to send keys literally with no tmux key interpretation.",
              "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."
            },
            "suppress_history": {
              "default": false,
              "description": "Suppress shell history by prepending a space where the shell ignores space-prefixed commands.",
              "type": "boolean"
            },
            "window_id": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "description": "Window ID for pane resolution."
            }
          },
          "required": [
            "keys"
          ],
          "type": "object"
        },
        "type": "array"
      },
      "socket_name": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "default": null,
        "description": "tmux socket name."
      },
      "timeout": {
        "anyOf": [
          {
            "type": "number"
          },
          {
            "type": "null"
          }
        ],
        "default": null,
        "description": "Maximum time in seconds to allow the batch to run before aborting."
      }
    },
    "required": [
      "operations"
    ],
    "type": "object"
  }
  ```

  Output schema

  ```json
  {
    "description": "Structured result for a batch of raw-input send operations.",
    "properties": {
      "failed": {
        "description": "Number of operations that failed.",
        "type": "integer"
      },
      "results": {
        "description": "Per-operation results in attempted order.",
        "items": {
          "description": "Per-operation result from batch sending.\n\nReturned by :func:`~libtmux_mcp.tools.pane_tools.send_keys_batch`.",
          "properties": {
            "elapsed_seconds": {
              "description": "Time spent on this operation.",
              "type": "number"
            },
            "error": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "description": "Error message for this operation, if it failed."
            },
            "index": {
              "description": "Zero-based index in the submitted operation list.",
              "type": "integer"
            },
            "pane_id": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "description": "Resolved pane ID, or None if target resolution failed."
            },
            "success": {
              "description": "True when this operation sent successfully.",
              "type": "boolean"
            }
          },
          "required": [
            "index",
            "success",
            "elapsed_seconds"
          ],
          "type": "object"
        },
        "type": "array"
      },
      "stopped_at": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ],
        "default": null,
        "description": "Index where processing stopped because on_error='stop', or None when all operations were attempted."
      },
      "succeeded": {
        "description": "Number of operations sent successfully.",
        "type": "integer"
      }
    },
    "required": [
      "succeeded",
      "failed"
    ],
    "type": "object"
  }
  ```
