Kalpana Docs
Designer MCP

Checks and helpers

Check a design, preview it, and compute numbers, text sizes, paths and positions instead of guessing.

check_layout

Layout problems after layout: text over other text, layers cut off by a clipping frame or running off the canvas, text too small for the size the design is seen at, and text with too little contrast on what is behind it.

ParameterTypeRequiredDefaultDescription
page_idstringYes—The page.
display_widthnumberNoSee noteHow wide the design is seen on screen, px; sets the smallest readable text and what counts as large text.
marginnumber | [l, t, r, b]No—Report layers whose painted extent, strokes included, crosses this content margin.
allow_bleedstring[]No—Layers (and their children) that run past the page or their clipping frame on purpose.
ignore[string, string][]No—Pairs of layer ids whose overlap is on purpose.
craftbooleanNofalseRun every craft check: orphan, near_touch, raw_hex, empty_frame, chrome_drift, sliver, empty_band (all info).
checksstring[]No—Craft checks to run, by name.
skipstring[]No—Issue kinds that are on purpose, left out of the report so ok can be true (empty_first_frame for a reveal at the end, small_text for a fine-print line).

display_width defaults to 400 for 1080-wide square or portrait posts, 1280 for 1920 × 1080, else the page width.

  • Returns: Each issue with the layers it names and a severity, error or info (info is often on purpose).

Text cut by max_lines is reported as truncated (info). Text that shrink_to_fit already fits is not reported as overflow. off_page and near_touch judge a cut-out by its visible box, not its whole image.

It reads laid-out boxes, not pixels, and does not find text too long for a fixed box: confirm issues with render_design, and test the longest copy by rendering it.


render_design

A PNG of the page as it will export, for the agent to look at.

ParameterTypeRequiredDefaultDescription
page_idstringYes—The page (or give page_ids).
page_idsstring[]No—Up to 5 pages to draw with the same settings, each labelled with its page. Each page is charged as its own render.
max_sizeintegerNo800Longest side in px, at most 800.
sizesinteger[]No—1 to 4 pictures in one call, each at most 800 px, in place of max_size.
node_idstringNo—Zoom into a layer: its laid-out box grown by padding.
paddingnumberNo24Space around node_id's box, in page px.
region[x, y, w, h]No—Zoom into this part of the page, in page px.
node_idsstring[]No—Zoom into several layers, one picture each, grown by padding.
regions[x, y, w, h][]No—Several close-ups in one call, in page px. With node_ids, at most 4 pictures, each max_size.
timenumberNo0The second of the animation to show.
hidestring[]No—Hide these layers for this picture only.
onlystring[]No—Show only these layers, with their children.
modesstring[]No—1 to 3 of "color", "grey" and "silhouette", one picture each, in place of mode.
modestringNo"color""color", "grey" for a value study, or "silhouette" to judge a shape (with only).
sample_points[x, y][]No—Up to 64 points, in page px, whose colour to read, returned as {x, y, hex, alpha}. Not together with regions or node_ids.
  • Returns: The PNG, with a faint repeating "Kalpana preview" mark that is never in the design, its exports or batch renders. sample_points read the design's own colours.

calculate

Exact arithmetic: + - * / % ^, parentheses, pi, trigonometry in radians (rad() and deg() convert), sqrt, abs, min, max, round, floor, ceil, clamp, lerp, pow, hypot, atan2, ln, log10, exp.

ParameterTypeRequiredDefaultDescription
expressionstringOne of these—One expression, e.g. "1080 / 3 - 24" or "sin(rad(30)) * r".
expressions{name, expression}[]One of these—Several named expressions; later ones may use earlier names.
variablesRecord<string, number>No{}Values for names used in the expressions.
seriesobjectNo—Evaluate expression over a range: variable, from, to and steps (values = steps + 1, at most 2000).

measure_text

The real size of text as the renderer lays it out, or the largest size that fits a box.

ParameterTypeRequiredDefaultDescription
textstringNo""The text to measure (or give texts or runs).
textsstring[]No—Measure many texts in one call, with the same font, size and width.
runstext run[]No—Text in differently styled runs, as create_layers takes them, in place of text.
font_family, font_stylestringNo—The font, e.g. "Bold" for the style.
font_sizenumberNo—Measure at this size, px.
widthnumberNoOne lineWrap within this width, px.
fit_heightnumberNo—Find the largest size in [min_size, max_size] whose text fits width × fit_height.
min_size, max_sizenumberNo—The range fit_height searches.
line_height, letter_spacingnumber | stringNo—As create_layers takes them.
wrapstringNo—"normal", "balance" or "pretty".
min_last_line_wordsintegerNo—Fewest words a wrapped paragraph may end on.
page_id, layer_idstringNo—Measure a text layer of a page as it is set; font_size and width then try other values.
packobjectNo—With texts: lay them out as chips in rows with no overlaps. x, y, width (required), gap ([16, 16]), padding ([24, 12]), align (left, center, right).
  • Returns: Each line and its width, the height, and whether the last line is a widow; with fit_height, the size that fits; with pack, each chip's box ready for create_layers.

shape_path

Exact SVG path data for a shape, with the box it sits in. Angles are degrees, 0 at twelve o'clock, clockwise.

kindFieldsGives
arcradius, start, endAn open arc for a stroke, such as a gauge track.
sectorradius, start, end, inner_radius (0)A filled wedge; with inner_radius, a ring segment.
ringradius, inner_radiusA circle with a hole.
polygonsides, radius, corner (0)A regular polygon with rounded corners.
starpoints, radius, inner_ratio (0.5), corner (0)A star.
spiralradius, turns (3)An Archimedean spiral.
wavewidth, amplitude, wavelength, form (sine, zigzag, square)A wave across width.
gearteeth, radius, depthA cog.
arrowfrom, to, bend (0), head (12)An arrow between two points; the result says where to place it.
blobradius, points (6), wobble (0.3), seed (0)An organic blob; the same seed gives the same blob.
text_arcradius, position (top or bottom), sweep (180)An arc for text_path: curved badge text, upright at the top or bottom of a circle. sweep is its angle in degrees, above 0 and at most 360. Text on the bottom arc stands inside it.
burstradius, points, inner_ratio, jitter (0 to 1), seed (0), aspect (1)A sale-badge burst of jagged spikes; the same seed gives the same burst.
pointspoints ([x, y][]), smooth, closedA line through your points.
functionexpression (in x), x_from, x_to, width, height, samples (200), y_min, y_maxThe graph of y = f(x), scaled into the box.
outlinepaths, width, join, capThe filled outline of a stroke along paths.
combinepaths, op (union, intersect, subtract, exclude)Paths combined in order.
gapa, b (path data lists)The smallest gap between two shapes; 0 when they overlap.
layer_gappage_id, a, b (layer ids)The smallest gap between two placed layers.
  • Returns: paths, width and height for a vector layer in create_layers.

place_items

Where to put N items, with each centre, the top-left for an item of item_size, and the rotation that faces along the layout. Free.

ParameterTypeRequiredDefaultDescription
countintegerYes—How many places.
layoutobjectYes—The layout, by kind: circle (center, radius, start 0 = top), arc (center, radius, start, end), grid (origin, columns, cell, gap), line (from, to) or path (points, closed).
item_size[w, h]No—The items' size, to also get each top-left x/y.
Was this page helpful?

Updated 5 Nov 2026

On this page