set_style
Manage CSS styling for Slidev presentations by applying global styles, slide-specific style blocks, or UnoCSS/Tailwind classes, with dry-run diff previews.
Instructions
Manage CSS styling for the Slidev presentation. Supports three modes: 'global' (writes to style.css, applied to all slides), 'slide' (injects a block into a specific slide), and 'unocss' (adds UnoCSS/TailwindCSS utility classes to a slide's frontmatter). Set dry_run=true to preview the file diff without writing. Reference: https://sli.dev/custom/directory-structure#style
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"mode": "<mode>"
},
"name": "set_style"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| css | No | CSS content to apply. Required for 'global' and 'slide' modes. For 'global': full CSS stylesheet (e.g. 'body { font-family: sans-serif; }'). For 'slide': CSS rules to inject in a <style> block (e.g. 'h1 { color: red; }'). For 'unocss': not used — use the 'classes' field instead. If mode='global' and css is omitted, a default minimal dark style is applied. | |
| mode | Yes | Styling mode: 'global' — Write CSS to style.css (auto-imported by Slidev for all slides). 'slide' — Add/replace a <style> block inside a specific slide. 'unocss' — Add UnoCSS/Windi utility classes to a slide's frontmatter (class field). | |
| append | No | For 'global' mode: if true, appends CSS to existing style.css instead of replacing it. Defaults to false (replace). | |
| scoped | No | For 'slide' mode: whether styles are scoped to the slide (true) or global (false). Scoped styles use <style scoped>, unscoped use <style>. Defaults to true. | |
| classes | No | For 'unocss' mode: space-separated UnoCSS/TailwindCSS utility classes to add to the slide's 'class' frontmatter field (e.g. 'text-center flex items-center'). These merge with any existing classes on the slide. Follow the base-style protection rule: BASE STYLE PROTECTION RULE — Do NOT add Tailwind/UnoCSS classes that override the MCP base styles already defined in style.css, unless the user explicitly requests it. FORBIDDEN — typography overrides (style.css controls these): text-xs/sm/base/lg/xl/2xl..9xl (font sizes set per element), font-sans/serif/mono (Inter + JetBrains Mono already applied), font-thin..black (font-weight set per element), leading-* (line-height set on p/li), tracking-* (letter-spacing set on h1/h3). FORBIDDEN — color overrides (breaks dark palette #0d0d0f/#e8e8f0): bg-white, bg-gray-50..200, bg-slate-50..100, bg-zinc-50..100, bg-neutral-50..100, bg-stone-50..100, text-black, text-gray-700..900, text-slate-800..900, text-zinc-800..900, border-gray-200..300, border-white, border-slate-200..300, shadow-*, ring-*. ALLOWED — layout/positioning only (no style.css conflict): text-center/left/right, flex, grid, items-*, justify-*, flex-col/row, p-*, m-*, gap-*, w-*, h-*, max-w-*, overflow-*, relative, absolute, z-*, col-span-*, row-span-*, rounded-*, self-*, truncate, line-clamp-*. ALLOWED — dark-compatible colors (only when color is explicitly needed): bg-transparent, bg-black/*, bg-gray-800..900, bg-zinc-800..900, text-white, text-gray-100..400, text-slate-100..300. PREFERRED: skip color/typography classes entirely — use <style scoped> with CSS variables: var(--color-bg), var(--color-text), var(--color-accent), var(--color-accent2), var(--color-accent3), var(--color-surface), var(--color-border). | |
| dry_run | No | Preview the change without writing style.css or slides.md. Returns dryRun, wouldWrite, and diff. | |
| slide_number | No | Target slide number (1-based) for 'slide' and 'unocss' modes. Not used for 'global' mode. |