Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
newNameYes
planJsonYes
saveModeYesReplace
documentIdYes
connectionIdYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.7.0
    • changedInput schema / properties / saveMode / default
      Previous value: -"NewVersion"New value: +"Replace"
  2. First observed

TDQS

A4.4/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden and exceeds it: it enumerates return fields and nullability, explains the receipt hash and actor separation, details the three saveMode semantics, and warns about ambiguous provider failure states ('unknown', 'writtenNotRegistered') with explicit 'never retry... blindly' instruction. This is far richer than 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 description is a dense, single paragraph that front-loads the action and then delivers essential return and failure semantics. Every sentence adds information, but the long list of return-field names is heavy and could be easier to scan as a structured list or broken into 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, side-effecting tool with no output schema and no annotations, the description covers the return contract, nullability, write-outcome error semantics, retry guidance, and all save modes. It gives an agent enough information to call the tool correctly and to recognize ambiguous failure states, which is the main risk for this operation.

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?

Given 0% schema description coverage, the description maps the parameters well: connectionId/documentId as targets, planJson as the plan payload, saveMode with three enumerated behaviors and effects, and newName as an optional display name in NewDocument mode. It stops short of specifying the expected internal shape of planJson, and the 'optional newName' wording sits a bit oddly with newName being schema-required (though defaulted to an empty string).

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 sentence names a specific verb ('Apply'), a precise resource ('a DocumentPlan JSON'), and a target ('(connectionId, documentId)'), and notes that it saves through the provider. This clearly separates it from siblings like preview_plan (preview vs apply) and edit_document (structured plan vs direct edit).

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

Usage Guidelines3/5

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

The action statement ('Apply... and save') implies the primary use case, and the saveMode discussion gives context for choosing among replace/new-version/new-document behaviors. However, the description does not explicitly contrast with preview_plan or other siblings, nor does it state when not to use the tool, so the guidance remains implied rather than explicit.

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