mait.sh1.132.1

Private beta: features and content may change. No warranty; use at your own risk.

Tools

The eight tools grouped by what you use them for, with their parameters, the limits and what each result does and does not prove.

Beta
Overview

Eight tools for running commands and driving terminals.

The eight MAIT tools support command results and interactive terminal work. A session argument names a terminal, not your MCP connection. Keep the initialized connection for related calls and coordinate any persistent handoff.

mcp-consolemait0.13.9the service
Run

Run to completion and get the real exit code.

ToolSourceUse it toParameters
terminal_runMAITRun a command to completion and get its exit code, output and duration. By default it uses a throwaway terminal that is closed afterwards; you can instead run it in a terminal you named, or in the background and watch it yourself.command (required), session, shell (bash, zsh, fish, sh), cwd, env, stdin, timeout (seconds, default 120), background, maxOutputBytes

Why: use it for any command whose result matters. Read exitCode and timedOut: receiving a result is not proof that a command succeeded, and a timeout ends the wait without necessarily stopping the command, so do not repeat work that changes things. The inline output is a head and tail; for a temporary foreground run, retrieve the retained capture with terminal_read in run_output mode and the returned runId. For a named terminal, read its retained scrollback instead. A background run does not create a run-output record, so read its terminal instead.

A run in a named terminal can keep that shell's directory and variables. With stdin, do not rely on that command's environment changes carrying to the next call; verify any state needed later. One supported execution mode keeps at most 8 MiB of one run before previewing; installed modes can differ, and the inline preview is 2 KiB of head plus 2 KiB of tail unless maxOutputBytes says otherwise: a larger value widens the preview but cannot bring back bytes that were never kept. A run also shares its terminal with raw input and any browser participant, so agree who supplies input.

Terminals

Create a terminal and keep track of it.

ToolSourceUse it toParameters
terminal_openMAITCreate a named terminal, change one you own, or reattach to a detached persistent one. The result tells you which of the three happened: created, changed or attached.name, shell, command, cwd, env, size (columns 1 to 500, rows 1 to 200), group, tags, persistent, web, session, attach
terminal_listMAITList the terminals you can see, with state, shell, size and times. Ask for detail to also see the working folder, the last exit status and what ran.state (active, exited, all), group, tags, detail, session, historyLimit
terminal_closeMAITEnd one terminal, a group or all of them, or detach a persistent one so it keeps running. The exit status it reports is a cleanup value, not the workload's exit code.session, group, all, force, signal (term, kill), detach

Why: open one terminal per task or per program, give it a name, and close it when done. Save the returned session id. Closing and an empty list are not proof that every descendant process has stopped, so check when a job must really be gone. terminal_open with a command waits up to 300 milliseconds for first output and does not wait for the program to be ready. Only one of session, group or all should be given to terminal_close; if several are given, all wins over group, and group over session.

The terminal_open options in practice:

OptionWhat it does
sessionChange a terminal you own (name, size, added tags, web); otherwise try to attach a detached persistent one by that id
attach with tagsAttach any detached persistent terminal that carries one of the tags; with no tags it does not prevent creation
name, size, tags, webApplied on creation, and on a change. group, persistent, cwd, env, shell and command apply only on creation
webtrue opens browser access and returns an attachUrl (or issues a new link); false disables it on a change; leaving it out changes nothing

Attaching returns once ownership has changed and does not apply the other fields: look at the state, then ask for a separate change. A tag search can pick any eligible match, so do not use it where several terminals could fit. The attachUrl is a secret link; confirm with the service owner that the bridge is running. terminal_list shows the default of 15 execution records with detail; use completed history and the current screen when checking command progress, and an exit status of -1 means none was collected. A group close ends only active terminals; list them afterwards, because any that failed to close stay listed.

Input and output

Send input and read what came back.

ToolSourceUse it toParameters
terminal_sendMAITType text and named keys into a live terminal, and optionally wait for the screen to settle or match. It only sends input: it does not run a command on its own or report an exit status, so use the run tool for that.session or group, text, enter, keys (enter, tab, escape, arrows, f1 to f12, and more), ctrl, alt, shift, await (until: stable, prompt, pattern, none; ms; pattern)
terminal_readMAITRead a terminal's screen, last lines, new output, history, a region, recorded frames or the output of an earlier run. Output can be plain text, with colours or by lines, can be filtered, and is cut to a size limit you can set.session (not needed for run_output), mode (screen, tail, incremental, scrollback, region, frames, run_output), lines, range, region, runId, filter, format, maxBytes, since, limit

Why: a successful send reports that input was accepted, not that the program handled it. Confirm the effect on the screen and do not resend a side-effecting line on a doubt. An inline wait has a ten-second ceiling and prompt is a quiet-screen check, not a recognised prompt. Use scrollback or incremental for output that has scrolled away, and screen to judge a prompt or a full-screen program. Text goes in before named keys. ctrl works with a single ASCII letter, alt applies to named keys rather than ordinary text, and shift is unsupported; bytesSent is an accounting figure and not a transcript. The output of a send shows the viewport lines that changed, so it can leave out what scrolled away.

The ways terminal_read can read, chosen with mode:

ModeWhat it returns
screenThe current view (the default); use it to judge a prompt or a full-screen program
tailThe bottom rows of the view, set with lines; it is not older history
incrementalThe finished lines since the terminal's cursor, which every reader of that terminal shares: another reader can move it, and an unfinished prompt can be missing
scrollbackRetained history, by lines or by a half-open range [start, end] counted from the oldest retained line
regionA rectangle of the current screen: region needs x, y, w and h
framesFrames of changed screen text, after you start a frame watch: pass the returned nextSince as since for the next read, and historyTruncated reports a gap
run_outputThe stored capture of a foreground run with no session, by runId, with an ordered range; lines does not page it

Output comes as text, ansi or lines. The default budget is 48 KiB. History keeps a configured number of lines and approximates carriage returns and redraws. An empty lines read can come back with no content fields, so ask for text when you need an explicit empty answer. Incremental reads consume their returned position even when filtering or response limits omit content. Filters are a reading aid; review shared output separately for confidentiality.

Watch

Be told about changes and see what a job uses.

ToolSourceUse it toParameters
terminal_watchMAITSubscribe to output changes or resource use of a terminal or group. Setup is reported per terminal and delivery depends on your client accepting notifications, so reading frames yourself is the fallback.session or group, on (event names), format, frameIntervalMs (20 to 60,000), resource (thresholds cpuPct, memBytes, memPct, intervalMs, sustainedMs, cooldownMs, recover), off
terminal_statsMAITMeasure the CPU and memory used by a terminal's processes. CPU is a share of the whole machine, so one busy core out of eight shows as 12.5 percent.session or group, detail (adds the heaviest processes, with their command lines)

Why: these are diagnostic signals, not limits: neither ends a job that runs too hot. Frame reads keep up to 120 frames of changed screen text and are not a recording.

Only one output mode is active per watch: frame wins over idle, and otherwise the watch samples new output. A frame watch uses frameIntervalMs, 100 by default and held between 20 and 60,000. Output sampling sends at 4,096 bytes or 10 lines, so it can skip smaller writes and is not a transcript. idle means periodic statistics, and the complete, pattern and exit labels do not give separate detection. off: true ends both the output mode and any resource watcher. Adding resource starts a separate sampler, and a later watch without it does not stop that one. The resource options:

FieldMeaning
cpuPct, memBytes, memPctOptional "at or above" thresholds; with none, you get periodic samples
intervalMs2,000 ms by default unless the service sets another, held between 500 and 300,000
sustainedMs15,000 ms by default: how long a threshold must stay exceeded
cooldownMs60,000 ms between repeated alerts
recoverOn by default: report when the values fall back under the thresholds

When several thresholds are exceeded, CPU is reported first, then memory bytes, then memory percent, and they share one sustained timer. Stats are cached, and the first sample for a process has no earlier CPU interval; resident memory sums can count shared memory more than once. A detailed stats result includes command lines, which can contain credentials or private paths.

Lifetimes

What a terminal is and how long it lives.

KindLives until
Temporary foreground run with no sessionCleanup is attempted after the foreground result or error; background creation needs explicit close
Named, not persistentYou close it, idle cleanup applies, its owning session is reclaimed, or the service stops; closing a Unix/HTTP connection alone is not session cleanup
PersistentExplicit close, expiry or ordinary service stop; supported handoff/reload can retain it only when the installation provides continuity
Detached persistentWaiting for a connection to attach to it

Defaults: an attached terminal idle for an hour is detached (persistent) or ended (not persistent), and a detached persistent terminal is ended after a day. The service owner can change both limits. A terminal is exempt from idle cleanup while the service tracks a command running in it.

Limits

What to expect when a call fails.

A failed request can return a protocol error, while an accepted tool call can return an error result. Inspect both layers and each per-terminal result. The limits that matter:

LimitValue
Foreground wait120 seconds by default, set with timeout
Inline preview of a runA head and a tail, about 4 KiB in all by default; maxOutputBytes changes it
Stored run capturesAt most 500 entries and 64 MiB in total, kept in memory
Terminal size1 to 500 columns and 1 to 200 rows
Background trackingA command tracked as running is followed for up to 24 hours
Browser accessOff unless the service owner enables the web bridge and you opt a terminal in with web: true

A browser attach link is a secret. Output, command lines and links can hold confidential information, so ask for only what the task needs. The service owner's options are on Settings, and the fixes for common failures are on Problems and fixes.