API & MCP
Everything a person can do on Path Boolean Operations (SVG), a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://threadsmithpathboolean.usefulweb.site/api/v1/calculate– run Path Boolean Operations (SVG)GET https://threadsmithpathboolean.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Path Boolean Operations (SVG)
Paste two SVG paths (the d attribute) and combine them like a vector editor's Path menu: union, intersection, difference or exclusion. With an empty second path, union removes overlaps and self-intersections. Curves are flattened within your tolerance, combined exactly as polygons and refitted to Bézier curves; the result is checked against both inputs on a grid of test points. Threadsmith uses the same engine for Object → Combine shapes.
| Field | Type | Default | Description |
|---|---|---|---|
pathA (required) | textarea | "M-10 0A10 10 0 1 0 10 0A10 10 0 1 0 -10 0Z" | Path A (SVG path data) |
pathB | textarea | — | Path B (SVG path data; empty = remove the overlaps of path A) |
op | select (union, intersect, difference, xor) | "union" | Operation |
fillA | select (nonzero, evenodd) | "nonzero" | Fill rule of path A |
fillB | select (nonzero, evenodd) | "nonzero" | Fill rule of path B |
tolerance | number | 0.05 | Curve tolerance (path units) |
refit | boolean | true | Refit Bézier curves to the result |
fitTolerance | number | 0.05 | Refit tolerance (path units) |
precision | integer | 3 | Decimals in the result |
Example request
Union of two overlapping circles
curl -X POST https://threadsmithpathboolean.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"pathA":"M-10 0A10 10 0 1 0 10 0A10 10 0 1 0 -10 0Z","pathB":"M0 0A10 10 0 1 0 20 0A10 10 0 1 0 0 0Z","op":"union","fillA":"nonzero","fillB":"nonzero","tolerance":0.01,"refit":true,"fitTolerance":0.01,"precision":3}'
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://threadsmithpathboolean.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
threadsmith_path_boolean - Local stdio connector:
node src/mcp-stdio.ts --tool=threadsmith-path-boolean
{
"mcpServers": {
"threadsmith-path-boolean": { "type": "http", "url": "https://threadsmithpathboolean.usefulweb.site/mcp" }
}
}