Skip to content

feat(mcp): return where and since when a draft's page is live from get_content_draft, and say a ready draft comes back as it is (#1548, #1554 review) - #1559

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/mcp-draft-published
Oct 27, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
cihan-gyk:feature/mcp-draft-published

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

Follow-ups to the reviews of #1548 and #1554, for the coach's Content Editor workflow (12).

get_content_draft says where and since when the page is live.

  • It now returns published_url and published_at. Migration 00262 sets them together, when the page is sent to the CMS or marked published; both are null until then.
  • Workflow 12 tells the coach to pick the get_content_impact period closest to how long the page has been live. Until now no tool returned that, so the coach had to ask.
  • The tool's description, the skill's tool entry and the MCP guide's table say so. The workflow's step 6 points to published_at; for an optimized page, that's when this version went live.
  • The REST mirror (GET /api/mcp/content-drafts/[id]) returns the same object, so it gets the two fields too.

Skill wording for a draft already marked ready (#1548 review).

  • Before you publish ends in the editor's Mark ready, and the editor completes the action's task there. If set_content_draft_ready runs after that, it returns the draft as it is, with action_tasks_done: 0. The skill's "0 until then" read that as pages still waiting.
  • Step 5 now says: if they marked it ready there, it's done; otherwise offer set_content_draft_ready.
  • The tool's entry says a draft that's already ready or published comes back as it is, with action_tasks_done: 0.

Related issue

Follow-ups to #1554 (review item 1) and #1548 (review follow-up 1).

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. cd web && yarn vitest run src/lib/mcp/content.test.ts. The new case reads a draft before it's live (published_url and published_at null) and after (both set). It fails without the change.
  2. With an MCP client on a local stack, call get_content_draft on a draft marked published in the editor (Next step › Mark published). published_url and published_at are the address and time it was marked.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Also run: yarn test (427 files, 4,081 tests) and yarn build, both pass.

🤖 Generated with Claude Code

…t_content_draft, and say a ready draft comes back as it is (ansvisor#1548, ansvisor#1554 review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mintlify

mintlify Bot commented Oct 26, 2026

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit b1f0218.

Approve preview

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with follow-ups.

The two earlier follow-ups:

  1. #1554's: let the coach see where a page went live, and since when. Done.
    • DRAFT_COLUMNS selects published_at (content.ts:41), DraftRow has it (:55), and getContentDraftFor returns published_url and published_at (:238-239).
    • The tool's description (server.ts:1582), the skill's entry (SKILL.md:262-263) and the guide's row (mcp-server.mdx:304) say so. Workflow 12's step 6 points to it (SKILL.md:672-674).
  2. #1548's: a draft already marked ready reads as "0 tasks". Done.
    • Step 5 now reads "If they marked it ready there, it's done. Otherwise offer set_content_draft_ready" (SKILL.md:661-665).
    • The tool's entry says a ready or published draft comes back as it is, with action_tasks_done: 0 (:296-298). That matches setContentDraftReadyFor: anything but draft and in_review returns { status, action_tasks_done: 0 } before any write. DRAFT_STATUSES has no other status.

What I checked:

  • The select and the shape match. The column is selected, typed and returned under the same name. Nothing spreads the row, so no other column leaks. The other draftFor callers (impact, sources, add source, suggest and ready) read the same row and return nothing new.
  • REST mirror. GET /api/mcp/content-drafts/[id] returns getContentDraftFor's object as it is, so it gets both fields too.
  • Organization. draftFor hasn't changed: brands!inner, filtered on the key's organization_id. A draft of another organization is still null, so the tool answers "Draft not found" and the route answers 404.
  • What published_at means (00262, content-published.js). Only the server writes it, and always together with published_url, in markDraftPublished. That happens when a send's callback or Webflow says the page is live, and when a person marks it published at an address. The guard (00262, kept in 00289) refuses a member's write of either. Both stay null until then. Follow-up 1 covers when it moves.
  • The skill's description is unchanged: 983 characters, or 984 with the newline the literal block keeps. That's the same as main and under 1,024. The PR's skill changes all start below the frontmatter.
  • Tests. The new case fails without the change on all three of its checks: the select has no published_at, and both reads lack the fields (toMatchObject reads a missing key as undefined, not null). The existing getContentDraftFor tests use toMatchObject, so the two new keys don't break them. I read the tests but didn't run them.
  • Merge. One commit on c00e0f0. Since then, main (3b650fb, #1544) has changed only server files. It merges cleanly on main, and with #1562 and #1565 (the #1561 stack, which also touches server.ts).
  • Before the API deploy. This is all web code, and the columns are already on prod (00262). After merge, get_content_draft returns both fields, and nothing needs the API.

Follow-ups:

  1. published_at is when the page was last published, not when it first went live (SKILL.md:262-263, :672-674; server.ts:1582; content.ts:194).
    • markDraftPublished sets it to now each time. Each of these moves it to the latest time:
      • a new send of the same page, once the CMS or Webflow says it's live (markDeliveryPublished: "the post updated in place");
      • the Published button on a page that's already published, even when the address is saved unchanged (publishDraft).
    • So the qualifier fits a page created in the editor too, not just an optimized page. Say a new page went live 60 days ago and was re-sent yesterday with a fix. The coach reads one day, picks 7 days, and says so.
    • Fix: "since when" → "since it was last published". In step 6, replace "for an optimized page, when this version went live" with "when this version went live: a page sent again, or marked published again, moves it". Use the same words in the tool's description and the type comment.
  2. A published draft can have neither field (SKILL.md:262-263, :672-674).
    • Some drafts became Published without an address: those set before CE-013, and those marked published while the API lacks the publish route. The dialog's fallback sets the status alone (publish-dialog.tsx:73-87), and the API on prod may still lack that route.
    • For such a page, "null until then" reads as "not live yet", and step 6 has no date to go on. For a new page, get_content_impact also answers "This draft has no live address yet".
    • Fix: add a line to the entry: "A published draft with neither was marked published without its address: ask where and since when it's live, and point the person to the editor's Published button (editor_path) to add the address, so its numbers can be read."

@gkhngyk
gkhngyk merged commit c128ee2 into ansvisor:main Oct 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants