Post Draft From Markdown
post_draft_from_markdownCreate or update a Substack draft from Markdown content, with optional tags, prepublish checks, and publishing controls for newsletter or post delivery.
Instructions
Create or update a Substack draft from Markdown.
This tool builds a Substack `Post` from markdown content and posts a draft.
It supports optional tag assignment, prepublish (setup check), and publishing.
Args:
title: Draft title.
markdown: Markdown body content.
subtitle: Optional subtitle text.
audience: One of `everyone`, `only_paid`, `founding`, `only_free`.
write_comment_permissions: One of `none`, `only_paid`, `everyone`.
search_engine_title: Optional title for search engine optimization.
search_engine_description: Optional description for search engine optimization.
slug: Optional URL slug for the post.
draft_section_id: Optional section ID for the draft.
tags: Tag or list of tags to attach to the post.
prepublish: If true, calls `prepublish_draft` after creation.
publish: If true, calls `publish_draft` after creation (and optionally prepublish).
send: Passed to `publish_draft` for newsletter delivery.
share_automatically: Passed to `publish_draft`.
Returns:
dict containing drafted post (`draft`), optional `tags`, `prepublish`, `publish` results.
Examples:
With the YAML structure from the README, a caller can map fields like:
```yaml
title: "My Post Title"
subtitle: "My Post Subtitle"
audience: "everyone"
write_comment_permissions: "everyone"
markdown: |
# Hello
This is the body.
tags:
- python
- substack
prepublish: true
publish: true
send: false
share_automatically: true
```
Then invoke via MCP directly:
```python
from substack_mcp.mcp_server import post_draft_from_markdown
result = await post_draft_from_markdown(
title='My Post Title',
markdown='# HelloThis is the body.', subtitle='My Post Subtitle', audience='everyone', write_comment_permissions='everyone', tags=['python', 'substack'], prepublish=True, publish=False, # set true when ready ) print(result) ```
A longer process with manual prepublish/publish calls:
```python
from substack_mcp.mcp_server import (
post_draft_from_markdown,
prepublish_draft,
publish_draft,
add_tags,
)
d = await post_draft_from_markdown(
title='Long flow',
markdown='Content',
tags=['a','b'],
publish=False,
)
draft_id = d['draft']['id']
await add_tags(draft_id, ['post-tag', 'news'])
await prepublish_draft(draft_id)
await publish_draft(draft_id, send=True, share_automatically=True)
```
This docstring example is meant to mirror the YAML-driven workflow and show how to decompose the same operations into explicit tool calls.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| send | No | ||
| slug | No | ||
| tags | No | ||
| title | Yes | ||
| publish | No | ||
| audience | No | everyone | |
| markdown | Yes | ||
| subtitle | No | ||
| prepublish | No | ||
| draft_section_id | No | ||
| search_engine_title | No | ||
| share_automatically | No | ||
| search_engine_description | No | ||
| write_comment_permissions | No | everyone |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||