calculate_rectangle_yardage
Repeated rectangular cut pieces
- Mode
yardage- Result surface
ui://clothcount/rectangle.html
Technical reference
The MCP source exposes the same deterministic calculation functions as the website, with explicit measurements, fabric roles and purchase rounding.
Eleven tools cover the website’s calculator modes. Known-length conversion and rectangle reference export bring the total to thirteen.
calculate_rectangle_yardageRepeated rectangular cut pieces
yardageui://clothcount/rectangle.htmlexport_rectangle_reference_sheetRectangle reference text and standalone HTML
exportui://clothcount/rectangle.htmlcalculate_quilt_backingQuilt backing plan
backingui://clothcount/plan.htmlcalculate_quilt_bindingQuilt binding plan
bindingui://clothcount/plan.htmlcalculate_quilt_bordersQuilt border plan
bordersui://clothcount/plan.htmlcalculate_half_square_trianglesHalf-square triangle plan
hstui://clothcount/plan.htmlcalculate_batting_fitBatting size and fit
battingui://clothcount/plan.htmlcalculate_precut_yieldPrecut uniform-grid yield
precutui://clothcount/plan.htmlcalculate_quilt_block_gridBlock grid to quilt size
gridui://clothcount/plan.htmlcalculate_quilt_target_gridsTarget to whole-block grids
targetui://clothcount/plan.htmlcalculate_flying_geeseFour-at-a-time flying geese
geeseui://clothcount/plan.htmlcalculate_hourglassTwo-color hourglass plan
hourglassui://clothcount/plan.htmlconvert_known_lengthConvert a known length
conversionui://clothcount/rectangle.html
Used by rectangle yardage calculation and rectangle reference export.
ui://clothcount/plan.html
Used by the ten other geometry tools, with the website’s original construction diagrams.
Visual tools advertise _meta.ui.resourceUri. Their responses also include text and strict structuredContent, so the numerical plan and its assumptions can be consumed independently of the visual surface. Known-length conversion uses text and structured data.
Use Node 24 and the project lockfile. Run these commands from the ClothCount source directory:
npm ci
npm run build:mcp-ui
node --experimental-strip-types mcp/stdio.tsThe UI build produces self-contained public/mcp-ui/rectangle.html and public/mcp-ui/plan.html resources. The stdio entrypoint reads those files when a client requests a resource.
For an MCP client that launches local processes, use its command/arguments configuration and replace the example paths with your source checkout’s absolute path:
{
"command": "node",
"args": [
"--experimental-strip-types",
"/absolute/path/to/clothcount/mcp/stdio.ts"
],
"cwd": "/absolute/path/to/clothcount"
}Keep stdout for MCP protocol traffic and diagnostics on stderr. The source server identifies itself as clothcount-preview, version 0.3.0.
The installed SDK supports 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05, 2024-10-07. During initialize, the server accepts a requested version from that list; otherwise it responds with the SDK’s latest supported version, 2025-11-25. The client completes negotiation against the returned version.
mcp/stdio.ts connects the full catalog to the SDK’s StdioServerTransport. The process communicates over standard input and output.
mcp/http.ts provides a local POST /mcp implementation bound to 127.0.0.1:4330 when started. mcp/fetch.ts provides the Fetch adapter for an integration’s configured exact HTTPS origins. mcp/cloudflare-entry.ts embeds the two UI artifacts for that runtime.
Both HTTP paths use stateless JSON responses, with a new server/transport per request, no session IDs and no GET/SSE stream. Requests use uncompressed application/json; the adapters bound requests to 64 KiB and eight concurrent operations. The Fetch adapter accepts a single MCP message per request and checks the configured authority and Origin.
The commands and paths here describe the source interfaces and local process setup.
Geometry tool inputs use numeric physical measurements with an explicit unit of in or cm. Convert typed fractions to numbers before a tool call. Counts remain whole counts; purchase increments remain yards: 0.125, 0.25, 0.5 or 1. Supply the settings relevant to the selected mode, including allowances, direction and rotation permission.
{
"name": "calculate_rectangle_yardage",
"arguments": {
"unit": "in",
"pieceWidth": 8.5,
"pieceHeight": 10.5,
"count": 20,
"usable": 42,
"extra": 0,
"rotation": false,
"rounding": 0.125
}
}This input requires 20 cut pieces of 8.5 × 10.5 in from 42 in usable width. With rotation off and no extra bolt length, the plan has four pieces across and five rows: 52.5 in required, rounded to 1.5 yd / 54 in to buy.
The shared engine uses its existing scale-aware boundary tolerance. Permitted rotation compares two uniform orientations; it does not mix orientations or repack offcuts. Cut dimensions already contain the user’s seam allowances.
Geometry contracts preserve original inputs, normalized inches, cuts, assumptions, supported alternatives, separate fabric purchases and any qualified next-stage size. New geometry envelopes use schemaVersion: "1.0"; the original rectangle calculation and export keep their rectangle-specific 1.0 schemas. The known-length converter accepts decimal or simple/mixed-fraction raw text for in, ft, yd, mm, cm and m, and keeps optional buy-up separate.
Unknown or inactive fields are rejected. Handle both SDK input-schema rejection and a tool response with isError: true; neither provides a successful plan to reuse. Successful rectangle export recomputes its validated inputs and returns plain text plus escaped standalone HTML reference content.
Tools advertise read-only, non-destructive, idempotent, closed-world behavior. They calculate and return content; they do not buy fabric, save files or send messages.
Explore example result surfaces in the illustrative developer preview. For project preparation and copyable prompts, return to Use ClothCount with AI.