FREEFirst project with us? Your landing page design is on the house.See the offer

Chapter 5 of 6

AI page building with guardrails

What to let an AI change, how to limit its access through the Sanity MCP, what to write in its instructions, and how a person reviews every page before it goes live.

6 min readUpdated 2026-11-07
All chaptersChapter 5 of 6
  1. 01Why sections, not pages
  2. 02Planning the library
  3. 03Sanity schemas for sections
  4. 04Studio for marketers
  5. 05AI page building with guardrails
  6. 06Testing and governance

The short answer

Let AI draft pages from your library, and have a person publish them. Connect it through the Sanity MCP, limit its access at the permission level, give it written instructions, check its work with your own validation step, and review every page on a staging link. Prompts alone are not a guardrail. Permissions and structure are.

For the case for this approach, read AI page builder for your team. For the content model it depends on, read Structuring Sanity content for AI. This chapter is about how to set the limits.

What the finished setup looks like

A section library in Sanity, AI connected to it through the Sanity MCP, and marketing skills written for it. The team sends the content. The AI picks the right sections from the library, builds the page and shares a staging link. If the team likes it, it goes live. If something needs to change, they say what, and it gets changed.

The rest of this chapter is general advice for setting up your own. It is not a description of any client's settings.

What the MCP gives an AI

The Sanity MCP server is hosted by Sanity at mcp.sanity.io. It lets AI tools work with your project through the Model Context Protocol. Its tools change over time, so check the current docs. When we read them, they fell into these groups:

AreaSample toolsRisk
Readquery_documents, get_schemaLow on public content, higher if your dataset holds private data
Draftcreate_documents, patch_documentsMedium. Patches go to the draft or release version, not to published content. Watch types with liveEdit on: the docs say create can make published documents for those
Publishpublish_documents, unpublish_documentsHigh. Changes the live site at the next build
Schemadeploy_schema, schema_fields_patchHigh. Changes the library itself

The takeaway: the server can do far more than draft. If you connect it with broad access and only ask the AI nicely to stay in drafts, the AI still has a publish button.

What the AI may and may not change

Write this table for your own team, and agree it before connecting anything. Here is a starting point.

ThingAIPerson
Choose sections from the libraryYes, within recipesReviews
Choose variants from fixed listsYesReviews
Fill in text fields, from the briefYesReviews every word
Select existing imagesYes, if they fitReviews
Point to existing facts by referenceYesChecks the right one was used
Create or edit prices, clients, quotes, statsNoYes, in their own documents
Change a published page in placeDraft onlyReviews the change, then publishes
Publish or unpublishNoYes
Change schemas, add sectionsNoDeveloper, through Git
Change redirects, tracking, codeNoDeveloper

Decision rule If a wrong value would be a false claim about your company, the AI may only point to it, never type it. If a mistake would reach visitors with no person seeing it first, the AI may not do it.

Enforce the limits with access

Now make the table real. The MCP docs say OAuth is the default, and that with an API token, tool calls are limited to that token's role and permissions. They also say a personal token shares your own role. So if an administrator connects the AI under their own account, assume the AI has the same reach.

  • Use a dedicated token for the AI, so you can remove its access without touching anyone else's.
  • Pick the narrowest role that can write drafts. Sanity's Contributor role can write but not publish, on the plans that include it. Sanity's token docs describe tokens holding role memberships, so check in the management console which role yours holds.
  • Test it. Ask the AI to publish a test draft, on a test dataset first, and confirm it is refused. Do the same for a schema change. Do not assume, try it.
  • Use a separate dataset for your pilot, if your plan allows, so early mistakes cannot touch live content.
  • Check your AI client. Some let you approve or switch off single tools. Use that as a second layer, not the only one.
  • Use one token per application, as Sanity's docs advise, and set an expiry.

Write the skills

"Skills" here means written instructions the AI reads before it works. Yours should be short enough to read in one sitting, and specific enough to act on. Include:

  • Library guide. Each section: its job, when to use it, when not to. Copy this from your usage notes.
  • Recipes. The allowed orders from chapter 2, by page type.
  • Voice. Your tone, your banned words, and examples of good copy from your own site.
  • Fact rules. Use references for facts. Use only what is in the brief. If something is missing, leave a note instead of guessing.
  • Process. Read the schema first, save as a draft, run the checks, then send the staging link with a list of open questions.

Then test with bad briefs as well as good ones. Give it a brief with no proof points and see if it invents some. Give it a brief asking for a section you do not have and see what it does. It should ask, or flag it.

Do not rely on Studio validation

This is the one surprise that catches people. Sanity's validation docs say schema rules only run in the Studio, so API writes are not checked. The MCP docs say create and patch use looser validation, that publishing runs stricter checks, and that custom validation rules are skipped through MCP.

So your length limits and custom rules may not stop an AI draft. Add your own check before anyone reviews the page. Sanity's CLI has sanity documents validate, which checks a dataset's documents against your Studio schema. A small script can check the rest, such as approved recipes, and whether references resolve. Then render the page: your Astro build fails on unknown types, and a staging build shows the page as a visitor would see it.

Review before publish

Every page gets a person's review on a staging link, marked noindex. See staging if the idea is new. The reviewer checks:

  • Every claim is true, and every number has a source.
  • Names, prices and quotes come from references, not typed text.
  • Sections follow a recipe, and the order makes sense for this reader.
  • The copy sounds like you, and it says something specific.
  • The page works on a phone, with the longest headings.
  • Title, description, slug, headings and alt text are all set.
  • Links and forms work, and any tracking fires.
  • The page does not compete with one you already have.

Done when The AI has been refused a publish in a test, a bad brief produced a question and not an invention, and a named person has reviewed and published one real page.

Takeaways

What to remember from chapter 5.

  • AI drafts, a person publishes. Enforce that with permissions, not prompts.
  • Write a table of what the AI may and may not change, and agree it first.
  • Facts are references. The AI may point to them, never type them.
  • Custom validation is skipped through MCP, so add your own check.
  • Test the limits: confirm a publish attempt is refused.

Your turn

Let's kook
what you krave.

Hi Kookies, I need a built on . I'd love to launch . Reach me at
or book a callSent. We reply within one working day.