plonk
v0.4.3Plonk gives agents local macOS tools for windows, workspaces, screenshots, OCR, and more.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
get_state
Get the current desktop state: all screens/monitors (index, frame, visible area — coordinates have origin at top-left of the primary screen, y grows down), all open windows (app name, title, which screen it is on, absolute frame, and 'fraction' — its position as fractions 0..1 of that screen's visible area), 'zone_sets' (every set by name, each zone as {x,y,w,h} with a 'name' where the set gives it one), 'screen_zone_sets' (which set each monitor wears), saved layout names, 'app_rules' (where each app's new windows open, see set_app_rule), 'place_new_windows' and 'auto_fill_zones', whether…
save_workspace
Save a workspace: the apps of a desktop setup, where each window goes, and what each app should open. Pass 'items' to describe the arrangement, or omit them to snapshot the windows exactly as they are on screen right now. Saving over an existing name replaces it. Saved workspaces are listed in get_state, with their full contents.
| Parameter | Type | Description |
|---|---|---|
name * | string | Workspace name, e.g. 'work', 'writing' |
items | array | |
move_existing | boolean | When true (the default), an app that is already running has its windows moved into place. When false, running apps are left alone and only missing apps are launched. |
launch_workspace
Launch a saved workspace: opens every app that is not running, waits for its windows, and moves them into the saved positions. Each window returns to the monitor it was captured on, so a workspace spanning several displays comes back spanning them. macOS cannot open an app straight into a position, so windows appear first and jump into place. Returns per-app success, and reports apps that never opened a window. Takes up to a minute for a large workspace.
| Parameter | Type | Description |
|---|---|---|
name * | string | |
screen | integer | Pull the whole workspace onto this monitor instead of the ones it was captured on. Use when a display is no longer attached, or to move a setup to another screen. |
delete_workspace
Delete a saved workspace by name. Use this to clean up workspaces you created that are no longer wanted.
| Parameter | Type | Description |
|---|---|---|
name * | string |
apply_layout
Move and resize windows to build a layout. Each item places one window: 'app' is the app name (fuzzy matched), optional 'title' filters windows of that app by title substring, optional 'screen' is the monitor index from get_state (each monitor can get its own layout — just send items with different 'screen' values; defaults to the screen the window is currently on), 'frame' is {x,y,w,h} as fractions 0..1 of that screen's visible area with origin at TOP-LEFT (left half = {x:0,y:0,w:0.5,h:1}; bottom-right quarter = {x:0.5,y:0.5,w:0.5,h:0.5}; centered 60% = {x:0.2,y:0.15,w:0.6,h:0.7}). Windows…
| Parameter | Type | Description |
|---|---|---|
items * | array |
save_layout
Save the named window arrangement as a workspace. Legacy name kept for older clients — new integrations should call save_workspace, which can also record whether running apps get moved into place. Omit 'items' to snapshot the windows exactly as they are on screen right now; pass 'items' to describe the arrangement explicitly. Saving over an existing name replaces it. Saved workspaces are listed in get_state, with their full contents.
| Parameter | Type | Description |
|---|---|---|
name * | string | Workspace name, e.g. 'work', 'focus' |
items | array |
apply_saved_layout
Launch a saved workspace by name. Legacy name kept for older clients — new integrations should call launch_workspace, which adds a 'screen' option to pull the whole workspace onto one monitor. Opens every app that is not running, waits for its windows, and moves them into the saved positions; macOS cannot open an app straight into a position, so windows appear first and jump into place. Returns per-app success and reports apps that never opened a window. Takes up to a minute for a large workspace.
| Parameter | Type | Description |
|---|---|---|
name * | string |
snap_window
Drop one window into a zone of the snap-zone set assigned to that monitor, by number or by name. The numbers are the ones Plonk draws on the zones while a window is dragged, so 'the middle zone' of a three-zone set is 2; a name is whatever the set calls a zone ('chat'), listed per zone in get_state.zone_sets, matched ignoring case. Fails with the zones that screen does have, names included, when neither matches. Zone sets and their per-monitor assignment are in get_state; use apply_layout instead when the user describes a size rather than a zone.
| Parameter | Type | Description |
|---|---|---|
app * | string | App name to match, e.g. 'Visual Studio Code' |
zone * | 1-based zone number as shown on the drag overlay, or the zone's name from get_state.zone_sets | |
screen | integer | Monitor index; defaults to the one the window is on |
title | string | Only windows whose title contains this substring |
delete_layout
Delete the saved workspace with that name, whether it was saved with save_layout or save_workspace. Legacy name kept for older clients — new integrations should call delete_workspace, which does the same. Use it to clean up saved workspaces that are no longer wanted; existing names are listed in get_state.
| Parameter | Type | Description |
|---|---|---|
name * | string |
save_zone_set
Create or replace a named zone set used for drag snapping. Zones are rectangles {x,y,w,h} as fractions 0..1 of a screen's visible area, origin TOP-LEFT; each zone must stay inside the screen, but zones may overlap each other (the smallest one under the cursor wins). A zone may also carry a 'name' ('chat', 'editor'): it is drawn under the zone's number, the user can say it out loud, and snap_window takes it instead of the number; names must be unique within the set, ignoring case, and cannot be a bare number. Pass 'screen' to also assign the set to that monitor so it becomes active immediately.…
| Parameter | Type | Description |
|---|---|---|
name * | string | Zone set name, e.g. 'coding' |
zones * | array | |
gap | This set's own gap in points; null follows the default gap (get_state.zone_gap); omit to leave unchanged | |
screen | integer | Monitor index to assign this set to (0 = primary) |
assign_zone_set
Assign a zone set (built-in or saved) to one monitor, so dragging a window there snaps to that set's zones. Each monitor keeps its own assignment; assigning replaces whatever that monitor used before and takes effect on the next drag. Omit 'name' to restore the default set (Halves); pass 'edge' for plain edge snapping instead of zones. Available set names and current per-monitor assignments are in get_state.
| Parameter | Type | Description |
|---|---|---|
screen * | integer | Monitor index (0 = primary) |
name | string | Zone set name, or 'edge' for edge snapping; omit for the default set |
delete_zone_set
Delete a saved zone set by name. Any monitor currently using it falls back to the default set (Halves), so snapping keeps working. Only sets made with save_zone_set can go: the built-ins (Halves, Thirds, 60 / 40, Quarters, Priority) are refused. Deleting is immediate and cannot be undone — the zones would have to be described again. Saved sets and their per-monitor assignments are listed in get_state; use assign_zone_set instead when a monitor should merely stop using a set that others still need.
| Parameter | Type | Description |
|---|---|---|
name * | string | Saved zone set name, as shown in get_state |
set_app_rule
Make an app's windows open into a numbered zone from now on, so an arrangement holds without anyone dragging: 'Slack always in zone 1 on the second monitor'. 'app' is matched anywhere in the app's name or bundle id, case-insensitively, the way get_state.excluded_apps entries are; a bundle id such as 'com.tinyspeck.slackmacgap' is the safest form. 'zone' is the number Plonk draws on the zone (1-based) in the set assigned to that monitor. 'screen' is a monitor index from get_state and is stored as that display's identity, so it survives a reboot renumbering the screens; omit it and the window st…
| Parameter | Type | Description |
|---|---|---|
app * | string | App name or bundle id to match, e.g. 'com.apple.Safari' or 'Safari' |
zone * | integer | 1-based zone number, as shown on the drag overlay |
screen | integer | Monitor index from get_state (0 = primary); omit for the screen the window opens on |
clear_app_rule
Remove the rule set for an app with set_app_rule, so its new windows open wherever the app puts them again, or where its last window went when that habit is switched on in Plonk. 'app' is the pattern exactly as get_state.app_rules lists it, ignoring case. Fails when no rule matches; nothing else changes.
| Parameter | Type | Description |
|---|---|---|
app * | string | The app pattern as listed in get_state.app_rules |
set_awake
Keep the Mac from sleeping, and optionally keep the user shown as available in chat apps. One session with two levels, called Pulse in the app. 'available' picks the level. Left off, Plonk holds a power assertion: the Mac does not sleep, but Slack and Teams still slide the user to Away, because those read the system idle timer and an assertion does not touch it. Turned on, Plonk also resets that idle timer with a Shift keypress every two minutes, which is what keeps a chat status green — and which postpones sleep by itself, so being available always includes being awake. Use it whenever the…
| Parameter | Type | Description |
|---|---|---|
on * | boolean | |
available | boolean | Also reset the idle timer, so chat apps go on showing the user as available instead of Away. This is the user's stored level rather than a property of one session: later sessions run at it too, until… |
minutes | integer | End the session after this many minutes |
pid | integer | End when this process exits. Use the pid of the long job being waited on; get_state lists a pid for every open window |
until | string | End at a time of day, e.g. '17:00' (the next such moment — tomorrow if today's has passed), or an ISO-8601 timestamp like '2026-08-08T17:00:00Z' |
take_screenshot
Capture the screen and return the image so it can be looked at. mode 'screen' captures everything (no user interaction); mode 'app' captures one named window and needs no user interaction either — pass 'app' and/or 'title_contains', and it works even when that window is behind others, minimized excepted, without raising it or taking focus; 'region' and 'window' hand the user the native crosshair/window picker and wait for them. Prefer 'app' whenever the user asks about a particular program ("what is playing in Spotify", "read the error in Xcode") — it is the only mode that can see a window…
| Parameter | Type | Description |
|---|---|---|
annotate | boolean | Open the annotation editor instead of returning the image |
app | string | mode 'app': app name or bundle id, case-insensitive substring (e.g. 'Spotify') |
clipboard | boolean | Also copy the capture to the clipboard |
include_image | boolean | Return the image content itself, so it can be inspected (default true) |
mode | string | |
path | string | Explicit output file path (.png) |
title_contains | string | mode 'app': narrows to a window whose title contains this, for an app with several |
annotate_screenshot
Draw on a screenshot you already took, then copy it to the clipboard and show it to the user. Call take_screenshot first and LOOK at the image: you cannot know where anything is until you have seen it. Points are fractions 0..1 of the image, origin TOP-LEFT, so a rectangle around a left sidebar that is a seventh of the width and starts under the title bar is [{x:0,y:0.05},{x:0.14,y:1}]. Rectangle and ellipse take two opposite corners, arrow takes start then tip, pen and highlight take a run of points. Returns the marked image so you can check what you drew.
| Parameter | Type | Description |
|---|---|---|
marks * | array | |
path * | string | Path returned by take_screenshot |
clipboard | boolean | Copy the result to the clipboard (default true) |
output | string | Where to write it; defaults to the source name plus ' marked' |
extract_text
Read the words off the screen, or off a saved image, and return them as text. Recognition runs on the Mac itself and nothing is uploaded. Prefer this over take_screenshot whenever the answer is words rather than a picture — an error dialog, a log, a terminal, a table, text baked into an image or a paused video, a PDF page in a viewer that will not let text be selected. It costs a fraction of the tokens an image does and does not depend on reading pixels correctly. Use take_screenshot instead when layout, colour or 'what does this look like' is the question. mode 'screen' captures everything…
| Parameter | Type | Description |
|---|---|---|
clipboard | boolean | Copy the recognized text to the clipboard (default true) |
languages | array | BCP-47 tags to recognize, most likely first, e.g. ['uk-UA','en-US']. Omit to use the user's configured choice. Which are available depends on the macOS version; get_state lists the current setting und… |
mode | string | What to capture; ignored when 'path' is given |
path | string | Read this image file instead of capturing (.png, .jpg) |
measure_screen
Measure the screen in points and pixels, without taking a picture of it. Plonk photographs the screen once and walks out from the given point in all four directions until one pixel is unlike the one before it, which is where an edge is. What comes back is how far the point could travel each way: the run across and the run down. Prefer this over take_screenshot whenever the answer is a number: how wide that sidebar is, how tall that row is, how big the gap between two things is, is that tap target 44 points. An image costs far more tokens and still has to be eyeballed. Use extract_text when the…
| Parameter | Type | Description |
|---|---|---|
from | object | One end of a distance, in the same fractions as 'point' |
interactive | boolean | Hand the user the ruler instead of measuring a given point: they hover, drag, click to copy and press Escape, and the last measurement comes back. The one to use when it is their screen and their judg… |
point | object | Where to measure from, as fractions 0..1 of the screen's visible area, origin TOP-LEFT. {x:0.5,y:0.5} is the middle of the screen |
screen | integer | Monitor index from get_state (0 = primary, the default). Every point is a fraction of this screen |
to | object | The other end of a distance, in the same fractions as 'point' |
tolerance | integer | How different one pixel must be from the pixel beside it, on a scale of 255, to count as an edge. Omit to use the user's setting (10 by default). Lower stops at fainter borders and finds smaller thing… |
select_agent
Make an agent the user's active one in Plonk. Omit 'name' to select this client itself; pass "" to clear the choice so any agent may drive. The active agent shows in Plonk's menu bar and settings, and is where voice and other outgoing requests will go. With 'exclusive' true the app also rejects window and settings changes from every other agent (they can still read state and take screenshots). Connected agents are listed in get_state under 'agents'.
| Parameter | Type | Description |
|---|---|---|
exclusive | boolean | Also turn 'only the active agent controls' on or off |
name | string | Agent name from get_state's 'agents'; omit for this client, "" to clear |
check_for_update
Ask Plonk whether a newer release exists, and report what is installed. Use this when the user asks what version they run, whether Plonk is up to date, or before calling install_update — which refuses unless a newer release is already on offer. The check is a network round trip to the GitHub releases API, so this returns immediately with the state as it stands and the result lands a moment later: read it back from get_state's 'update' key, or wait for an 'update' event on the change stream. If the user has turned update checks off, this fails with 409 rather than dialling out on their behalf…
install_update
Install the release that check_for_update found: Plonk downloads the build, checks it is signed with the same certificate as the running copy, swaps the bundle in, and relaunches itself. Prefer this over telling the user to download a build by hand — the signature check is also what preserves their Accessibility and Screen Recording grants, which a hand-installed copy can lose. Ask the user before calling it: it quits the app, so any window arrangement in flight stops and the local API is unreachable for a few seconds until the new copy is up. It fails without touching the installed copy whe…