diff --git a/mcp-server/README.md b/mcp-server/README.md index 2fa4f5c..30d131a 100644 --- a/mcp-server/README.md +++ b/mcp-server/README.md @@ -138,3 +138,39 @@ npm start # With a pre-loaded flow file npm start -- --file path/to/flow.drawd ``` + +### Validation + +#### `validate_html` + +Validate HTML/CSS against Satori rendering constraints **without rasterizing**. Returns a structured list of warnings in milliseconds — use before `create_screen` / `update_screen_image` to catch layout bugs before the slow render step. + +**Input:** + +| Parameter | Type | Required | Description | +|-----------|--------|----------|------------------------------------------------| +| `html` | string | yes | The HTML string to validate against Satori constraints | + +**Output:** + +```json +{ + "warnings": [ + { "path": "div[0] > span[0]", "rule": "text-needs-nowrap", "message": "Text leaf missing white-space: nowrap" }, + { "path": "div[0]", "rule": "multi-child-needs-flex", "message": "3 children but no display: flex" } + ] +} +``` + +Empty `warnings: []` means the HTML passes all checks. + +**Rules checked:** + +| Rule ID | Description | +|----------------------------|-----------------------------------------------------| +| `unsupported-position` | `position: absolute` and `position: fixed` are not supported | +| `no-style-block` | `
Hi
', + ); + const match = warnings.find((w) => w.rule === "no-style-block"); + expect(match).toBeDefined(); + expect(match.message).toContain("