edit_slides
Update existing HTML slide decks with targeted edits: replace slides, patch CSS, swap CSS variables, or modify classes. Reduces token usage by 60-90% compared to regenerating the entire deck.
Instructions
Token-efficient partial edits on a previously-generated HTML deck. Use this INSTEAD of regenerating the whole deck for small changes — it saves 60-90% tokens vs a full rewrite. Operations: replace_slide (swap one slide block by 1-indexed slideIndex), patch_css (append CSS rules to ), swap_token (replace a CSS variable's value, e.g. {"--coral": "#FF0000"}), patch_class (add/remove a class on a specific slide, e.g. {"add": "dark"}). Reads from cache or htmlPath; saves the updated HTML and returns the new htmlPath. After editing, show the htmlPath as a preview artifact and STOP — do NOT call render_slides until the user confirms.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| htmlPath | No | Path to HTML to edit. Falls back to cached HTML from last create_slides call. | |
| operation | Yes | Edit operation: replace_slide swaps one slide block; patch_css appends CSS rules to <style>; swap_token replaces a CSS variable's value; patch_class adds/removes a class on a slide. | |
| slideIndex | No | 1-indexed slide position. Required for replace_slide and patch_class. Omit for global ops (patch_css, swap_token). | |
| payload | Yes | For replace_slide: the new <div class="slide">...</div> HTML string. For patch_css: a CSS rules string. For swap_token: an object {tokenName: newValue}, e.g. {"--coral": "#FF0000"}. For patch_class: an object {add?: string, remove?: string}. |