Skip to main content
Glama

write_pdf

Create a PDF at path from Markdown content, or write an edited copy of the PDF at path to a new outputPath with ordered content operations: delete {pageIndexes:[0,-1]}, insert {pageIndex:1,markdown:"..."} or {pageIndex:1,sourcePdfPath:"..."} (negative indices count from the end). Renders CSS, tables, Unicode and local images in sandboxed Chromium; options.css and options.pdf_options (format, landscape, margin, header/footer) set the page, default A4. Never overwrites an existing file; remote assets and scripts are refused.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "write_pdf"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNo
pagesNo
formatNo
marginNo
contentNo
optionsNo
deviceIdNoComputer name or id
fontPathNo
fontSizeNo
pageSizeNo
outputPathNo
workSessionIdNoFrom create_work_session

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • changedInput schema / properties / content / anyOf
      Previous value: -[
      -  {
      -    "maxLength": 500000,
      -    "type": "string"
      -  },
      -  {
      -    "items": {
      -      "oneOf": [
      -        {
      -          "properties": {
      -            "pageIndexes": {
      -              "items": {
      -                "type": "integer"
      -              },
      -              "maxItems": 1000,
      -              "type": "array"
      -            },
      -            "type": {
      -              "const": "delete",
      -              "type": "string"
      -            }
      -          },
      -          "required": [
      -            "type",
      -            "pageIndexes"
      -          ],
      -          "type": "object"
      -        },
      -        {
      -          "properties": {
      -            "markdown": {
      -              "maxLength": 500000,
      -              "type": "string"
      -            },
      -            "pageIndex": {
      -              "maximum": 500,
      -              "minimum": -500,
      -              "type": "integer"
      -            },
      -            "pdfOptions": {
      -              "additionalProperties": {},
      -              "propertyNames": {
      -                "type": "string"
      -              },
      -              "type": "object"
      -            },
      -            "sourcePdfPath": {
      -              "type": "string"
      -            },
      -            "type": {
      -              "const": "insert",
      -              "type": "string"
      -            }
      -          },
      -          "required": [
      -            "type",
      -            "pageIndex"
      -          ],
      -          "type": "object"
      -        }
      -      ]
      -    },
      -    "maxItems": 100,
      -    "minItems": 1,
      -    "type": "array"
      -  }
      -]New value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "oneOf": [
      +        {
      +          "properties": {
      +            "pageIndexes": {
      +              "items": {
      +                "type": "integer"
      +              },
      +              "type": "array"
      +            },
      +            "type": {
      +              "const": "delete",
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "type",
      +            "pageIndexes"
      +          ],
      +          "type": "object"
      +        },
      +        {
      +          "properties": {
      +            "markdown": {
      +              "type": "string"
      +            },
      +            "pageIndex": {
      +              "maximum": 500,
      +              "minimum": -500,
      +              "type": "integer"
      +            },
      +            "pdfOptions": {
      +              "additionalProperties": {},
      +              "propertyNames": {
      +                "type": "string"
      +              },
      +              "type": "object"
      +            },
      +            "sourcePdfPath": {
      +              "type": "string"
      +            },
      +            "type": {
      +              "const": "insert",
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "type",
      +            "pageIndex"
      +          ],
      +          "type": "object"
      +        }
      +      ]
      +    },
      +    "type": "array"
      +  }
      +]
    • changedInput schema / properties / deviceId / description
      Previous value: -"Computer name or id; optional with one computer or a default"New value: +"Computer name or id"
    • removedInput schema / properties / pages / items / maxLength
      Removed value: -100000
    • removedInput schema / properties / pages / maxItems
      Removed value: -200
    • removedInput schema / properties / pages / minItems
      Removed value: -1
  2. Changed2 schema fields changed
    • changedInput schema / properties / deviceId / description
      Previous value: -"Computer name or id from list_devices. Optional with one computer online or a default set."New value: +"Computer name or id; optional with one computer or a default"
    • changedInput schema / properties / workSessionId / description
      Previous value: -"Work session from create_work_session. Pass the same ID on every call in this conversation; omit for legacy unscoped work."New value: +"From create_work_session"
  3. Changed1 schema field changed
    • addedInput schema / properties / workSessionId
      Added value: +{
      +  "description": "Work session from create_work_session. Pass the same ID on every call in this conversation; omit for legacy unscoped work.",
      +  "format": "uuid",
      +  "type": "string"
      +}
  4. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Annotations only say it is a non-read-only, non-destructive, closed-world write; the description adds substantive behavior beyond that: sandboxed Chromium rendering, default A4 page size, CSS/table/Unicode/local-image support, and two hard constraints ("Never overwrites an existing file; remote assets and scripts are refused"). These constraints materially change how an agent should call it and cannot be inferred from any structured field.

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?

Two sentences, front-loaded with the primary create action before the edit path, and the operation grammar is compact inline rather than a bullet dump. Nearly every clause carries distinct information (indices, rendering engine, defaults, refusal policy) with no filler.

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

Completeness3/5

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

For a 12-parameter tool with nested objects, low schema coverage and no output schema, the description covers the conceptually hard parts but omits what most parameters accept, including the `pages` array and the ambiguity between top-level `format`/`margin`/`pageSize` and their options.pdf_options counterparts. An agent could still call it, but only by reading the schema carefully and guessing at several fields.

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

Parameters3/5

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

Schema description coverage is only 17% across 12 parameters, so the description must compensate; it does well for the hardest part (`content` operation objects, `outputPath`, negative index semantics) but leaves `pages`, the top-level `format` enum (text/markdown/html), `pageSize`, `fontPath`, `fontSize`, `deviceId` and `workSessionId` unexplained. Worse, it attributes `format`, `landscape` and `margin` to options.pdf_options while the schema exposes `format`/`margin`/`pageSize` as top-level properties, which can mislead about where to put them.

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+resource ("Create a PDF at path from Markdown content") and a second distinct mode ("write an edited copy of the PDF at path to a new outputPath"), and enumerates the operation grammar (delete/insert with pageIndexes/pageIndex). An agent can distinguish this from write_file or edit_docx without opening the schema.

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 clearly states the two usage modes and the operation shapes with a worked example ("delete {pageIndexes:[0,-1]}, insert {pageIndex:1,markdown:\"...\"}") so the agent knows which form the `content` parameter takes. It does not name any alternative tool or state exclusions, so the bar for a 5 is not met.

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.

Resources