Skip to main content
Glama

Replace a draft body with a structured document

set_draft_body
Idempotent

Replace a draft's body with a validated JSON document for precise captions, buttons, embeds, and paywalls that markdown cannot express.

Instructions

Replace a draft's body with a Substack document you build node by node. Use this when you need exact control that markdown cannot express, such as a specific image caption or a button.

The document is {"type":"doc","content":[ ... ]}.

Nodes: paragraph; heading (attrs.level 1-6, rendered by Substack as its H1-H3); blockquote; bullet_list / ordered_list (attrs.order, attrs.tight) with list_item children; code_block (attrs.language); horizontal_rule; image2 (attrs.src, attrs.alt, attrs.caption); youtube2 (attrs.videoId); twitter2 (attrs.url); spotify2 (attrs.url); vimeo (attrs.url); paywall (everything after it is for paying subscribers); button (attrs.url, attrs.text); subscribeWidget (attrs.text); footnote (attrs.number) with footnoteAnchor.

Marks on text nodes: strong; em; code; strikethrough; link (attrs.href).

The document is validated before it is sent, so an unknown node name is an error here rather than a post that renders wrong on Substack. For ordinary writing, update_draft with markdown is easier and produces the same result.

Input Schema

NameRequiredDescriptionDefault
idYesDraft id.
documentYesThe full ProseMirror document as a JSON string, shaped {"type":"doc","content":[...]}.
publicationNoWhich connected publication to act on, matched loosely against its hostname (for example 'example.substack.com' or just 'example'). Defaults to the first connected publication.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv3.0.1
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • removedInput schema / additionalProperties
      Removed value: -false
  2. First observedv2.1.1

TDQS

A4.5/5.0
Behavior4/5

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

Annotations cover mutation safety (readOnly=false, idempotent=true, destructive=false), so the bar is lower. The description adds real behavior beyond them: the document is validated before sending so an unknown node name fails here rather than rendering wrong, and paywall semantics ('everything after it is for paying subscribers'). It omits auth/permission requirements and any return value, but the added validation and rendering semantics are substantive.

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?

Front-loaded with purpose and when-to-use before the reference material, and every sentence carries information. The long node catalogue is dense reference rather than padding, though it makes the definition lengthy.

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

Completeness4/5

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

For a tool whose hard part is constructing a valid structured document, the node/mark catalogue plus the validation warning give an agent most of what it needs. It stops short of describing what happens to the pre-existing body or what the call returns, but no output schema exists and annotations cover the safety profile.

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 coverage is 100%, so the baseline is 3. However, the description goes well beyond the schema's terse 'ProseMirror document as a JSON string' by enumerating the permitted node types, their attributes, and the marks allowed on text nodes — effectively defining the valid value domain for the document parameter.

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?

States a specific verb+resource ('Replace a draft's body with a Substack document') and immediately qualifies the mechanism ('you build node by node'). It is clearly distinguishable from update_draft, which it names as the markdown alternative.

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?

Explicitly says when to use it ('when you need exact control that markdown cannot express, such as a specific image caption or a button') and names the alternative with its tradeoff ('For ordinary writing, update_draft with markdown is easier and produces the same result').

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