# Jig > A knitting pattern workbench where a designer and an AI agent edit the same document > through one gate. Every write is checked against stitch repeats, whole increase rounds, > whole rows and monotonic grading, and an invalid write is refused with the rule it broke > and the nearest values that do fit. The tools are registered in the page with WebMCP, so > an agent calls named functions rather than guessing at the DOM. Last reviewed: 2026-09-01. Source: https://github.com/EmadQureshiKhi/jig (MIT). ## Why this file exists WebMCP tools only exist while a tab is open, which means an agent has to already be here to discover them. This file is how it can learn what the page is for before it arrives. It is a convention rather than a standard, and it is worth writing because it is the one place we get to state the summary rather than hope a good one is inferred from markup. ## What the product is Grading is resizing one sample garment across nine to thirteen sizes while every number stays mutually constrained. The arithmetic is simple to state and unforgiving: - Cast on is bust width times stitch gauge, rounded to a multiple of the stitch repeat. - A raglan yoke can only reach a target stitch count in whole increase rounds of eight. - Shaping has to land on whole rows. - Armhole depth, cross back and neck drop have to grow as the sizes grow. Break any one and the pattern reads fine and cannot be knitted. Language models are fluent about knitting and unreliable about this arithmetic, which is the gap the product sits in. So the page does not ask an agent to be careful. It refuses the write and says why. ## The worked example, which is the whole claim Ask for a cast on of 87 stitches on a cable panel of 12 stitches per repeat plus 2 edge stitches. It is unreachable, because 12k plus 2 gives 86 and then 98. The document refuses and names both counts. Send 86 back and it commits. Identical whether a person types it or an agent calls `edit_number`. ## The tools registered in the page On `document.modelContext`, while the tab is open. Read only tools are marked. - `read_pattern` (read only): gauge, measurements, counts, rows and shaping, for one size or all. - `read_chart` (read only): a charted panel as a grid, or linearised row by row in words. - `audit_pattern` (read only): every contradiction in the pattern, with the rule for each. - `export_pattern` (read only): the finished pattern. Not offered at all while the audit finds anything. - `set_gauge`: set stitch and row gauge from a measured swatch, recomputing every count. - `grade_sizes`: grade the run from a sample size across a range of bust measurements. - `edit_number`: change one number on one size. - `substitute_yarn`: swap the yarn and recount whole skeins, reaching the yarn origin below. - `check_panel_fit`, `set_chart_cell`: offered only while a chart panel is selected, withdrawn when it is deselected. - `fit_published_pattern`: offered to the yarn origin rather than to an agent on this page. Every tool declares `readOnlyHint` derived from whether it writes, so the hint cannot disagree with the behaviour. Anything whose output can carry text from another origin declares `untrustedContentHint`. ## Two origins Yarn data comes from a separate service, https://jig-yarn-service.pages.dev, embedded in an iframe carrying `allow="tools"` and reached with `getTools({ fromOrigins })`. It registers three read only tools of its own. Community notes crossing that boundary are held as untrusted text: one is a prompt injection sample committed deliberately, and the workbench displays it, refuses to act on it, and records the refusal in the transcript. ## Browser support, honestly WebMCP is behind `chrome://flags/#enable-webmcp-testing` and no browser has it on by default. Where the browser has no host, the page installs one with the same surface so the tools still work and the page says which host you have. The browser's own host lists ten tools; the stand in lists nine, because the tenth is derived by the browser from an annotated HTML form and a page cannot honestly fake that. ## Elsewhere - https://jig-workbench.pages.dev/.well-known/mcp.json: the same tool list, machine readable - https://jig-yarn-service.pages.dev/: the yarn service - https://github.com/EmadQureshiKhi/jig: source, tests and the written record of what was measured