apply_plan
Apply a validated DocumentPlan JSON to a Word document and save it through the provider. Choose Replace, NewVersion, or NewDocument mode; handles optimistic version checks and reports write outcomes.
Instructions
Apply a DocumentPlan JSON to (connectionId, documentId) and save through the provider. Returns {isValid, committed, writeOutcome, possibleOutput, receipt, sourceDocumentId, outputConnectionId, outputDocumentId, outputVersion, outputName, outputContentType, changes, errors}; non-applicable values are null. The receipt hashes the effective plan and exact input/output bytes and keeps the host-authenticated actor separate from the plan's display revision author. saveMode: 'Replace' (default, overwrites the source after an optimistic version check), 'NewVersion' (keeps the source and mints a new id under the same connection), 'NewDocument' (mints a fresh id with an optional newName for display). Plan-validation and operation-conflict failures have writeOutcome 'notWritten'. A provider failure after a write began may instead return 'unknown' or 'writtenNotRegistered' with possibleOutput; never retry those blindly or report the document unchanged until the host reconciles the possible output.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| newName | Yes | ||
| planJson | Yes | ||
| saveMode | Yes | Replace | |
| documentId | Yes | ||
| connectionId | Yes |