Skip to content

fix(cms): getPageUrl MCP tool — support draft documents and add draft arg#40

Merged
jhb-dev merged 1 commit into
mainfrom
fix/mcp-getpageurl-draft-access
Jun 28, 2026
Merged

fix(cms): getPageUrl MCP tool — support draft documents and add draft arg#40
jhb-dev merged 1 commit into
mainfrom
fix/mcp-getpageurl-draft-access

Conversation

@jhb-dev

@jhb-dev jhb-dev commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • getPageUrl failed for draft (unpublished) articles with "No ... document with id" error
  • Switched from findByID to find with where: { id, _status: { in: statusFilter } } and draft flag — so drafts are found without bypassing access control
  • overrideAccess stays false (calling user's access is respected)
  • Added draft parameter (default: true) so agents can explicitly query drafts or published-only documents

New tool signature

Param Type Default Description
collection string Page collection slug
id string | number Document ID
draft boolean true Query draft version? false = published only
preview boolean true Return preview URL? false = canonical public URL

Test plan

  • Call with draft article ID + draft: true → returns /preview/... URL
  • Call with draft article ID + draft: false → returns error (not published)
  • Call with published article + preview: false → returns canonical URL

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
website Ignored Ignored Jun 28, 2026 8:42am
website-cms Ignored Ignored Jun 28, 2026 8:42am

Request Review

@jhb-dev
jhb-dev force-pushed the fix/mcp-getpageurl-draft-access branch 2 times, most recently from 0d39f7e to 6efdd7a Compare June 28, 2026 08:29
@jhb-dev jhb-dev changed the title fix(cms): allow getPageUrl MCP tool to access draft documents fix(cms): getPageUrl MCP tool — support draft documents and add draft arg Jun 28, 2026
Set overrideAccess: true so the MCP tool can resolve URLs for draft
articles that are not yet publicly accessible.

Co-Authored-By: JHB-Claw <info@jhb.software>
@jhb-dev
jhb-dev force-pushed the fix/mcp-getpageurl-draft-access branch from 6efdd7a to 3ab686b Compare June 28, 2026 08:42
@jhb-dev
jhb-dev merged commit 97c80f7 into main Jun 28, 2026
16 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.

1 participant