Skip to main content
Glama

prismic_get_document

Retrieve a specific Prismic document by ID or type+UID, optionally specifying a preview or release version for content management workflows.

Instructions

Get one document by id or by type+uid with optional explicit ref.

Use ref to read a specific preview/release version pointer. Depending on repository API visibility settings, non-master refs may require PRISMIC_CONTENT_API_TOKEN. The document payload has no explicit status field (for example published/draft/in-release). To determine publish state on master, use this sequence:

  1. Call prismic_get_refs and capture the master ref.

  2. Call prismic_get_document(..., ref=<master_ref>).

  3. Call prismic_get_document(..., ref=<release_ref>) as needed.

  4. Interpret results:

    • exists on master: published on master

    • missing on master but exists on release ref: not published on master (release-only content) Prefer this over prismic_get_documents when you already have an exact id or type+uid target.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNo
typeNo
uidNo
langNo
refNo

Implementation Reference

  • The core handler logic for retrieving a Prismic document, either by ID or by type/UID.
    async def handle_prismic_get_document(
        *,
        id: str | None = None,
        type: str | None = None,
        uid: str | None = None,
        lang: str | None = None,
        ref: str | None = None,
        service_factory: ServiceFactory = _build_service,
    ) -> dict[str, Any]:
        """Fetch a single document by id or by (type, uid, lang) with optional ref."""
    
        async with service_factory() as service:
            if id:
                document = await service.get_document_by_id(document_id=id, lang=lang, ref=ref)
            elif type and uid:
                document = await service.get_document_by_uid(
                    document_type=type,
                    uid=uid,
                    lang=lang,
                    ref=ref,
                )
            else:
                raise ValueError("Provide id OR (type and uid)")
    
        return {
            "document": document.model_dump(mode="python") if document else None,
        }
  • The MCP tool registration for `prismic_get_document`, which routes the request to the `handle_prismic_get_document` function.
    @server.tool(name="prismic_get_document")
    async def prismic_get_document(
        id: str | None = None,
        type: str | None = None,
        uid: str | None = None,
        lang: str | None = None,
        ref: str | None = None,
    ) -> dict[str, Any]:
        """Get one document by id or by type+uid with optional explicit ref.
    
        Use `ref` to read a specific preview/release version pointer. Depending
        on repository API visibility settings, non-master refs may require
        `PRISMIC_CONTENT_API_TOKEN`.
        The document payload has no explicit `status` field (for example
        published/draft/in-release). To determine publish state on master, use
        this sequence:
        1) Call `prismic_get_refs` and capture the `master` ref.
        2) Call `prismic_get_document(..., ref=<master_ref>)`.
        3) Call `prismic_get_document(..., ref=<release_ref>)` as needed.
        4) Interpret results:
           - exists on master: published on master
           - missing on master but exists on release ref: not published on master
             (release-only content)
        Prefer this over `prismic_get_documents` when you already have an exact
        id or type+uid target.
        """
    
        return await handle_prismic_get_document(
            id=id,

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