edit_slide_xml
Edit a PowerPoint slide via XML or JavaScript DOM code, then reimport it server-side. Use it for structural changes, such as adding shapes or rebuilding layouts, while keeping slide data server-side.
Instructions
Edit slide XML and reimport. Two modes: (1) xml mode — provide finished XML string (use read_slide_xml first to get current XML), (2) code mode — provide JS code that manipulates the pre-parsed DOM (receives: doc, findShapeById, NS_P, NS_A, escapeXml, serializeXml, DOMParser). Code mode preserves untouched attributes. The slide is exported, modified server-side, and reimported — data never enters Claude's context. NOTE: the reimport deletes and reinserts the slide, but the view is restored to the edited slide afterwards — reserve this for structural changes (new shapes, layout rebuilds). BULK EDITS: apply ALL edits across slides first, then verify with a single screenshot — do NOT alternate screenshot and edit_slide_xml calls; rapid reimport cycles crash PowerPoint for Mac (reimports are throttled server-side, so interleaving only wastes time).
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": {
"slide": "<slide>"
},
"name": "edit_slide_xml"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | No | Modified XML — full slide XML or a single shape's <p:sp> element (when shapeId is provided). Mutually exclusive with 'code'. | |
| code | No | JS code that manipulates the pre-parsed slide DOM. Receives: doc (Document), findShapeById(id) → Element|null, NS_P, NS_A (namespace strings), escapeXml(text), serializeXml(node), DOMParser. Mutually exclusive with 'xml'. | |
| slide | Yes | Slide number, 1-based (slide 1 = first slide) | |
| shapeId | No | Optional shape ID (xml mode only). If provided, replaces only that shape's <p:sp> element instead of the full slide XML. | |
| explanation | No | Brief description of what the code does (for logging, max 50 chars). Only used with code mode. | |
| presentationId | No | Target presentation ID from list_presentations. Optional when only one presentation is connected. |