Exposes pretext text layout and measurement tools via Model Context Protocol. Provides fast, accurate text measurement, layout analysis, and validation for typography and text rendering.
Pretext MCP server has well-structured tool definitions with complete input schemas and detailed descriptions. All 5 tools are explicitly registered with Zod schemas covering parameters, types, and constraints. Descriptions are comprehensive (150-300 chars), explaining WHAT each tool does and WHEN to use it. However, output schemas are not documented, LLMs cannot predict return structure. Error handling is absent; no recovery guidance or actionable error messages. Tool names are action-oriented (pretext_run, pretext_measure, pretext_validate, pretext_explain, pretext_source) but generic 'pretext_*' prefix reduces clarity when multiple tools exist. Parameters are well-constrained with enums and descriptions, but no documented output format or error classification.
Search the pretext knowledge base for explanations of concepts, APIs, architecture, browser compatibility, script support, edge cases, and common mistakes.
Analyze text segmentation and widths. Returns segment breakdown with per-segment text, width, and break kind. Default mode=structural uses canvas-shim widths; mode=accurate uses real browser font metrics.
Run pretext text layout. Pass `text` for plain layout or `richInline` for chip/mention/atom inline layout (v0.0.5+). Returns line count and height. With rich=true, returns per-line widths. Default mode=structural is fast and deterministic but uses approximate widths. Set mode=accurate to run in a real headless browser for pixel-precise font metrics.
Read pretext source code. Specify a module (layout, analysis, measurement, line-break, line-text, rich-inline, bidi) and optionally a function name.
Check code for common pretext anti-patterns: system-ui font, prepare() on resize, inlined prepare, DOM measurement alongside pretext, missing pre-wrap option, wordBreak: keep-all on Latin-only text (v0.0.5+), excessive letterSpacing values (v0.0.6+), prepare() use on chip-shaped strings (suggesting prepareRichInline).
Output schemas not documented. LLMs cannot predict return structure (line count, height, per-line widths, segment breakdown, validation results, etc.). Forces agents to guess field names and types.
No error handling or recovery guidance. If a tool fails (invalid font, unsupported locale, browser crash), the LLM receives no actionable error message or next steps. Agents cannot self-correct.
Tool names use generic 'pretext_' prefix. When many tools exist, 'pretext_run' vs 'pretext_measure' vs 'pretext_validate' requires LLM to read full descriptions to disambiguate. Consider domain-specific verbs: 'layout_text', 'measure_segments', 'validate_code', 'search_docs', 'read_source'.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | D | 56 | 2026-07-28+ | v2 |
pretext_explain and pretext_source accept free-form string queries with no constraints or examples. LLMs may hallucinate invalid module names or query formats. Add enum constraints for module names and example queries.
pretext_run and pretext_measure accept 'mode' parameter (structural vs accurate) but do not document performance implications, latency expectations, or when to use each. Agents cannot reason about cost/accuracy tradeoff.