Font Lab

v1.0.0
io.github.jmg698/font-lab Checked 5 days ago Published 4 months ago

A decision surface for typography: curate font directions on your real site, ship next/font code.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

font_lab_start

START HERE when a user wants to choose, change, or improve fonts — on ANY framework (Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …). Returns the project analysis (including `capabilities` + `shipNote` — the preview/ship path for THIS stack, so a non-Next project is a different route, never a dead end), an `environment` block (local vs remote/container session — with the workflow consequences spelled out, e.g. screenshots ARE the choosing moment when the human can't reach this machine's localhost), a `context` block (the project's existing color palette, brand/design docs, and a s…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
remotebooleanSet true if you're a cloud/container agent whose human CANNOT open localhost URLs on this machine (auto-detected for common clouds — Claude Code on the web, Codespaces, Gitpod, Codex cloud; pass exp…

font_lab_analyze

Audit ANY web project's CURRENT typography before changing it: framework (Next/Vite/Astro/Remix/SvelteKit/TanStack/…), router, Tailwind version, the current display/body/mono fonts, how they're wired, and coverage warnings (e.g. a font that's declared but not actually rendered). The result's `capabilities` + `shipNote` name the right path for THIS stack — live panel on Next App Router, portable preview + css-entry auto-ship elsewhere (Tailwind v4, v3, or var-wired plain CSS), hand-apply only when there's no seam. NEVER treat a non-Next stack as unsupported without reading `capabilities`. P…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).

font_lab_list_catalog

Browse Font Lab's curated catalog of ship-ready variable Google fonts (each verified for capsize/CLS-safe parity). Filter by role ('display'|'body'|'mono') or vibe tag (e.g. 'editorial','geometric','serif','technical'). Use this to compose your OWN font directions when the default curation isn't what the user asked for.

ParameterTypeDescription
rolestring
tagstring

font_lab_check_fonts

Check whether specific fonts can ship with Font Lab's preview==ship guarantee — use this to REACH BEYOND the built-in catalog. Pass family names (any of ~1,500 Google fonts like 'Hedvig Letters Serif', or a curated open-foundry face like 'Cabinet Grotesk' / 'General Sans'). Each returns a verdict: 'guaranteed' (full WYSIWYG), 'best-effort' (shippable, but the preview may not be byte-for-byte — show the human the warnings and let them decide), or 'unavailable' (can't ship, with the reason). The catalog is a floor, not a ceiling: reach for distinctive faces that fit the brief and confirm the…

ParameterTypeDescription
families *arrayFont family names to check.
projectDirstringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).

font_lab_curate

FALLBACK menu — ~5 font directions (display+body+mono pairings) that move off the project's current fonts, no LLM. Seeded to THIS project (its name + palette + copy), so the spread differs from project to project instead of being the same five everywhere — but it is still a generic starting point, NOT tailored to the user's brief. Use it only when you have NO brief. When you DO have a brief (from font_lab_start's intake questions), prefer font_lab_compose_directions and tailor the options to what they asked for — that's the better experience. Pass an optional 'vibe' to steer the fallback…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
countnumber
vibestring

font_lab_compose_directions

The PRIMARY way to build the menu: assemble tailored font directions for the user's brief (from font_lab_start's intake answers). Pass the user's stated direction as `brief` — if you omit it, the result is INFERRED rather than tailored, and you'll get a warning telling you to ask first. Reach PAST the overexposed defaults — give each direction a distinctive face and a one-line rationale tying it to what they asked for. Each direction needs display, body, and mono families. Families can be ANY shippable font (catalog, ~1,500 Google fonts, or a curated open-foundry face) — the gate admits…

ParameterTypeDescription
directions *array
projectDir *stringThe project root (REQUIRED). Admitted fonts are cached for the preview build AND the composed set persists as the project's default preview menu — what screenshots/select resolve against on every fr…
briefstringThe user's stated direction from intake (what feeling / how bold / brand). Omitting it warns you to ask first.
forcebooleanOverride the anti-generic gate (use only when the user explicitly wants overexposed default fonts).

font_lab_init

SET UP the live preview panel in the project, built from the directions YOU composed for the user's brief — self-hosts the bundles, installs the dev panel, mounts it (dev-only). NEXT.JS APP ROUTER ONLY (the panel mounts in layout.tsx): on any other framework (Vite/Astro/Remix/SvelteKit/TanStack/…) SKIP this and use font_lab_preview instead — the pick still ships via font_lab_apply. Pass the `directions` from font_lab_compose_directions; the panel shows exactly those. This REFUSES without directions (so the generic default menu can't be mounted without asking the user first) — only pass…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
allowFallbackbooleanMount the deterministic default menu without a brief — only if the user explicitly wants it.
allowVersionSkewbooleanProceed despite a font-lab version mismatch between this process and the project's installed package. ONLY for a deliberately mixed checkout — the default refusal exists because skewed stamps ship b…
countnumber
directionsarrayThe brief-driven directions to show in the panel (from compose_directions).
trackedbooleanCommit-track the panel scaffolding instead of self-ignoring it (default false: app/_fontlab/ and public/fontlab/ carry a nested .gitignore so they never show in git status). Set true only when the use…
vibestring

font_lab_healthcheck

VERIFY THE SETUP BEFORE INVITING THE HUMAN — run this after font_lab_init (and again after any dev-server restart or CSP/config change), and act on it: a white page or a missing panel is an AGENT failure to catch here, not a human setup step. One read-only pass checks: VERSION ALIGNMENT (this process vs the project's installed font-lab vs the panel stamp vs the :7777 endpoint — the npx-cache skew that stamps broken panels), SCAFFOLD COMPLETENESS (every app/_fontlab/ file present and every relative import resolving — the class that becomes `Module not found: Can't resolve './fl-census'` â…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
baseUrlstringThe dev server URL the human would open (e.g. http://localhost:3000). Optional — defaults to the recorded dev server; unreachable is a BLOCKER when passed explicitly, a warning otherwise.
portnumberPick-endpoint port (default 7777).

font_lab_more_directions

Add MORE options to the live panel — when the human wants to keep exploring beyond the current set. Compose additional tailored directions first (font_lab_compose_directions), then pass them here; they're admitted and APPENDED to the panel (existing options are kept), and the panel updates live. Use this whenever the user asks 'what else?' / 'show me more' — the menu is never capped. This ALSO fulfills an in-panel 'more options' request (from font_lab_wait_for_request): appending clears the pending request and flips the menu from provisional 'starter' to tailored. Honor the request's brief…

ParameterTypeDescription
directions *arrayThe new directions to append (from compose_directions).
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).

font_lab_uninit

Strip ONLY the dev-panel scaffolding (the layout.tsx mount, app/_fontlab/, public/fontlab/ preview fonts) — any applied font change and copy edits are left intact. PREFER font_lab_finish: it runs this AND returns the git-verified commit plan in one call, which is what the end of a session actually needs. Reach for bare uninit only when you want the scaffolding gone mid-session (e.g. the human wants to keep exploring later but commit now).

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).

font_lab_finish

THE FINISHING MOVE — run this when the human is done choosing (they clicked *done ✓* in the panel, said so in chat, or a pendingCleanup note rode a tool result). One call: strips the dev-panel scaffolding (uninit — applied fonts and copy edits are untouched), clears the panel's done signal, and returns the git-verified `commitPlan`: the SHIP pile (the human's copy edits + font apply, cross-checked against `git status` so undone files don't get committed) with ready-to-run `git add`/`git commit` commands and a suggested message, plus what's scaffold, install wiring, or the human's own unr…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
keepScaffoldbooleanLeave the dev panel mounted (the human wants to keep exploring) — just get the commit plan and clear the done signal.
uninstallbooleanAlso remove Font Lab's install wiring everywhere (MCP configs, skill, AGENTS.md block, hooks). Default false — keep it for next time.

font_lab_prepare_preview

Rebuild the LIVE preview bundle for the directions YOU composed for the user's brief (self-hosted woff2 + exact next/font fallbacks), so the HUMAN can flip through them and pick. Pass the `directions` from compose_directions. REFUSES without directions (don't rebuild the generic default menu without asking the user) — only pass allowFallback:true if they explicitly want the default. Use font_lab_init for first setup; use this to rebuild after changing the options. Never auto-selects. (Fetches fonts.)

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
allowFallbackbooleanBuild the deterministic default menu without a brief — only if the user explicitly wants it.
allowVersionSkewbooleanProceed despite a font-lab version mismatch between this process and the project's installed package (default: refuse — skewed stamps ship broken panels; fix with `npx font-lab upgrade`).
countnumber
directionsarrayThe brief-driven directions to build (from compose_directions).
vibestring

font_lab_wait

BLOCK until the human picks a direction, asks for more options, OR clicks *done ✓* in the panel — whichever comes first. This is the unified event loop: one call covers every panel event, so you never miss one because you were waiting for the wrong kind. While blocked, the panel shows 'agent listening' and the human's clicks reach you instead of the copy-a-prompt off-ramp. Returns one of: { event: 'pick', selection } — the human picked. Call font_lab_apply to ship it. { event: 'request', request } — the human wants MORE options. request.brief has their mini-brief (feeling,…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
ignoreExistingPickbooleanWait for a NEW pick even if a previous selection.json exists.
timeoutSecnumberMax seconds to block (default 240). Re-call on timeout.

font_lab_wait_for_pick

BLOCK until the human picks in the live panel (or timeoutSec elapses). Prefer font_lab_wait (unified) — it covers both picks AND 'more options' requests in one call. This single-event variant is still useful when you ONLY want picks (e.g. after the panel is fully stocked and no more rounds are expected). Returns { picked: true, selection } or { picked: false, timedOut: true } — on timeout, call it again to keep waiting. Alternative for harnesses with background terminals: run `npx font-lab serve --once` as a background task — it exits the moment the pick lands, with the selection as its…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
ignoreExistingbooleanWait for a NEW pick even if a previous selection.json exists.
timeoutSecnumberMax seconds to block (default 240). Re-call on timeout.

font_lab_wait_for_request

BLOCK until the human clicks 'more options / none of these' in the live panel (or timeoutSec elapses). Prefer font_lab_wait (unified) — it covers both picks AND requests in one call. This single-event variant is still useful when you specifically want to wait ONLY for a request. Returns { requested: true, request } — where request.brief is the mini-brief (feeling / departure / brand / note) and request.exclude lists families already shown. On a request: compose new directions, call font_lab_more_directions, then switch to font_lab_wait. Returns { requested: false, timedOut: true } on timeo…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
timeoutSecnumberMax seconds to block (default 240). Re-call on timeout.

font_lab_status

One snapshot of the whole handoff: the current pick (if any), whether it's been shipped (applied), whether an agent is waiting, whether the pick endpoint is up, the environment (local vs remote/container — with the workflow consequences), and the latest backup. Call this when resuming a session, before apply, or whenever you need to know where the loop stands. Its `devServer` field health-checks the dev server the panel last reported — if `devServer.up` is false, either RESTART it or just call font_lab_screenshot_directions / font_lab_verify, which start the project's dev server themselves…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
portnumberPick-endpoint port (default 7777).

font_lab_read_pick

One-shot read of the human's pick (.font-lab/selection.json); null until they've chosen. Prefer font_lab_wait_for_pick (it blocks and shows the human 'agent listening') — use read_pick for a quick non-blocking check.

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).

font_lab_apply

Ship the human's pick, idempotently and reversibly (backup-first). On Next.js App Router it writes next/font + Tailwind — Google faces via next/font/google, open-foundry faces via next/font/local with the woff2 self-hosted into the source tree (every family is verified buildable BEFORE any file is written; unverifiable families refuse with the reason). On ANY OTHER framework (TanStack/Vite/Astro/Remix/SvelteKit/…) it self-hosts the parity @font-face into the CSS entry and routes it through the project's own seam — Tailwind v4 @theme, Tailwind v3's config-generated font-* utilities + Pref…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).

font_lab_verify

THE SHIP RECEIPT — after font_lab_apply (and any rewires or hand edits), re-render the RUNNING site headlessly and MEASURE whether the pick actually reached the pixels: per route, the % of heading/body/label text whose computed font now matches the picked families. Files written is not the same as fonts changed — never declare a font ship done without a converged receipt. If no dev server is reachable it STARTS the project's own dev command itself (managed, bound to 127.0.0.1, stopped after) — pass ensureServer:false to forbid that. Pass the routes the human cares about (include per-rout…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
baseUrlstringThe running dev server URL, e.g. http://localhost:3000. Optional: defaults to the recorded dev server, else a managed one is started.
ensureServerbooleanDefault true: start the project's dev server (managed, 127.0.0.1, stopped after) when none is reachable. false forbids starting processes.
executablePathstringOptional Chrome/Chromium binary path (usually unnecessary).
routesarrayRoutes to measure; default ['/']. Include island routes (e.g. '/fontlab').
targetsobjectOptional explicit families to verify against (defaults to the pick in selection.json).

font_lab_rewire_dead_roles

Fix a role that font_lab_analyze flags as DEAD — declared but not actually rendered (common with Tailwind v4 @theme inline + a hand-written `font-family: var(--font-display)`, which resolves to nothing). Points those raw usages at the published leaf variable so the font renders, making the swap visible. Reversible via font_lab_undo. Offer this when analyze reports dead roles and the user wants that role to actually change.

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).

font_lab_undo

Revert Font Lab's last apply or rewire, restoring the edited files byte-for-byte from the backup.

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).

font_lab_screenshot_directions

Screenshot the human's REAL RUNNING SITE in each curated direction — THE choosing moment on every framework (and the ONLY sanctioned preview surface off Next until it has actually failed: the generic font_lab_preview sheet stays locked behind a failed attempt here). On Next.js with the panel init'd it drives the panel; on every other stack (Vite / Astro / Remix / SvelteKit / TanStack / plain CSS) it paints the rendered page directly through the census — the same machinery the panel flips with — after injecting the parity @font-face inline (no init, no project writes: preview fonts cache…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
allowFallbackbooleanCapture the deterministic starter menu when nothing was composed — only if the user explicitly wants the untailored default.
baseUrlstringA dev server you already run, e.g. http://localhost:3000 or :5173. Optional — with none reachable, Font Lab starts the project's dev command itself (see ensureServer).
directionsarrayThe directions to capture (from compose_directions). Defaults to the persisted composed set (.font-lab/preview.json); with neither, this ERRORS instead of silently using the starter menu.
ensureServerbooleanDefault true: start the project's dev server (managed, 127.0.0.1, stopped after) when none is reachable. false forbids starting processes.
executablePathstringOptional path to a Chrome/Chromium binary. Usually unnecessary — it finds a system/pre-installed browser automatically.
inlineImagesbooleanDefault true over MCP: heroShots ride the result as image content blocks so the human sees them in-chat immediately. false returns paths only.
outDirstringWhere to write images; defaults to <project>/.font-lab/previews.
routesarrayRoute(s) to capture; defaults to ['/'].

font_lab_preview

LAST-RESORT specimen sheet — a self-contained HTML file of GENERIC CARDS (one per direction, parity fonts embedded, opens offline), rendered on the project's palette and copy. These are NOT the human's pages, so this tool is LOCKED until the real-site path has actually been tried: it REFUSES unless a font_lab_screenshot_directions attempt failed on infrastructure (no Chromium could launch, the dev server wouldn't serve — recorded automatically in .font-lab/capture-blocked.json), or you pass force:true because the human EXPLICITLY asked for a portable offline artifact. On every framework th…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
allowFallbackbooleanRender the deterministic starter menu when nothing was composed — only if the user explicitly wants the untailored default.
countnumber
directionsarrayThe brief-driven directions to render (from compose_directions). Defaults to the persisted composed set.
forcebooleanBypass the screenshots-first lock — ONLY when the human explicitly asked for the portable offline sheet.
vibestring

font_lab_preview_screenshots

Headless captures of the LAST-RESORT specimen sheet (font_lab_preview) — one render-checked PNG per generic card. Same lock as font_lab_preview: REFUSES until a real font_lab_screenshot_directions attempt has failed on infrastructure (recorded automatically), or force:true because the human explicitly wants the offline sheet — on every framework the real-site captures are the choosing surface, and this needs a Chromium anyway (if a browser works, real-site screenshots usually work too; the genuine niche is a dev server that can't serve). When unlocked: each card is render-checked (a real w…

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
allowFallbackbooleanRender the deterministic starter menu when nothing was composed — only if the user explicitly wants the untailored default.
directionsarrayThe brief-driven directions to render (from compose_directions). Omit if passing htmlPath; defaults to the persisted composed set.
executablePathstringOptional Chrome/Chromium binary path (usually unnecessary).
forcebooleanBypass the screenshots-first lock — ONLY when the human explicitly asked for the portable offline sheet.
htmlPathstringPath to an already-built preview sheet (from font_lab_preview) to screenshot as-is.
inlineImagesbooleanDefault true over MCP: card images ride the result as image content blocks. false returns paths only.
outDirstringWhere to write PNGs; defaults to <project>/.font-lab/previews.

font_lab_select

Record the human's pick by direction id — the HEADLESS counterpart to clicking Pick in the panel. Use AFTER the human has chosen from the screenshots (you must still let the HUMAN make the call — never auto-select). The id resolves against the SAME set the human was shown: explicit `directions` if passed, else the composed set persisted by font_lab_compose_directions. Writes the same selection.json the panel writes, so font_lab_apply ships it identically. Supports a mixed pick: pass roles {display, body, mono} as direction ids to take each role from a different direction.

ParameterTypeDescription
directionId *stringThe id the human picked (from compose/screenshots).
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
rolesobjectOptional mixed pick — per-role direction ids, e.g. {display:'editorial-serif', body:'modern-grotesque'}.

font_lab_live_instructions

Get ready-to-run commands to launch the FULL live editor (flip / mix / compare directions in a real browser) — for when the headless screenshots aren't enough and the human wants to drive it themselves. Detects the project's dev command. In a LOCAL session these run in the agent's/human's terminal here; in a REMOTE/container session the result reframes them as commands for the human's OWN machine after pulling the branch (never a localhost URL handoff the human can't reach — pass `remote` to override detection).

ParameterTypeDescription
projectDir *stringAbsolute path to the user's project root (any framework — Next.js, Vite, Astro, Remix, SvelteKit, TanStack, …).
remotebooleanSet true if you're a cloud/container agent whose human CANNOT open localhost URLs on this machine (auto-detected for common clouds — Claude Code on the web, Codespaces, Gitpod, Codex cloud; pass exp…