prismic_upsert_document
Create or update a document in Prismic's Migration API workflow for content management and release preparation.
Instructions
Create/update one document in the Prismic Migration API.
Important behavior:
This writes to the Migration workflow (Migration UI/release flow).
New/updated documents may not be visible via Content API master reads immediately (or at all) until they are included in the readable release flow/published in Prismic.
To read back migrated content before publish, fetch a release ref via
prismic_get_releases/prismic_get_refs, then query read tools with thatref(and providePRISMIC_CONTENT_API_TOKENwhen required).Use
dry_run=trueto validate payload/endpoint choice without writing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document | Yes | ||
| dry_run | No |
Implementation Reference
- prismic_content_mcp/server.py:442-463 (handler)The handler function that executes the logic for 'prismic_upsert_document', which performs a document upsert in the Migration API, optionally performing a dry run.
async def handle_prismic_upsert_document( *, document: DocumentWrite, dry_run: bool = False, service_factory: ServiceFactory = _build_service, ) -> dict[str, Any]: """Create or update a single document in the Migration API.""" async with service_factory(require_write_credentials=True) as service: if dry_run: plan = service.plan_upsert(document) return { "id": plan["id"], "status": plan["status"], "dry_run": True, "would_call": { "method": plan["method"], "endpoint": plan["endpoint"], }, } return await service.upsert_document(document) - prismic_content_mcp/server.py:815-834 (registration)The MCP tool registration for 'prismic_upsert_document', which delegates to the 'handle_prismic_upsert_document' handler.
@server.tool(name="prismic_upsert_document") async def prismic_upsert_document( document: DocumentWrite, dry_run: bool = False, ) -> dict[str, Any]: """Create/update one document in the Prismic Migration API. Important behavior: - This writes to the Migration workflow (Migration UI/release flow). - New/updated documents may not be visible via Content API master reads immediately (or at all) until they are included in the readable release flow/published in Prismic. - To read back migrated content before publish, fetch a release ref via `prismic_get_releases`/`prismic_get_refs`, then query read tools with that `ref` (and provide `PRISMIC_CONTENT_API_TOKEN` when required). - Use `dry_run=true` to validate payload/endpoint choice without writing. """ return await handle_prismic_upsert_document( document=document,