Skip to main content
Glama

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

NameRequiredDescriptionDefault
xmlNoModified XML — full slide XML or a single shape's <p:sp> element (when shapeId is provided). Mutually exclusive with 'code'.
codeNoJS 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'.
slideYesSlide number, 1-based (slide 1 = first slide)
shapeIdNoOptional shape ID (xml mode only). If provided, replaces only that shape's <p:sp> element instead of the full slide XML.
explanationNoBrief description of what the code does (for logging, max 50 chars). Only used with code mode.
presentationIdNoTarget presentation ID from list_presentations. Optional when only one presentation is connected.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.7.1
    • addedInput schema / properties / slide
      Added value: +{
      +  "description": "Slide number, 1-based (slide 1 = first slide)",
      +  "maximum": 9007199254740991,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • removedInput schema / properties / slideIndex
      Removed value: -{
      -  "description": "Zero-based slide index",
      -  "maximum": 9007199254740991,
      -  "minimum": 0,
      -  "type": "integer"
      -}
    • changedInput schema / required
      Previous value: -[
      -  "slideIndex"
      -]New value: +[
      +  "slide"
      +]
  2. First observedv0.6.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden and does so exceptionally well: it discloses server-side export/modification/reimport, slide deletion and reinsertion, view restoration, attribute preservation in code mode, throttling, and the PowerPoint for Mac crash risk. It also explains the context-handling behavior and safe bulk-edit sequencing, none of which is inferable from the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The action and modes are front-loaded, and the lengthy warning contains important operational detail rather than generic filler. It is nevertheless a dense single paragraph, repeats the helper list already present in the schema, and would be easier to scan with separate mode and warning sections.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex mutating tool with six parameters, no annotations, and no output schema, it covers prerequisites, mode selection, processing and destructive behavior, platform-specific risk, throttling, and verification. Combined with the fully documented schema, this is sufficient for safe selection and invocation; only result/failure details and named simple-edit alternatives remain undocumented.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds value by explaining how to obtain the XML input and how code mode treats untouched attributes, but the DOM-helper inventory and much of the mode wording repeat the schema, and it adds little about slide, shapeId, explanation, or presentationId.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening "Edit slide XML and reimport" supplies a precise verb and resource, while the two modes and "reserve this for structural changes (new shapes, layout rebuilds)" define its low-level structural niche. This distinguishes it in practice from higher-level slide, shape, and paragraph editors even though those siblings are not named.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives a concrete prerequisite for XML mode ("use read_slide_xml first"), explicit structural use cases, and a verification workflow for bulk edits. The prohibition on alternating screenshots and edits, together with the single-screenshot alternative, provides specific operational when-not guidance; only explicit routing of minor edits to other siblings is absent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.