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:
Call
prismic_get_refsand capture themasterref.Call
prismic_get_document(..., ref=<master_ref>).Call
prismic_get_document(..., ref=<release_ref>)as needed.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_documentswhen you already have an exact id or type+uid target.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | ||
| type | No | ||
| uid | No | ||
| lang | No | ||
| ref | No |
Implementation Reference
- prismic_content_mcp/server.py:371-398 (handler)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, } - prismic_content_mcp/server.py:736-764 (registration)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,