API

Manifest & result types

The metadata the hub stores for each widget, how icons work, and the formal shapes MCP tools return.

Every widget has a manifest — the metadata the hub stores alongside its HTML. You don’t write it directly; the hub builds it when you publish. But knowing the fields helps when you list widgets or debug versioning.

Manifest fields

FieldTypeMeaning
idstringStable widget id (returned by publish_widget).
namestringHuman-readable name (switcher + Mac list).
refreshMsintNative poll interval for this widget’s feed.
htmlHashstringSHA-256 (hex) of the HTML, for integrity.
versionintBumped on every update so the phone knows to refetch.
publishedAtdouble?First-published time (Unix seconds). Optional.
iconWidgetIcon?Switcher / Mac list / Lock Screen icon. Optional.
builtInSlugstring?If installed from a shipped template, its stable slug (e.g. "soundbar"). nil for custom widgets.
builtInVersionint?The built-in template version it was installed from.
templateHashstring?SHA-256 of the pristine shipped template it last installed (built-ins only). htmlHash != templateHash means the widget was customized since; the Mac offers an update whenever the shipped template’s hash differs from this.

list_widgets returns an array of these plus the activeWidgetId.

Icons

A WidgetIcon has a kind and a value:

{ "kind": "sfSymbol", "value": "thermometer" }
{ "kind": "emoji",    "value": "🎵" }
{ "kind": "png",      "value": "<base64-encoded PNG bytes>" }
KindvalueNotes
sfSymbolSF Symbol nameBest default — crisp, tint-safe, desaturates cleanly on the Lock Screen.
emojione emojiColorful in-app; flattens to a tinted silhouette on the Lock Screen.
pngbase64 PNG on input~256px, transparent background, monochrome silhouette, ≤256 KiB.

For a png, the hub stores the bytes, computes their SHA-256, and rewrites value to that hash (a cache key); the raw bytes are served at GET /widget/:id/icon. So a manifest you read back will show the hash, not the base64 you sent.

Set or change an icon without touching the HTML via set_widget_icon:

{ "id": "wgt_abc123", "icon": { "kind": "sfSymbol", "value": "thermometer.sun" } }

Formal shapes

The typed shapes behind the tables above, plus the values MCP tools return.

WidgetManifest

interface WidgetManifest {
  id: string;
  name: string;
  refreshMs: number;
  htmlHash: string;        // SHA-256 (hex) of the HTML
  version: number;
  publishedAt?: number;    // Unix seconds
  icon?: WidgetIcon;
  builtInSlug?: string;    // set if installed from a shipped template
  builtInVersion?: number;
  templateHash?: string;   // SHA-256 of the pristine template last installed
}

WidgetIcon

interface WidgetIcon {
  kind: "sfSymbol" | "emoji" | "png";
  // sfSymbol: symbol name · emoji: the character ·
  // png: base64 PNG on input, rewritten to the bytes' SHA-256 once stored
  value: string;
}

WidgetVersion

One entry in a widget’s bounded code history. list_versions returns these newest-first; set_widget_version selects one as the live version (no new entry is appended — isCurrent moves to it and history stays intact).

interface WidgetVersion {
  version: number;
  htmlHash: string;        // SHA-256 (hex) of that snapshot's HTML
  updatedAt: number;       // Unix seconds
  note?: string;
  isCurrent: boolean;      // the version currently live (selection moves this)
  builtInVersion?: number; // set when this cut is a pristine copy of a shipped
                           // built-in template (labels stock cuts vs your edits)
}
interface ListVersionsResult { versions: WidgetVersion[]; }

MCP tool results

// pair_status
interface PairStatus { paired: boolean; connected: boolean; deviceName?: string; }

// publish_widget
interface PublishWidgetResult { id: string; }

// list_widgets
interface ListWidgetsResult { widgets: WidgetManifest[]; activeWidgetId?: string; }

// list_versions → ListVersionsResult (see WidgetVersion above)

// get_data_endpoint
interface DataEndpoint { url: string; token: string; }

Tool arguments at a glance

ToolRequiredOptional
publish_widgetname, htmlrefreshMs, icon, actions
update_widgetid, htmlicon, refreshMs, note
set_widget_iconid, icon
set_active_widgetid
delete_widgetid
list_versionsid
set_widget_versionid, version
push_dataid, data
get_data_endpointid
register_actionwidgetId, actionId, capabilitydescription, argKeys, requiresConfirmation