Skip to content

Tools

websketch-mcp exposes four tools over the Model Context Protocol. Each tool accepts JSON input via MCP’s tools/call method and returns plain-text or JSON output. The recommended workflow is to always call websketch_validate first, then use the other tools on validated captures.

Preflight check for any WebSketch IR capture. This tool never throws and never returns isError: true — it always returns a structured JSON result.

ParameterTypeRequiredDescription
captureobjectYesA WebSketch IR capture object to validate
limitsobjectNoOptional resource limits to override defaults

The optional limits object supports:

FieldTypeDefaultDescription
maxNodesnumber10000Maximum number of nodes in the capture tree
maxDepthnumber50Maximum tree depth
maxStringLengthnumber10000Maximum length for any string value

On success:

{ "ok": true }

If the capture contains embedded warnings, those are passed through:

{ "ok": true, "warnings": ["..."] }

On failure (invalid structure):

{
"ok": false,
"error": {
"code": "WS_INVALID_CAPTURE",
"message": "Invalid capture: 2 validation issues",
"issues": [...]
}
}

On failure (resource limit exceeded):

{
"ok": false,
"error": {
"code": "WS_LIMIT_EXCEEDED",
"message": "Node count 15000 exceeds limit 10000",
"path": "nodeCount",
"expected": 10000,
"received": 15000
}
}

The other three tools will return isError: true if you pass them a malformed capture. By calling validate first and checking ok: true, agents can branch cleanly without needing try/catch logic.


Converts a validated WebSketch IR capture into a compact ASCII wireframe. This gives LLMs a spatial, text-readable representation of any web page without images or raw HTML.

ParameterTypeRequiredDescription
captureobjectYesA valid WebSketch IR capture

Plain text — an ASCII wireframe representation of the capture tree. Example:

+---------------------+
| Frame (root) |
| +-- Button (#btn1) |
| +-- Text (#text1) |
+---------------------+

The output format is designed to be compact and unambiguous for LLM consumption. Node types, IDs, and hierarchy are all visible at a glance.


Compares two WebSketch IR captures and returns the structural differences. Useful for tracking UI regressions after deployments, confirming expected layout changes, or asserting invariants in automated agent workflows.

ParameterTypeRequiredDescription
beforeobjectYesThe baseline capture
afterobjectYesThe capture to compare against the baseline

Both captures are validated internally. If either is malformed, the tool returns isError: true with a descriptive message.

JSON describing structural changes:

{
"added": [...],
"removed": [...],
"modified": [...]
}
  • added — nodes present in after but not in before
  • removed — nodes present in before but not in after
  • modified — nodes present in both but with changed properties

Generates a deterministic hash for a WebSketch IR capture. The same page structure always produces the same hash, making this tool useful for cache keys, snapshot testing, and lightweight change detection without full diff overhead.

ParameterTypeRequiredDescription
captureobjectYesA valid WebSketch IR capture

Plain text — a hex string representing the structural fingerprint of the capture.

a1b2c3d4e5f6...

Two captures with identical structure will always produce the same fingerprint, regardless of when or where they were generated. This makes fingerprints safe to use as cache keys or in CI assertions.