Skip to main content
Glama

Make a PDF from JPG and PNG images

pdf_image_to_pdf
DestructiveIdempotent

Convert JPG and PNG images into a single PDF, one image per page in the order given. Choose fit-to-image or A4/Letter pages with margins; phone photos are rotated upright.

Instructions

Make a PDF from JPG and PNG images: one image per page, in the order given. Each image is a local path (.png, .jpg, .jpeg), an https:// URL or a data:image/jpeg;base64,… or data:image/png;base64,… URI; the type is detected from the bytes, not the name. At most 100 images, each up to 4 MB, 4.5 MB in total. page_size "fit" (default) makes each page the image's own size at 72 dpi (1 px = 1 pt; pages longer than 5,000 pt on a side are scaled down, tiny images are enlarged to a 3 pt minimum); "a4" or "letter" put the image on a standard page, centred, shrunk to fit inside the margin and never enlarged. orientation (auto, portrait, landscape; default auto picks per image) applies to a4 and letter only. margin is 0-200 pt (default 0 for fit, where the page grows by the margin on every side; 36 for a4 and letter). A JPEG's EXIF orientation is applied, so phone photos come out upright. PNG: 8-bit and 16-bit, palette, grey, interlaced and transparent files work (transparency is kept); animated PNGs, other formats (GIF, WebP, HEIC, TIFF, SVG) and PDFs are rejected. JPEG: baseline and progressive, grey, RGB and Adobe-style CMYK. Very large images fail with image_too_large (PNG over 10 megapixels or a memory estimate; JPEG over 250 megapixels), and many large PNGs in one call with images_too_large_together. Deterministic: the same images give byte-identical output. To join images with existing PDFs use pdf_merge, which also accepts images. Returns the result written to output_path, or inline as an application/pdf resource when output_path is omitted (results over 7 MB are never returned inline: pass output_path); an existing file at output_path is overwritten. The source is never modified.

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": {
      "image_paths": "<image_paths>"
    },
    "name": "pdf_image_to_pdf"
  }
}

Input Schema

NameRequiredDescriptionDefault
marginNoPoints, 0-200. Default 0 for fit, 36 for a4 and letter.
page_sizeNofit (default): page = image size. a4 or letter: standard page, image centred and shrunk to fit.
image_pathsYesIn order, one page each: a local path (.png, .jpg, .jpeg) inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:image/jpeg;base64,… / data:image/png;base64,… URI.
orientationNoa4 and letter only; auto (default) picks portrait or landscape per image.
output_pathNoPath of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Omit when running remotely: the PDF is then returned inline as an application/pdf resource for the client to save.

Output Schema

NameRequiredDescriptionDefault
bytesYesSize of the produced PDF in bytes
output_pathNoAbsolute path written, when output_path was supplied
resource_uriNopdfops:// uri of the inline application/pdf resource, when output_path was omitted

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.5.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare destructiveHint and openWorldHint; the description corroborates by stating an existing file at output_path is overwritten and that remote URLs are fetched, and adds real value with hard limits (100 images, 4 MB each, 4.5 MB total), named error codes (image_too_large, images_too_large_together), determinism guarantees, and 'the source is never modified.' The only missing trait is any auth/network-failure behavior for https fetches.

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?

Purpose and ordering rule are front-loaded, and nearly every sentence carries operational detail. It is a dense single block, though; splitting the format-support and limit clauses into short bulleted runs would improve scannability without dropping content.

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?

For a 5-parameter tool with an output schema, the description covers input acceptance, size/format limits, failure modes, return path vs inline resource, and overwrite semantics. Nothing an agent needs to invoke it correctly is left implicit.

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 100%, so the baseline is 3; the description exceeds that by adding the 'fit' mechanics (72 dpi, 1 px = 1 pt, 5,000 pt downscale cap, 3 pt minimum enlargement) and by clarifying that orientation applies only to a4/letter and that margin defaults differ per page_size. It repeats a few schema facts (margin range, overwrite behavior), which keeps it off a 5.

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?

Opens with a specific verb and resource ('Make a PDF from JPG and PNG images: one image per page, in the order given') and immediately scopes the input types. It is clearly distinguishable from siblings like pdf_html_to_pdf, pdf_text_to_pdf, and pdf_merge without opening any schema.

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?

Explicitly routes the agent: 'To join images with existing PDFs use pdf_merge, which also accepts images,' and states the condition for omitting output_path (inline return, 7 MB cap). It also names what is rejected (GIF, WebP, HEIC, TIFF, SVG, PDFs), which is genuine when-not-to-use guidance.

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