Execute a command in a tmux session
execRun a shell command in a tmux session, wait up to a timeout, then return the exit code and cleaned output; force is required for foreign or non-shell targets.
Instructions
Type a command into a session, wait for it to finish (bounded by timeout_ms), and return the exit code and cleaned output. Defaults to the owned session "mcp". Foreign, attached, or non-shell targets require force: true. The default timeout is 30 seconds; on timeout the command is left running and the partial output is returned.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"command": "<command>"
},
"name": "exec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | Allow writing to a foreign, attached, or non-shell target | |
| command | Yes | Shell command to run | |
| session | No | Target session (default: owned session "mcp") | |
| timeout_ms | No | Wait timeout in milliseconds (default: 30000) |