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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

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,
Behavior5/5

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

Since no annotations are provided, the description carries the full burden of behavioral disclosure. It does this exceptionally well by explaining: 1) This writes to the Migration workflow, 2) New/updated documents may not be immediately visible via Content API, 3) How to read back migrated content before publish, and 4) The dry_run option for validation. This covers critical behavioral aspects including write operations, visibility delays, and safety mechanisms.

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

Conciseness5/5

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

The description is perfectly structured and concise. It starts with the core purpose, then provides 'Important behavior' in bullet points, each addressing critical information. Every sentence earns its place by adding essential context about the tool's behavior, limitations, and usage patterns. No wasted words or redundant information.

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 that this is a write operation with no annotations, 2 parameters (one complex nested object), and an output schema exists, the description provides excellent contextual completeness. It explains the write behavior, visibility constraints, how to work with the migration workflow, and includes safety guidance. The presence of an output schema means the description doesn't need to explain return values, allowing it to focus on behavioral context.

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

Parameters4/5

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

With 0% schema description coverage, the description must compensate for the lack of parameter documentation. It mentions the 'dry_run' parameter and explains its purpose ('to validate payload/endpoint choice without writing'), which adds valuable semantic context. However, it doesn't describe the 'document' parameter or its structure, leaving the agent to rely solely on the schema for understanding this complex nested object.

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 clearly states the tool's purpose: 'Create/update one document in the Prismic Migration API.' It specifies the exact action (create/update), the resource (document), and the target system (Prismic Migration API). This distinguishes it from sibling tools like prismic_get_document (read) and prismic_upsert_documents (plural).

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 this tool versus alternatives. It explains that writes go to the Migration workflow, not directly to the Content API, and specifies how to read back migrated content before publishing (using prismic_get_releases/prismic_get_refs). It also mentions the dry_run parameter for validation without writing, which helps the agent understand when to use this mode.

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