pensketch

v0.13.0
io.github.alpha-nu/pensketch Checked 1 hour ago Published 2 months ago

An MCP server for pensketch: check, render and rasterise hand-sketched diagrams.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

check_diagram Check a diagram for layout defects

Reports what neither the types nor the schema can see: overlapping boxes, a label a connector will be drawn through, text too wide for its box, a node half out of its lane, a node no edge names, a depth the renderer would refuse. Draws nothing. Every coordinate is yours: pensketch performs no layout and routes no edges. Text is never measured, so a box does not grow to fit its label. It takes extrude and depth, where it refuses hops: hops change no finding - though where a hop breaks the very line a `label-collision` names, the finding stands and the sentence naming that edge does not - and de…

ParameterTypeDescription
diagram *objectA diagram: nodes, edges, braces and notes as plain data. Read the pensketch://schema resource - or call the get_schema tool, the same document - for every field. The whole diagram is validated against…
anchorsbooleanAppend the resolved end points of every edge to the report, one line each: the two points its drawn line actually begins and ends at - a side fraction walked, an extruded anchor carried onto the silho…
depthnumberHow deep a slab is drawn, in px, for every node without a `depth` of its own. Default 12, calibrated on a box; a pill wants about a third of its height, and a diamond reads as a folded corner at every…
extrudebooleanDraw every node as a slab: its outline redrawn offset up and to the right and joined to it. A node's own `extrude` wins over this either way, so an extruded diagram can flatten one node and a flat one…
viewBoxarray[minX, minY, width, height], the four numbers the <svg> carries. Without it the out-of-bounds rule cannot run and does not.

render_diagram Render a diagram to SVG

Returns SVG markup for a diagram, and beside it the layout findings for the drawing it just made: overlapping boxes, text too wide for its box, a node out of frame. Two content blocks: the markup alone, then the findings - when saving to a file, write the first block only, because anything appended after </svg> makes the file invalid. Deterministic: the same diagram and seed produce the same bytes. Every coordinate is yours: pensketch performs no layout and routes no edges. Text is never measured, so a box does not grow to fit its label. The markup names the handwriting font stack, so a browse…

ParameterTypeDescription
diagram *objectA diagram: nodes, edges, braces and notes as plain data. Read the pensketch://schema resource - or call the get_schema tool, the same document - for every field. The whole diagram is validated against…
viewBox *array[minX, minY, width, height], the four numbers the <svg> carries.
animatebooleanReturn an <svg> that draws itself, stroke by stroke, in the order a hand would have drawn it: each region first, each shape with its own label, then the connectors, then the annotations. It carries it…
depthnumberHow deep a slab is drawn, in px, for every node without a `depth` of its own. Default 12, calibrated on a box; a pill wants about a third of its height, and a diamond reads as a folded corner at every…
durationnumberHow long the whole drawing takes, first stroke to last, in ms. Requires animate. Default: scaled to the drawing at 70 ms per stroke, clamped to [2000, 6000] - a six-stroke sketch and a six-hundred-str…
easingstringThe CSS easing every stroke takes, as an <easing-function>. Requires animate. Default ease-out.
extrudebooleanDraw every node as a slab: its outline redrawn offset up and to the right and joined to it. A node's own `extrude` wins over this either way, so an extruded diagram can flatten one node and a flat one…
hopsbooleanDraw every connector as going over the ones it crosses, breaking the line underneath where they meet. An edge's own `hop` wins over this either way. Default false.
labelstringAn accessible name, set as aria-label on the <svg>.
seedintegerPicks which drawing of the same data you get. Default 1.
sequencestringWhich order the drawing draws itself in. 'hand', the default, is the order a hand would lay the picture down: each region, each shape with its label, then the connectors, then the annotations. 'flow'…
strokenumberHow long the longest single stroke takes to draw, in ms; shorter strokes take proportionally less, floored at a tenth of this. Requires animate. Default 500.

get_schema The JSON Schema for a diagram

Returns the JSON Schema for the diagram the drawing tools take: every field of a node, an edge, a brace and a note, with what each means. The same document as the pensketch://schema resource, as a tool, for clients that cannot read resources. Call it once per session at most - it changes only when the server version does; this build is @pensketch/mcp 0.13.0. Every mismatch is also reported field by field when a diagram is refused.

render_png Render a diagram to a PNG you can look at

Rasterizes a diagram so it can be displayed. The PNG draws text in a stand-in font, not the handwriting stack the SVG names, so it is authoritative about structure and not about fit; use check_diagram for fit. Every coordinate is yours: pensketch performs no layout and routes no edges. Scale is capped at 4, and an oversized request is refused rather than served.

ParameterTypeDescription
diagram *objectA diagram: nodes, edges, braces and notes as plain data. Read the pensketch://schema resource - or call the get_schema tool, the same document - for every field. The whole diagram is validated against…
viewBox *array[minX, minY, width, height], the four numbers the <svg> carries.
depthnumberHow deep a slab is drawn, in px, for every node without a `depth` of its own. Default 12, calibrated on a box; a pill wants about a third of its height, and a diamond reads as a folded corner at every…
extrudebooleanDraw every node as a slab: its outline redrawn offset up and to the right and joined to it. A node's own `extrude` wins over this either way, so an extruded diagram can flatten one node and a flat one…
hopsbooleanDraw every connector as going over the ones it crosses, breaking the line underneath where they meet. An edge's own `hop` wins over this either way. Default false.
scalenumber1 to 4. Default 2, for a legible image.
seedinteger