Skip to main content
Glama

prismic_get_documents

Retrieve and filter documents from Prismic CMS using predicates, sorting, and pagination to manage content efficiently.

Instructions

List documents with optional Prismic predicate filtering.

Use ref to read from an explicit Prismic content ref (for example preview/draft refs). When omitted, master ref is used. Depending on repository API visibility settings, reading non-master refs may require PRISMIC_CONTENT_API_TOKEN. Use q for explicit Content API predicates (for example [[at(document.tags,"news")]]). type is a convenience shortcut for [[at(document.type,"<type>")]] and is merged into q. Use orderings for native Content API sort clauses (for example [document.first_publication_date desc]). Use routes for Content API route resolvers to populate the url field (for example [{"type":"page","path":"/:uid"}]). Note: there is no documented Content API q predicate for "published status". A release ref query returns a version snapshot, not only release-delta documents. Efficiency tips:

  • For large scans: call prismic_get_refs once and pass ref explicitly.

  • For counts/existence checks: set page_size=1 and read total_results.

  • Only pass routes when you need populated url fields.

  • Paginate with page + next_page for full exports. Codex js_repl tip: codex.tool(...) wraps tool output; read payload from result.Ok.structuredContent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNo
langNo
refNo
pageNo
page_sizeNo
qNo
orderingsNo
routesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core logic function 'handle_prismic_get_documents' that processes the Prismic API requests.
    async def handle_prismic_get_documents(
        *,
        type: str | None = None,
        lang: str | None = None,
        ref: str | None = None,
        page: int = 1,
        page_size: int = 20,
        q: Any | None = None,
        orderings: str | None = None,
        routes: Any | None = None,
        service_factory: ServiceFactory = _build_service,
    ) -> dict[str, Any]:
        """Read documents from the Prismic Content API.
    
        Query behavior:
        - `ref` overrides the default master ref resolution (useful for previews/drafts).
        - `q` is passed directly to the Content API `q` parameter.
          Treat `q` as trusted input only (do not forward untrusted prompt text).
        - If `PRISMIC_DISABLE_RAW_Q=1`, raw `q` is rejected and only server-built
          predicates (for example via `type`) are allowed.
        - `orderings` is passed directly to the Content API `orderings` parameter.
        - `routes` is passed to the Content API `routes` parameter (route resolvers).
        - `type` is a convenience mapping to `[[at(document.type,"<type>")]]`.
        - If both are provided, the type predicate is prepended to `q`.
    
        Effective merge behavior:
        - only `type`: q => [type_predicate]
        - only `q`: q => q (unchanged)
        - `type` + list q: q => [type_predicate, *q]
        - `type` + scalar q: q => [type_predicate, q]
        """
    
        async with service_factory() as service:
            result = await service.get_documents(
                document_type=type,
                lang=lang,
                ref=ref,
                page=page,
                page_size=page_size,
                q=q,
  • The tool registration definition 'prismic_get_documents' that exposes the tool to the MCP server.
    @server.tool(name="prismic_get_documents")
    async def prismic_get_documents(
        type: str | None = None,
        lang: str | None = None,
        ref: str | None = None,
        page: int = 1,
        page_size: int = 20,
        q: Any | None = None,
        orderings: str | None = None,
        routes: Any | None = None,
    ) -> dict[str, Any]:
        """List documents with optional Prismic predicate filtering.
    
        Use `ref` to read from an explicit Prismic content ref (for example
        preview/draft refs). When omitted, master ref is used.
        Depending on repository API visibility settings, reading non-master refs
        may require `PRISMIC_CONTENT_API_TOKEN`.
        Use `q` for explicit Content API predicates (for example
        `[[at(document.tags,"news")]]`). `type` is a convenience shortcut
        for `[[at(document.type,"<type>")]]` and is merged into `q`.
        Use `orderings` for native Content API sort clauses (for example
        `[document.first_publication_date desc]`).
        Use `routes` for Content API route resolvers to populate the `url` field
        (for example `[{"type":"page","path":"/:uid"}]`).
        Note: there is no documented Content API `q` predicate for "published
        status". A release `ref` query returns a version snapshot, not only
        release-delta documents.
        Efficiency tips:
        - For large scans: call `prismic_get_refs` once and pass `ref` explicitly.
        - For counts/existence checks: set `page_size=1` and read `total_results`.
        - Only pass `routes` when you need populated `url` fields.
        - Paginate with `page` + `next_page` for full exports.
        Codex js_repl tip: `codex.tool(...)` wraps tool output; read payload from
        `result.Ok.structuredContent`.
        """
        return await handle_prismic_get_documents(
            type=type,
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well: it explains authentication needs ('may require PRISMIC_CONTENT_API_TOKEN'), efficiency considerations, pagination behavior, and important limitations ('no documented Content API q predicate for published status'). It doesn't cover rate limits or error handling, but provides substantial operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections: parameter explanations, important notes, efficiency tips, and implementation guidance. While comprehensive, some sentences could be more concise (e.g., the Codex js_repl tip feels slightly out of place). Overall, most content earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (8 parameters, 0% schema coverage, no annotations) and presence of an output schema, the description is remarkably complete. It covers all parameters, provides operational context, efficiency tips, sibling tool relationships, authentication considerations, and implementation notes. The output schema existence means return values don't need explanation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage for 8 parameters, the description fully compensates by explaining every parameter's purpose: ref (content ref selection), q (predicate filtering), type (convenience shortcut), orderings (sorting), routes (URL population), page/page_size (pagination). It provides concrete examples and usage patterns for each.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description starts with 'List documents with optional Prismic predicate filtering' - a specific verb ('List') and resource ('documents') with clear scope ('Prismic predicate filtering'). It distinguishes from siblings like prismic_get_document (singular) and prismic_upsert_document (write operation).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use alternatives: 'call prismic_get_refs once and pass ref explicitly' for large scans, and mentions sibling tools like prismic_get_refs. It also gives clear context about when to use certain parameters like 'Only pass routes when you need populated url fields.'

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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