API & MCP
Everything a person can do on Threadsmith Marker Layout, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://threadsmithmarkerlayout.usefulweb.site/api/v1/calculate– run Threadsmith Marker LayoutGET https://threadsmithmarkerlayout.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Threadsmith Marker Layout
Places pattern pieces on a fabric of the width you have, as tightly as a deterministic bottom-left fill can: every piece keeps its grainline along the selvage (turned 180° when allowed, 90° only for cross-grain cutting, never for napped or one-way fabric), pairs get a mirrored copy, and pieces cut on the fold are unfolded on open fabric or put against the fold of folded fabric. You get the marker length — how much fabric to buy — the efficiency (piece area ÷ fabric area), the lower bound, the position and turn of every piece, a picture of the layout and an SVG or DXF of the marker. Pieces come from a JSON list or are drafted on the spot from bust, waist and hip.
| Field | Type | Default | Description |
|---|---|---|---|
source | select (pieces, blocks) | "pieces" | Pieces from |
units | select (cm, in) | "cm" | Units of all lengths |
pieces | textarea | — | Pieces (JSON). Array of {name, polygon: [[x, y], …] or path: "M … Z", grain (degrees, 90 = along +y), quantity, pair (true = half mirrored), fold: [[x1, y1], [x2, y2]]}. The whole result of threadsmith-pattern-block ({"pieces": […]}, in mm) is accepted too. |
blocks | multiselect (skirt, bodice, sleeve, trousers) | ["skirt"] | Blocks (when drafting) |
bust | number | — | Bust / chest girth (when drafting) |
waist | number | — | Waist girth (when drafting) |
hip | number | — | Hip girth (when drafting) |
seamAllowance | number | — | Seam allowance (when drafting). Empty = 1.5 cm or 5/8 in. |
hemAllowance | number | — | Hem allowance (when drafting). Empty = 4 cm or 1 1/2 in. |
fabricWidth | number | — | Usable fabric width. Selvage to selvage minus edges you cannot use. Empty = 140 cm or 54 in. |
mode | select (open, folded) | "open" | Fabric |
crossGrain | boolean | false | Allow cross-grain (90°) placement |
napped | boolean | false | Napped or one-way fabric (no 180° turns) |
gap | number | — | Gap between pieces. Empty = 0. |
resolution | select (2, 5, 10) | "5" | Layout raster |
output | select (svg, dxf) | "svg" | File |
Example request
Known optimum: four 50 × 25 cm rectangles on 100 cm fill it completely
curl -X POST https://threadsmithmarkerlayout.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"source":"pieces","units":"cm","pieces":"[{\"name\":\"Panel\",\"polygon\":[[0,0],[50,0],[50,25],[0,25]],\"grain\":0,\"quantity\":4}]","fabricWidth":100}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://threadsmithmarkerlayout.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
threadsmith_marker_layout - Local stdio connector:
node src/mcp-stdio.ts --tool=threadsmith-marker-layout
{
"mcpServers": {
"threadsmith-marker-layout": { "type": "http", "url": "https://threadsmithmarkerlayout.usefulweb.site/mcp" }
}
}