MCPconceptTools

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice

Concept example A working example of the core library. It can change without notice. What concept means

tool MCP

run_shell_command

Run a shell command in a pane with your user’s permissions. Run a shell command in one pane, wait for it to finish, and report its singular real exit status and output. This is the tool for ‘run X and tell me if it worked’. It reaches only the pane you name: the command travels through a tmux buffer, which synchronize-panes does not fan out, so the exit status is one pane’s. Use send_keys when you want a synchronized cohort to receive input. Do NOT send keys and then poll a capture in a loop — this waits deterministically and costs one call. The command runs in a subshell, so cd and export do not persist. It refuses the named pane in a human-owned mode. Check linesMissed and anchorLost. A timed-out command MAY STILL BE RUNNING; inspect it and do not retry it — unless started is false, which means it never ran because something other than an idle shell was reading that pane’s input.

MCP request method
tools/call Send run_shell_command as the tool name, with the arguments below.

Arguments

  • command (string)

    The shell command.

  • maxLines? = null (integer | null)

    Maximum returned lines, newest kept. Omit for the server default, 500 unless LIBTMUX_MCP_MAX_LINES sets another.

    minimum
    -2147483648
    maximum
    2147483647
  • paneId? = null (string | null)

    A pane id. Omit for this server’s own pane, or else the one the first session shows.

  • suppressHistory? = false (boolean)

    Keep the command out of shell history on a best-effort basis.

  • timeoutSeconds? = null (number | null)

    Seconds to wait, lowered to the server’s ceiling. Omit to wait the whole ceiling, 30 unless LIBTMUX_MCP_WAIT_MAX_SECONDS sets another.

No other arguments are accepted.

Result

Returns object

Annotations

Advertised by the server

destructiveHint
true
idempotentHint
false
openWorldHint
true
readOnlyHint
false
title
"Run shell command"

Capability

Toolset
Execute Start or drive pane processes, or store state that can control later execution.
Process reach
pane-command
tmux effects
change observe

Every C# tool advertises the same annotations, so a host that approves by annotation cannot tell tools apart. The capability row is what tells them apart.

Protocol data

Use the complete advertised contract for validation and client integration.

Input schema
{
"additionalProperties": false,
"properties": {
"command": {
"description": "The shell command.",
"type": "string"
},
"maxLines": {
"default": null,
"description": "Maximum returned lines, newest kept. Omit for the server default, 500 unless LIBTMUX_MCP_MAX_LINES sets another.",
"maximum": 2147483647,
"minimum": -2147483648,
"type": [
"integer",
"null"
]
},
"paneId": {
"default": null,
"description": "A pane id. Omit for this server's own pane, or else the one the first session shows.",
"type": [
"string",
"null"
]
},
"suppressHistory": {
"default": false,
"description": "Keep the command out of shell history on a best-effort basis.",
"type": "boolean"
},
"timeoutSeconds": {
"default": null,
"description": "Seconds to wait, lowered to the server's ceiling. Omit to wait the whole ceiling, 30 unless LIBTMUX_MCP_WAIT_MAX_SECONDS sets another.",
"type": [
"number",
"null"
]
}
},
"required": [
"command"
],
"type": "object"
}
Output schema
{
"properties": {
"anchorLost": {
"default": false,
"type": "boolean"
},
"effectiveTimeoutSeconds": {
"type": "number"
},
"elapsedSeconds": {
"type": "number"
},
"exitStatus": {
"type": [
"integer",
"null"
]
},
"linesMissed": {
"default": false,
"type": "boolean"
},
"output": {
"properties": {
"droppedBytes": {
"type": "integer"
},
"droppedLines": {
"type": "integer"
},
"lines": {
"items": {
"type": "string"
},
"type": "array"
},
"truncated": {
"type": "boolean"
}
},
"required": [
"lines",
"truncated",
"droppedLines",
"droppedBytes"
],
"type": "object"
},
"paneExited": {
"default": false,
"type": "boolean"
},
"paneId": {
"type": "string"
},
"started": {
"default": true,
"type": "boolean"
},
"timedOut": {
"type": "boolean"
}
},
"required": [
"paneId",
"exitStatus",
"timedOut",
"output",
"elapsedSeconds",
"effectiveTimeoutSeconds"
],
"type": "object"
}
Esc
Search in

Type to search.

Reference previewOpen reference