Skip to content

ToolBlock

ToolBlock = { text: string; tone?: Tone; type: "status"; } | { type: "text"; value: string; } | { language?: string; text: string; type: "code"; } | { rows: ToolTableRow[]; type: "table"; } | { paths: string[]; type: "files"; } | { path: string; type: "image"; } | { hex: string; type: "color"; } | { text: string; type: "heading"; } | { rows: object[]; type: "codeTable"; } | { ranges: object[]; text: string; type: "marked"; } | { detail?: string; text: string; type: "headline"; } | { background: string; foreground: string; type: "specimen"; }

A typed piece of output. The kit draws each kind the same way in every tool. Build them with status, text (the value helper doubles as the text block), code, table, files, image, and color.

{ text: string; tone?: Tone; type: "status"; }

A headline result: “200 OK · 84 ms”, “No package named “expresss””.


{ type: "text"; value: string; }

Plain text, selectable. The same shape as the text() value helper.


{ language?: string; text: string; type: "code"; }

Monospaced and copyable, with a language hint.


{ rows: ToolTableRow[]; type: "table"; }

Label/value rows.


{ paths: string[]; type: "files"; }

Files the tool produced (absolute paths): revealed in Finder or dragged out.


{ path: string; type: "image"; }

An image file to show (absolute path): a QR code, a preview.


{ hex: string; type: "color"; }

A color swatch: "#7C3AED".


{ text: string; type: "heading"; }

A small label naming the blocks below it (“Payload”, “Response headers”).


{ rows: object[]; type: "codeTable"; }

Label/value rows whose values are code: monospaced, whitespace kept, each copyable.


{ ranges: object[]; text: string; type: "marked"; }

Monospaced text with ranges marked (UTF-16 offsets, as JavaScript strings count).


{ detail?: string; text: string; type: "headline"; }

The one answer, large (“16:9”, “7.46 mi”), with a line of detail.


{ background: string; foreground: string; type: "specimen"; }

Sample text in foreground on background (hex colors): how a color pair reads.