Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
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)
Cihanc128ee2f2c74
diff --git a/docs/guides/mcp-server.mdx b/docs/guides/mcp-server.mdxindex 942debfde..248aed086 100644--- a/docs/guides/mcp-server.mdx+++ b/docs/guides/mcp-server.mdx@@ -301,7 +301,7 @@ Drafts are read and written as a person would in the editor. Ansvisor never publ| Tool | What it does | Writes || --- | --- | --- || `list_content_drafts` | The brand's drafts, latest changed first (up to 100), with status, method (`create` or `optimize`), author, open suggestions and the editor path; filter by `status`. | |-| `get_content_draft` | One draft: its HTML, its numbered passages (`locked` ones AI answers quote today), its Action Center action, the open suggestions and the only pages a suggestion may link to. | |+| `get_content_draft` | One draft: its HTML, its numbered passages (`locked` ones AI answers quote today), where and since when the page is live, its Action Center action, the open suggestions and the only pages a suggestion may link to. | || `get_content_sources` | What the draft draws on over 30 days, as the Sources tab shows it: prompts, AI searches (fan-outs), cited pages, Search Console queries and the person's choices. | || `get_content_impact` | What the draft's live page earns (citations, AI visits, Google clicks, the prompts citing it) against the period before, as the Live page tab reads it. Only for a draft of a live page. | || `create_content_draft` | Write a new draft as the agent (`create`, or `optimize` a page on the brand's domains); it goes to the Library's In review. | **yes** |diff --git a/skills/ansvisor-aeo-coach/SKILL.md b/skills/ansvisor-aeo-coach/SKILL.mdindex bdeb2fed3..54912e354 100644--- a/skills/ansvisor-aeo-coach/SKILL.md+++ b/skills/ansvisor-aeo-coach/SKILL.md@@ -258,10 +258,11 @@ accepts it.`open_suggestions` (how many wait for review) and `editor_path`.Filter: `status`.- **`get_content_draft`** — one draft: `body_html`, the page as- numbered `passages` (`locked: true` = AI answers quote it today), the- Action Center `action` it belongs to, the `open_suggestions` still- waiting, and `link_targets` (`own_pages`, `sources`): the only URLs a- suggestion may link to.+ numbered `passages` (`locked: true` = AI answers quote it today),+ `published_url` and `published_at` (where and since when the page is+ live; null until then), the Action Center `action` it belongs to, the+ `open_suggestions` still waiting, and `link_targets` (`own_pages`,+ `sources`): the only URLs a suggestion may link to.- **`get_content_sources`** — what the draft draws on over 30 days, asthe Sources tab shows it: its prompts, the AI searches (fan-outs) runfor them, the pages AI cites, Search Console queries, and the@@ -292,8 +293,10 @@ accepts it.version. It skips the editor's Before you publish check (its Trustwarning), so point the person to it with `editor_path` first. A linkedaction's writing task completes once every page the action names has a- ready draft (`action_tasks_done`; 0 until then). A draft `in_review`- waits for a person to mark it ready in the editor *(write)*.+ ready draft (`action_tasks_done`; 0 until then). A draft that's+ already `ready` or `published` comes back as it is, with+ `action_tasks_done: 0`. A draft `in_review` waits for a person to mark+ it ready in the editor *(write)*.**Shopping**@@ -656,17 +659,19 @@ When the user asks how AI describes the brand, why sentiment movedContent Agent is writing it: say so and stop. Report how many werekept and any `dropped`.5. When the user says the draft is done, give them its `editor_path` to- run Before you publish, then offer `set_content_draft_ready` and call- it after they confirm *(write)*. A draft `in_review` is marked ready- by a person in the editor.+ run Before you publish. If they marked it ready there, it's done.+ Otherwise offer `set_content_draft_ready` and call it after they+ confirm *(write)*. A draft `in_review` is marked ready by a person in+ the editor.6. Once the page is live, `get_content_impact` (30 days by default)says whether it paid off: lead with `citations` and `aiVisits`(`cur` vs `prev`), then `promptCounts.lost`. `gscSince` is the firstday of Search Console data (null: none); when it falls after theperiod before began, the Google clicks don't compare. The windows arethe last `days` against the `days` before, not before and after the- page went live: pick the period closest to how long it has been live,- and say so.+ page went live: pick the period closest to how long it has been live+ (`published_at` from `get_content_draft`; for an optimized page, when+ this version went live), and say so.## Formatting principlesdiff --git a/web/src/lib/mcp/content.test.ts b/web/src/lib/mcp/content.test.tsindex 6c6f41804..5f0670cda 100644--- a/web/src/lib/mcp/content.test.ts+++ b/web/src/lib/mcp/content.test.ts@@ -78,6 +78,7 @@ const draftRow = (over = {}) => ({author: 'user',source_url: 'https://acme.example/forecasting',published_url: null,+ published_at: null,body_html: `<h1>Pipeline forecasting</h1><p>${QUOTED}</p><p>Our forecasting is very accurate.</p>`,action_id: 'act-1',prompt_ids: [],@@ -124,6 +125,24 @@ describe('getContentDraftFor', () => {});});+ it('says where and since when the page is live, null until then (#1554 review)', async () => {+ db.rows.content_drafts = draftRow();+ expect(await getContentDraftFor(auth, 'd1')).toMatchObject({+ published_url: null,+ published_at: null,+ });+ db.rows.content_drafts = draftRow({+ status: 'published',+ published_url: 'https://acme.example/forecasting',+ published_at: '2026-10-20T09:30:00Z',+ });+ expect(db.selects.find(([table]) => table === 'content_drafts')?.[1]).toContain('published_at');+ expect(await getContentDraftFor(auth, 'd1')).toMatchObject({+ published_url: 'https://acme.example/forecasting',+ published_at: '2026-10-20T09:30:00Z',+ });+ });+it('reads nothing of another organization’s draft', async () => {await expect(getContentDraftFor(auth, 'd1')).resolves.toBeNull();expect(db.rpcCalls).toEqual([]);diff --git a/web/src/lib/mcp/content.ts b/web/src/lib/mcp/content.tsindex 1cd0f0516..21005e478 100644--- a/web/src/lib/mcp/content.ts+++ b/web/src/lib/mcp/content.ts@@ -38,7 +38,7 @@ import {const LIST_LIMIT = 100;const DRAFT_COLUMNS =- 'id, brand_id, title, status, method, page_type, author, source_url, published_url, body_html, action_id, prompt_ids, updated_at, agent_state, agent_state_at, brands!inner(organization_id, site_type, industry, shopping_mode_enabled), actions(action_no)';+ 'id, brand_id, title, status, method, page_type, author, source_url, published_url, published_at, body_html, action_id, prompt_ids, updated_at, agent_state, agent_state_at, brands!inner(organization_id, site_type, industry, shopping_mode_enabled), actions(action_no)';interface DraftRow {id: string;@@ -51,6 +51,8 @@ interface DraftRow {source_url: string | null;/** Where the page went live (Send to CMS or marked published, 00262), as the Live page tab reads it. */published_url: string | null;+ /** When it went live, set with published_url (00262). */+ published_at: string | null;body_html: string;action_id: string | null;prompt_ids: string[] | null;@@ -189,6 +191,9 @@ export interface McpDraft {page_type: string | null;author: string;source_url: string | null;+ /** Where and since when the page is live (00262): null until it goes live. */+ published_url: string | null;+ published_at: string | null;action: { id: string; number: number | null } | null;editor_path: string;body_html: string;@@ -230,6 +235,8 @@ export async function getContentDraftFor(page_type: draft.page_type,author: draft.author,source_url: draft.source_url,+ published_url: draft.published_url,+ published_at: draft.published_at,action: draft.action_id ? { id: draft.action_id, number: actionNo(draft) } : null,editor_path: contentEditorPath(draft.id),body_html: draft.body_html,diff --git a/web/src/lib/mcp/server.ts b/web/src/lib/mcp/server.tsindex e4fe45ea7..70346c5e3 100644--- a/web/src/lib/mcp/server.ts+++ b/web/src/lib/mcp/server.ts@@ -1579,7 +1579,7 @@ export function createMcpServer(auth: McpAuthContext): McpServer {'get_content_draft',{description:- 'Read one Content Editor draft: its HTML, and the page passage by passage (numbered, as suggest_content_changes refers to them). Passages marked locked are quoted by AI answers today: never suggest changing them. Also the action it belongs to, the agent suggestions still waiting for review, and link_targets: the only URLs suggest_content_changes may link to (own_pages for internal links, sources for outbound links and inline citations).',+ 'Read one Content Editor draft: its HTML, and the page passage by passage (numbered, as suggest_content_changes refers to them). Passages marked locked are quoted by AI answers today: never suggest changing them. Also where and since when the page is live (published_url, published_at; null until then), the action it belongs to, the agent suggestions still waiting for review, and link_targets: the only URLs suggest_content_changes may link to (own_pages for internal links, sources for outbound links and inline citations).',inputSchema: {draft_id: relaxedUuid.describe('Draft UUID, from list_content_drafts.'),},