Skip to main content
Glama

Change a document by its link

update_document
Destructive

Writes a new version of a document by its link — e.g. the person asks in the chat to remove something on page 2 — and prints it again: the PDF link, the same edit link (the editor open on it shows the change). The new version replaces the one before. Send the whole new html (and data, if it is a template), changed from what get_document returned, with base_revision: a document the person changed after you read it is refused, so read it again.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "document_id": "<document_id>",
      "base_revision": "<base_revision>"
    },
    "name": "update_document"
  }
}

Input Schema

NameRequiredDescriptionDefault
dataNoThe template's new data. Alone, only for a template (kind "template"); with html, non-empty data makes the document a template. Omitted: the data stays.
htmlNoThe whole new source. Omitted: the source stays (e.g. new data only).
nameNoA new name.
previewNoPictures (PNG) of pages come with the answer, so you can check the layout, fonts and images before giving the links. Default: true.
filenameNoA new PDF file name, kept for its later prints. Default: the name it was printed with (render_pdf filename), else its <title>.
document_idYesThe document_id (or the edit link).
base_revisionYesThe revision you read (get_document, or the last result). Required: a document the person changed after it is refused, never overwritten.
preview_pagesNoWhich pages to see, 1-based; -1 is the last page. Default: page 1 and the last page (a page that spilled over shows there). Up to 4, e.g. [1, 2, -1].

Output Schema

NameRequiredDescriptionDefault
urlYesThe link, valid 24 hours.
markYesWhether the PDF carries the ReflowPDF mark, and why.
bytesYes
guestYesPrinted without an account: the pages carry the ReflowPDF mark.
notesYesFacts about this PDF: how long its link works, its mark, what was not fetched or filled.
pagesYes
paperYesIts paper, e.g. "A4", "Letter", "210 × 99 mm"; empty when unknown.
titleYesThe document's title.
pdfUrlYesThe PDF (the same link as url).
sizeKbYesThe PDF's size in KB.
timingNoThe engine's own parts of it, when it states them: layoutMs (styles, layout and pagination) and writeMs (writing the PDF).
editUrlNoThe document in the ReflowPDF editor: the person edits it there (the link is the document; it lasts while it is used).
previewNoWhich pages came with this answer as pictures (PNG), or why none did.
filenameYes
previewsYesPages as pictures (PNG), kept with the PDF for its day.
renderMsNoHow long the print took on the server, in milliseconds (the engine and its adapter).
revisionNoIts revision: name it to update_document as base_revision.
expiresAtYesWhen the link stops working (ISO 8601).
documentIdNoThe document, for get_document and update_document.
missingFontsNoFont families the document named that no face answered: their text took the next family of its list.
missingVariablesNoTemplate values the data did not have (printed empty).
skippedResourcesNoImages, fonts or style sheets the server could not fetch.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changed
    • addedOutput schema / properties / guest
      Added value: +{
      +  "description": "Printed without an account: the pages carry the ReflowPDF mark.",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / paper
      Added value: +{
      +  "description": "Its paper, e.g. \"A4\", \"Letter\", \"210 × 99 mm\"; empty when unknown.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / pdfUrl
      Added value: +{
      +  "description": "The PDF (the same link as url).",
      +  "type": "string"
      +}
    • addedOutput schema / properties / previews
      Added value: +{
      +  "description": "Pages as pictures (PNG), kept with the PDF for its day.",
      +  "items": {
      +    "properties": {
      +      "height": {
      +        "type": "integer"
      +      },
      +      "page": {
      +        "type": "integer"
      +      },
      +      "url": {
      +        "type": "string"
      +      },
      +      "width": {
      +        "type": "integer"
      +      }
      +    },
      +    "required": [
      +      "page",
      +      "url",
      +      "width",
      +      "height"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / sizeKb
      Added value: +{
      +  "description": "The PDF's size in KB.",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / title
      Added value: +{
      +  "description": "The document's title.",
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "url",
      -  "expiresAt",
      -  "filename",
      -  "pages",
      -  "bytes",
      -  "mark",
      -  "notes"
      -]New value: +[
      +  "url",
      +  "expiresAt",
      +  "filename",
      +  "pages",
      +  "bytes",
      +  "mark",
      +  "notes",
      +  "title",
      +  "pdfUrl",
      +  "sizeKb",
      +  "paper",
      +  "guest",
      +  "previews"
      +]
  2. Changed1 schema field changed
    • addedOutput schema / properties / missingFonts
      Added value: +{
      +  "description": "Font families the document named that no face answered: their text took the next family of its list.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  3. Changed1 schema field changed
    • changedOutput schema / properties / notes / description
      Previous value: -"What to tell the person about this PDF."New value: +"Facts about this PDF: how long its link works, its mark, what was not fetched or filled."
  4. Changed3 schema fields changed
    • changedInput schema / properties / preview / description
      Previous value: -"A picture (PNG) of page 1 comes with the answer, so you can check the layout, fonts and images before giving the links. Default: true."New value: +"Pictures (PNG) of pages come with the answer, so you can check the layout, fonts and images before giving the links. Default: true."
    • addedInput schema / properties / preview_pages
      Added value: +{
      +  "description": "Which pages to see, 1-based; -1 is the last page. Default: page 1 and the last page (a page that spilled over shows there). Up to 4, e.g. [1, 2, -1].",
      +  "items": {
      +    "type": "integer"
      +  },
      +  "maxItems": 4,
      +  "type": "array"
      +}
    • changedOutput schema / properties / preview / description
      Previous value: -"What picture of the PDF came with this answer (page 1, as PNG), or why none did."New value: +"Which pages came with this answer as pictures (PNG), or why none did."
  5. Changed5 schema fields changed
    • changedInput schema / properties / filename / description
      Previous value: -"The PDF file name. Default: the document's name."New value: +"A new PDF file name, kept for its later prints. Default: the name it was printed with (render_pdf filename), else its <title>."
    • addedInput schema / properties / preview
      Added value: +{
      +  "description": "A picture (PNG) of page 1 comes with the answer, so you can check the layout, fonts and images before giving the links. Default: true.",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / preview
      Added value: +{
      +  "description": "What picture of the PDF came with this answer (page 1, as PNG), or why none did.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / renderMs
      Added value: +{
      +  "description": "How long the print took on the server, in milliseconds (the engine and its adapter).",
      +  "type": "integer"
      +}
    • addedOutput schema / properties / timing
      Added value: +{
      +  "description": "The engine's own parts of it, when it states them: layoutMs (styles, layout and pagination) and writeMs (writing the PDF).",
      +  "properties": {
      +    "layoutMs": {
      +      "type": "number"
      +    },
      +    "writeMs": {
      +      "type": "number"
      +    }
      +  },
      +  "type": "object"
      +}
  6. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Beyond the annotations (destructiveHint, idempotentHint=false), it discloses the key behavior that the new version replaces the previous one and that a concurrent edit causes the write to be refused rather than overwrite. It does not spell out permission requirements or failure modes beyond the revision conflict, but the important mutation semantics are covered.

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?

Front-loaded with the action and the returned links, and every clause carries information (replacement semantics, template handling, conflict refusal). The dash-heavy parentheticals make it denser than necessary, which costs it a point.

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

Completeness4/5

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

With an output schema present and full parameter descriptions, the description only needs the mutation and workflow context, which it supplies. The main gap is that error outcomes other than revision conflict (invalid html, wrong kind) are left unaddressed.

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?

Schema coverage is already 100%, so the baseline is 3; the description goes further by explaining the relationship among html, data and base_revision — send the full html as modified from what get_document returned, data only for templates, and base_revision as the revision you read. That orchestration guidance is not derivable from the schema alone.

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 names a specific verb and resource ('Writes a new version of a document by its link'), states the concrete user scenario ('remove something on page 2'), and lists what comes back (PDF link, same edit link). An agent can distinguish it from get_document, which it explicitly names as the source of the prior state.

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

Usage Guidelines4/5

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

It tells the agent when to use it (a person asks to change a document in chat) and gives the prerequisite workflow: read with get_document, edit what it returned, resend with base_revision. It does not explicitly contrast with open_in_editor or render_pdf, so exclusions are implied rather than stated.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.