Skip to main content
Glama

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 that ref (and provide PRISMIC_CONTENT_API_TOKEN when required).

  • Use dry_run=true to validate payload/endpoint choice without writing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentYes
dry_runNo

Implementation Reference

  • 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)
  • 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,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rahulpowar/prismic-content-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server