Skip to content

ubq and MCP reference

ubq runs commands, reads output and manages host sessions. This reference lists its command-line verbs, MCP tools and macOS control-socket methods. Run ubq --json api list --surface all to inspect the methods and schemas available in your installed binary.

Generated from product version 0.2.0, commit c989e6125e. 22 command-line verbs, 13 MCP tools, 12 control-socket methods.

For the concepts (targets, labels, waiting, the agent policy), read Agents and ubq.

Operation Command line MCP tool Control socket Callers
ping ping local process
initialize initialize local process
list list local process
describe describe local process
ls ls local process
focus focus local process
send-text send-text local process
get-text get-text local process
new-window new-window local process
new-tab new-tab local process
split split local process
set-title set-title local process
terminal.new terminal_new person, agent
terminal.screen terminal_screen person, agent
terminal.changes terminal_changes person, agent
terminal.run terminal_run person, agent
terminal.send terminal_send person, agent
terminal.interrupt terminal_interrupt person, agent
terminal.resize terminal_resize person, agent
terminal.wait terminal_wait person, agent
terminal.wait_idle terminal_wait_idle agent
terminal.read_last terminal_read_last person, agent
terminal.list terminal_list person, agent
terminal.kill terminal_kill person, agent
terminal.screenshot terminal_screenshot person, agent
ubq.ls ls person, agent
ubq.new new person, agent
ubq.run run person, agent
ubq.send send person, agent
ubq.read read person, agent
pane.search search person, agent
file.read person, agent
paste.push person, agent
pane.capture person, agent
pane.pinGeometry person, agent
client.clipboardServing person, agent
events.subscribe person, agent
host.refresh person, agent
host.describe person, agent
host.methods person, agent
host.management.list person, agent
host.client.disconnect person, agent
host.grant.revoke person, agent
host.token.issue person, agent
host.token.revoke person, agent
pane.clear person, agent
pane.reclaim person
pane.overrideGeometry person, agent
session.terminate person, agent
host.session.terminate person
host.sessions.subscribe person, agent
host.sessions.unsubscribe person, agent
client.label person, agent
label.set person, agent
tags.set person, agent
workspace.share person
workspace.rename person, agent
tab.rename person, agent
tab.move person, agent
pane.moveToTab person, agent
tab.moveToPane person, agent
pane.moveToNewTab person, agent
pane.extractTab person, agent
pane.extractWindow person, agent
tab.extractWindow person, agent
pane.move person, agent
pane.swap person, agent
window.activate person, agent
tab.activate person, agent
pane.focus person, agent
window.moveFocus person, agent
pane.zoom person, agent
window.close person, agent
tab.balance person, agent
pane.adjustRatio person, agent
divider.setRatio person, agent
workspace.addWindow person, agent
workspace.addTab person, agent
workspace.split person, agent
workspace.closeTab person, agent
workspace.closePane person, agent
consent.respond person
consent.revoke person
ubq.split split person, agent
ubq.kill kill person, agent
ubq.label label person, agent
ubq.tag tag person, agent
ubq.tree tree person, agent
ubq.status status person, agent
ubq.wait wait person, agent
ubq.events events person, agent
ubq.api.list api list person, agent
ubq.api.describe api describe person, agent
ubq.api.call api call person, agent
ubq.api.validate api validate person, agent
agent.mcp mcp agent
agent.completions completions person
agent.selftest selftest person
agent.imagetest imagetest person

Run as ubq <verb>. Add --json for output that conforms to the result schema. The parameters below are the operation’s JSON names; the command line spells them as flags, which the ubq manual lists verb by verb.

Lists the daemon’s sessions with their session, window, tab and pane labels, size, prompt state, foreground process and directory.

Example:

{
"params": {},
"result": {
"sessions": [
{
"session": "session:3",
"label": "build",
"window": "window:1",
"windowLabel": "workbench",
"tab": "tab:1",
"tabLabel": "tests",
"pane": "pane:2",
"paneLabel": "",
"columns": 80,
"rows": 24,
"atPrompt": true,
"foreground": "zsh",
"directory": "/home/user",
"title": "zsh"
}
]
}
}

Creates a session running the login shell, optionally labels it and types a command into it, and returns its ID, once the agent policy allows it.

Parameter Type Required Description
label string A label to address the session by; setting it needs the drive scope and a person’s approval. (max length 64)
command string A command line typed into the new shell; typing it needs the drive scope. (min length 1)
columns integer (min 1; max 1000; default 80)
rows integer (min 1; max 1000; default 24)

Example:

{
"params": {
"label": "build",
"command": "make"
},
"result": {
"session": "session:3",
"pane": "pane:2"
}
}

Types a command line into a session and returns once its shell marks that command finished, after marking it started, with the command’s exit status and output, once the agent policy allows the line.

Parameter Type Required Description
session string A session ID, a session label, or here. (min length 1; max length 80)
pane string A pane ID, a pane label, or here. (min length 1; max length 80)
command string yes The command line to run. (min length 1)
timeout number Seconds to wait for the command to finish; absent waits as long as it runs. (min 0)

Example:

{
"params": {
"session": "build",
"command": "make test"
},
"result": {
"session": "session:3",
"exitStatus": 0,
"output": "ok\n",
"cursor": 41
}
}

Types text verbatim into a session, and returns the event cursor from before it was typed, once the agent policy allows it.

Parameter Type Required Description
session string A session ID, a session label, or here. (min length 1; max length 80)
pane string A pane ID, a pane label, or here. (min length 1; max length 80)
text string yes The bytes to type. (min length 1)
enter boolean Whether to press Return after the text. (default false)

Example:

{
"params": {
"pane": "logs",
"text": "q"
},
"result": {
"sent": 1,
"cursor": 40
}
}

Reads a session’s screen, its last command’s output, or the last lines of its scrollback as UTF-8 text.

Parameter Type Required Description
session string A session ID, a session label, or here. (min length 1; max length 80)
pane string A pane ID, a pane label, or here. (min length 1; max length 80)
source string (screen, last-command, scrollback) (default "screen")
lines integer For scrollback, how many lines ending at the bottom of the screen. (min 1; max 100000; default 100)

Example:

{
"params": {
"session": "build",
"source": "last-command"
},
"result": {
"source": "last-command",
"text": "ok\n"
}
}

Searches a pane’s whole history on the host by logical line, whatever of it the caller has fetched, and returns each match’s line and cells.

Parameter Type Required Description
pane integer yes The pane’s handle on the caller’s Sync connection; ubq search takes the pane from -s or -p and supplies its handle. (min 1)
pattern string yes A regular expression. (min length 1; max length 127)
from integer The first line searched; the oldest the host keeps when absent. (min 0; max 9007199254740991)
to integer The line past the last searched; the history’s head when absent. (min 0; max 9007199254740991)
caseSensitive boolean (default false)

Example:

{
"params": {
"pane": 1,
"pattern": "error: .*"
},
"result": {
"epoch": 1,
"matches": [
{
"line": 1204,
"startCell": 0,
"endCell": 17
}
],
"truncated": false
}
}

Splits a pane to the right or downward and starts a shell in the new pane, once the local policy allows it and an attached person approves this exact change; the requesting token must permit driving and creating sessions.

Parameter Type Required Description
session string A session ID, a session label, or here. (min length 1; max length 80)
pane string A pane ID, a pane label, or here. (min length 1; max length 80)
direction string (right, down) (default "right")

Example:

{
"params": {
"pane": "pane:2",
"direction": "down"
},
"result": {
"pane": "pane:5",
"session": "session:4"
}
}

Ends a session by hanging up its shell, once the agent policy and the session’s person allow it.

Parameter Type Required Description
session string A session ID, a session label, or here. (min length 1; max length 80)
pane string A pane ID, a pane label, or here. (min length 1; max length 80)

Example:

{
"params": {
"session": "build"
},
"result": {
"session": "session:3",
"terminated": true
}
}

Labels a workspace named with -w, a window with -W, a tab with -t, a pane with -p, or otherwise a session, so later verbs can address it by the label, once the agent policy allows it and the daemon lets this caller change the workspace; an empty label clears it.

Parameter Type Required Description
session string A session ID, a session label, or here. (min length 1; max length 80)
pane string A pane ID, a pane label, or here. (min length 1; max length 80)
tab string A tab ID, a tab label, or here. (min length 1; max length 80)
window string A window ID, a window label, or here. (min length 1; max length 80)
workspace string A workspace ID, a workspace label, or here. (min length 1; max length 80)
label string yes (max length 64)

Example:

{
"params": {
"pane": "pane:5",
"label": "logs"
},
"result": {
"object": "pane:5",
"label": "logs"
}
}

Replaces the tags on a workspace named with -w, a window with -W, a tab with -t, a pane with -p, or otherwise a session, once the agent policy allows it and the daemon lets this caller change the workspace; no tags clears them.

Parameter Type Required Description
session string A session ID, a session label, or here. (min length 1; max length 80)
pane string A pane ID, a pane label, or here. (min length 1; max length 80)
tab string A tab ID, a tab label, or here. (min length 1; max length 80)
window string A window ID, a window label, or here. (min length 1; max length 80)
workspace string A workspace ID, a workspace label, or here. (min length 1; max length 80)
tags array yes The tags, in the order they are drawn.

Example:

{
"params": {
"tab": "logs",
"tags": [
"production",
"billing"
]
},
"result": {
"object": "tab:7",
"tags": [
"production",
"billing"
]
}
}

Prints the daemon’s workspaces, windows, tabs and panes as an outline, one row a line, each with its name, labels, tags, status and how long since it wrote; words given after the verb keep only the rows that match every one.

Parameter Type Required Description
query string Words every row kept must contain. (max length 256)

Example:

{
"params": {},
"result": {
"matchCount": 0,
"rows": [
{
"level": "workspace",
"depth": 0,
"id": "workspace:1",
"title": "work"
}
],
"workspaceRevisions": [
{
"workspace": "workspace:1",
"revision": "7"
}
]
}
}

Reports the status records a session’s programs set with OSC 7501: idle, working, done, blocked or error, each with its message.

Parameter Type Required Description
session string A session ID, a session label, or here. (min length 1; max length 80)
pane string A pane ID, a pane label, or here. (min length 1; max length 80)

Example:

{
"params": {
"session": "build"
},
"result": {
"session": "session:3",
"state": "blocked",
"records": [
{
"id": "job",
"app": "make",
"state": "blocked",
"message": "Continue?",
"title": ""
}
]
}
}

Waits until a session’s command finishes, its foreground returns to the shell, a program reports it is blocked, or its screen shows some text, woken by the daemon’s events rather than by asking again, and says so when the events it waited on were dropped.

Parameter Type Required Description
session string A session ID, a session label, or here. (min length 1; max length 80)
pane string A pane ID, a pane label, or here. (min length 1; max length 80)
for string (exit, idle, blocked, text) yes
text string The text to wait for, with for text, which reads the screen and needs the region scope. (min length 1)
since integer An event cursor; events after it count, so nothing between an earlier verb and this wait is missed. (min 0; max 9007199254740991)
timeout number Seconds to wait; absent waits as long as it takes. (min 0)

Example:

{
"params": {
"session": "build",
"for": "exit"
},
"result": {
"matched": true,
"for": "exit",
"cursor": 42,
"event": {
"cursor": 42,
"kind": "command-finished",
"session": "session:3",
"exitStatus": 0,
"commandLine": "make",
"directory": "/src"
}
}
}

Prints the daemon’s events as they happen, one per line, resuming after a cursor when given one.

Parameter Type Required Description
session string Only this session’s events: an ID, a label, or here. (min length 1; max length 80)
pane string Only the events of this pane’s session. (min length 1; max length 80)
since integer Print every event after this cursor first; zero prints all the daemon holds. (min 0; max 9007199254740991)
limit integer Stop after this many events. (min 1; max 9007199254740991)
timeout number Stop after this many seconds. (min 0)

Example:

{
"params": {
"since": 40
},
"result": {
"cursor": 41,
"kind": "command-finished",
"session": "session:3",
"exitStatus": 0,
"commandLine": "make",
"directory": "/src"
}
}

Lists the operations one surface reaches, by the name it reaches each by: the command line’s verbs, the app’s control-socket methods, the MCP tools, or every operation, each with a sentence saying what it does and its parameter and result schemas.

Parameter Type Required Description
surface string (command-line, control, mcp, sync, all) Which surface to list: the command line, the app’s control socket, the MCP server, a Sync connection’s calls, or all of them. (default "command-line")

Example:

{
"params": {
"surface": "control"
},
"result": {
"methods": [
{
"name": "send-text",
"controlMethod": "send-text",
"description": "Types text verbatim into a pane's program.",
"params": {
"type": "object"
},
"result": {
"type": "object"
}
}
]
}
}

Describes one operation by any name it is reached by: its schemas, an example, who may call it, and its name on each surface.

Parameter Type Required Description
method string yes (min length 1)

Example:

{
"params": {
"method": "wait"
},
"result": {
"name": "ubq.wait",
"description": "Waits until a command finishes.",
"params": {
"type": "object"
},
"result": {
"type": "object"
},
"example": {
"params": {},
"result": {}
},
"principals": [
"person",
"agent"
],
"commandLineVerb": "wait"
}
}

Calls an operation with its parameters given as JSON, validating them against its schema, and prints its result as JSON.

Parameter Type Required Description
method string yes (min length 1)
params object The operation’s parameters; absent is an empty object.

Example:

{
"params": {
"method": "ls",
"params": {}
},
"result": {
"sessions": []
}
}

Checks a JSON document against an operation’s result schema, as a script checks what –json printed, and names where it departs from it.

Parameter Type Required Description
method string yes Any name the operation is reached by. (min length 1)
document object The result to check; absent is an empty object.

Example:

{
"params": {
"method": "send",
"document": {
"sent": 5,
"cursor": 40
}
},
"result": {
"valid": true
}
}

Serves the MCP tools over standard input and output until the client closes them.

Example:

{
"params": {},
"result": {}
}

Prints the command line’s completion script for a shell.

Parameter Type Required Description
shell string (bash, zsh) yes

Example:

{
"params": {
"shell": "zsh"
},
"result": {
"script": "#compdef ubq\n"
}
}

Attaches to the daemon, runs a command, and reads its output back, reporting whether the round trip works.

Example:

{
"params": {},
"result": {
"passed": true
}
}

Draws an inline image in a fresh session and checks that its pixels reach the client, reporting whether they did.

Example:

{
"params": {},
"result": {
"passed": true
}
}

ubq mcp serves these over stdio. Arguments are validated against each tool’s schema before anything reaches a session.

Creates a session running the login shell on the daemon and returns its ID, once the agent policy allows it.

Parameter Type Required Description
columns integer (min 1; max 1000; default 80)
rows integer (min 1; max 1000; default 24)

Example:

{
"params": {
"columns": 120,
"rows": 40
},
"result": {
"content": [
{
"type": "text",
"text": "session 3"
}
]
}
}

Reads a session’s screen as UTF-8 text, box drawing and full-screen layouts included.

Parameter Type Required Description
session integer yes A session ID from terminal_new or terminal_list. (min 1)
format string (text, structured) (default "text")

Example:

{
"params": {
"session": 3
},
"result": {
"content": [
{
"type": "text",
"text": "$ ls\nREADME.md\n"
}
]
}
}

Reports the rows of a session’s screen that changed since this caller last read it.

Parameter Type Required Description
session integer yes A session ID from terminal_new or terminal_list. (min 1)

Example:

{
"params": {
"session": 3
},
"result": {
"content": [
{
"type": "text",
"text": "(no change)"
}
]
}
}

Runs a command line in a session and returns the settled screen with the command’s exit status, once the agent policy allows the line.

Parameter Type Required Description
command string yes The command line to run. (min length 1)
session integer A session ID; 0 or absent creates one. (min 0)
timeout_ms integer (min 0; default 10000)

Example:

{
"params": {
"command": "make test",
"session": 3
},
"result": {
"content": [
{
"type": "text",
"text": "ok\n[exit=0]"
}
]
}
}

Types text verbatim into a session, once the agent policy allows it.

Parameter Type Required Description
text string yes The bytes to type; no newline is added. (min length 1)
session integer A session ID; 0 or absent creates one. (min 0)

Example:

{
"params": {
"text": "q",
"session": 3
},
"result": {
"content": [
{
"type": "text",
"text": "sent"
}
]
}
}

Sends Control-C to a session, once the agent policy allows it.

Parameter Type Required Description
session integer A session ID; 0 or absent creates one. (min 0)

Example:

{
"params": {
"session": 3
},
"result": {
"content": [
{
"type": "text",
"text": "interrupted"
}
]
}
}

Resizes a session’s grid, once the agent policy allows it.

Parameter Type Required Description
session integer yes (min 1)
columns integer yes (min 1; max 1000)
rows integer yes (min 1; max 1000)

Example:

{
"params": {
"session": 3,
"columns": 100,
"rows": 30
},
"result": {
"content": [
{
"type": "text",
"text": "resized"
}
]
}
}

Waits until a session’s screen shows a substring or the timeout passes, and returns the screen.

Parameter Type Required Description
substring string yes (min length 1)
session integer yes (min 1)
timeout_ms integer (min 0; default 10000)

Example:

{
"params": {
"substring": "$ ",
"session": 3
},
"result": {
"content": [
{
"type": "text",
"text": "FOUND\n$ "
}
]
}
}

Waits until a session’s foreground returns to its shell, or the timeout passes.

Parameter Type Required Description
session integer yes (min 1)
timeout_ms integer (min 0; default 10000)

Example:

{
"params": {
"session": 3
},
"result": {
"content": [
{
"type": "text",
"text": "idle"
}
]
}
}

Returns the output of a session’s last command, as its shell integration marked it.

Parameter Type Required Description
session integer yes (min 1)
timeout_ms integer (min 0; default 10000)

Example:

{
"params": {
"session": 3
},
"result": {
"content": [
{
"type": "text",
"text": "ok\n"
}
]
}
}

Lists the daemon’s sessions with their size, whether each is at its prompt, its foreground process, and its directory.

Example:

{
"params": {},
"result": {
"content": [
{
"type": "text",
"text": "3\t80x24\tidle\tzsh\t/home/user\n"
}
]
}
}

Ends a session by hanging up its shell, once the agent policy and the session’s owner allow it.

Parameter Type Required Description
session integer yes (min 1)

Example:

{
"params": {
"session": 3
},
"result": {
"content": [
{
"type": "text",
"text": "terminated"
}
]
}
}

Renders a session’s screen to a PNG image, for when pixels matter more than text.

Parameter Type Required Description
session integer yes (min 1)
path string A bare file name to also save the image under in the screenshots directory. (min length 1)

Example:

{
"params": {
"session": 3
},
"result": {
"content": [
{
"type": "image",
"data": "iVBORw0KGgo=",
"mimeType": "image/png"
}
]
}
}

The macOS app serves these as newline-delimited JSON-RPC 2.0 on a local socket when [control] enable = true. See Security and permissions.

Answers with the server’s name and the control methods it serves, without touching any window.

Example:

{
"params": {},
"result": {
"name": "ubiquitty-control",
"methods": [
"ping",
"ls"
]
}
}

Opens a JSON-RPC session, answering as ping does; a client’s handshake fields are accepted and read by nothing.

Example:

{
"params": {
"clientInfo": {
"name": "script"
}
},
"result": {
"name": "ubiquitty-control",
"methods": [
"ping",
"ls"
]
}
}

Lists every operation the caller may invoke, with a sentence saying what each does.

Example:

{
"params": {},
"result": {
"methods": [
{
"name": "ls",
"description": "Lists every window.",
"controlMethod": "ls"
}
]
}
}

Describes one operation: its parameter and result schemas, an example, who may call it, and the name each surface reaches it by.

Parameter Type Required Description
method string yes Any name the operation is reached by: the registry’s, the control method, the MCP tool, or the command-line verb. (min length 1)

Example:

{
"params": {
"method": "ls"
},
"result": {
"name": "ls",
"description": "Lists every window.",
"params": {
"type": "object"
},
"result": {
"type": "object"
},
"example": {
"params": {},
"result": {
"windows": []
}
},
"principals": [
"localProcess"
],
"controlMethod": "ls"
}
}

Lists every window with its tabs and the panes each tab holds.

Example:

{
"params": {},
"result": {
"windows": [
{
"id": 4,
"title": "zsh",
"focused": true,
"remote": false,
"tabs": [
{
"index": 0,
"windowID": 4,
"title": "zsh",
"selected": true,
"panes": [
{
"id": 1,
"focused": true,
"columns": 80,
"rows": 24,
"title": "zsh"
}
]
}
]
}
]
}
}

Raises a window, selects its tab, and focuses a pane in it.

Parameter Type Required Description
window integer A window ID from ls; 0 or absent means the key window. (min 0)
pane integer A pane ID from ls; 0 or absent leaves the window’s focus. (min 0)

Example:

{
"params": {
"window": 4,
"pane": 2
},
"result": {
"focused": true,
"window": 4
}
}

Types text verbatim into a pane’s program, once the agent policy allows the line.

Parameter Type Required Description
window integer A window ID from ls; 0 or absent means the key window, or the window holding pane. (min 0)
pane integer A pane ID from ls; 0 or absent means the window’s focused pane. (min 0)
text string yes The bytes to type; a trailing newline runs a command line. (min length 1)

Example:

{
"params": {
"pane": 2,
"text": "make test\n"
},
"result": {
"sent": 10
}
}

Reads a pane’s visible screen or its selection as text, once the agent policy allows the read.

Parameter Type Required Description
window integer A window ID from ls; 0 or absent means the key window, or the window holding pane. (min 0)
pane integer A pane ID from ls; 0 or absent means the window’s focused pane. (min 0)
source string (screen, selection) (default "screen")

Example:

{
"params": {
"pane": 2,
"source": "screen"
},
"result": {
"source": "screen",
"text": "$ make test\nok\n"
}
}

Opens a window running the login shell, once the agent policy allows it.

Example:

{
"params": {},
"result": {
"window": 7
}
}

Opens a tab beside the key window’s, or a window when none is open, once the agent policy allows it.

Example:

{
"params": {},
"result": {
"window": 8
}
}

Splits a window’s focused pane to the right or downward, once the agent policy allows it.

Parameter Type Required Description
window integer A window ID from ls; 0 or absent means the key window. (min 0)
direction string (right, down) (default "right")

Example:

{
"params": {
"direction": "down"
},
"result": {
"window": 4
}
}

Pins a window’s title, or clears the pin when the title is empty.

Parameter Type Required Description
window integer A window ID from ls; 0 or absent means the key window. (min 0)
title string yes The title; empty returns the window to its automatic one.

Example:

{
"params": {
"title": "build"
},
"result": {
"window": 4,
"title": "build"
}
}