Skip to main content
Glama

Extract pages into one PDF

extract_pages
Idempotent

Keep an arbitrary set of 0-based PDF pages in a chosen order and save them as one fresh PDF, with optional encryption.

Instructions

Keep an arbitrary pages[] subset (0-based, in the given order) in ONE fresh PDF. Same page-tree caveats as merge_pdfs (signatures/AcroForm/XMP dropped; boxes kept; URI links unless dropAnnotations). Encrypted sources: password; output unencrypted unless encrypt. Need several documents? Use split_pdf.

Input Schema

NameRequiredDescriptionDefault
pagesYes0-based page indices to keep, in output order. Duplicates and out-of-range indices are rejected.
encryptNoRe-encrypt the output (Standard Security Handler; AES-128 default or AES-256; RC4 never emitted).
passwordNoPassword (user or owner) of an encrypted source. Never logged or echoed.
pdfBase64YesBase64-encoded source PDF. Pass `password` for an encrypted source.
outputModeNo'base64' (default) returns the PDF inline; 'file' writes it inside the PDFNATIVE_MCP_OUTPUT_DIR sandbox (SECURITY_VIOLATION when the sandbox is not configured).base64
outputPathNoRequired when outputMode='file'. Relative path inside the sandbox; must end with .pdf (no absolute paths, no '..').
dropAnnotationsNoWhen true, drop ALL annotations. Default keeps self-contained URI link annotations.
maxOutputSizeBytesNoMaximum size, in bytes, of the produced PDF. Defaults to 268435456 (256 MiB).

Output Schema

NameRequiredDescriptionDefault
urlNoPublic URL of the file (file mode, only when PDFNATIVE_MCP_OUTPUT_BASE_URL is set): base URL + sandbox-relative path, percent-encoded.
modeYes
summaryNoTool-specific summary, when produced.
filePathNoSandboxed absolute path (file mode).
sizeBytesYes
diagnosticsNoEngine diagnostics (when includeDiagnostics=true).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.8.0
    • changedOutput schema / description
      Previous value: -"Result of a PDF-producing tool. base64 mode: the PDF arrives as an embedded `resource` content block (not duplicated here); file mode: `filePath`."New value: +"Result of a PDF-producing tool. base64 mode: the PDF arrives as an embedded `resource` content block (not duplicated here); file mode: `filePath` (and `url` when the operator maps the sandbox to a public base URL)."
    • addedOutput schema / properties / url
      Added value: +{
      +  "description": "Public URL of the file (file mode, only when PDFNATIVE_MCP_OUTPUT_BASE_URL is set): base URL + sandbox-relative path, percent-encoded.",
      +  "type": "string"
      +}
  2. Changed1 schema field changedv1.6.2
    • changedOutput schema / properties / diagnostics / description
      Previous value: -"PDF/A diagnostics (when includeDiagnostics=true)."New value: +"Engine diagnostics (when includeDiagnostics=true)."
  3. Added
  4. Removedv1.6.0
  5. Addedv1.2.2

TDQS

A4.4/5.0
Behavior5/5

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

Annotations only say readOnly=false, destructive=false, idempotent=true; the description goes well beyond them by disclosing that signatures/AcroForm/XMP are dropped, boxes are kept, URI link annotations survive unless dropAnnotations, and the output is unencrypted by default. These are exactly the lossy side effects an agent needs before committing a mutation.

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?

Three tight sentences, front-loaded with the core operation, then caveats, then alternative routing. No filler, and the parenthetical detail is dense rather than padded.

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?

For an 8-parameter mutation tool with a nested encrypt object and an output schema, the description covers the important behavior (lossy conversion, encryption defaults, sandbox-free base64 default). The one weakness is the 'Same page-tree caveats as merge_pdfs' cross-reference, which forces reliance on another tool's description even though the caveats are partially enumerated inline.

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 100%, so the schema already documents pages, password, encrypt, dropAnnotations, outputMode and maxOutputSizeBytes in detail. The description's mentions of `pages`, `password`, and `encrypt` largely restate that, adding no syntax or constraint beyond the schema's existing notes. Baseline 3 is appropriate.

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 first sentence states a specific verb-plus-resource with scope: keep an arbitrary `pages[]` subset (0-based, in the given order) in ONE fresh PDF. That immediately distinguishes it from merge_pdfs (combining documents) and split_pdf (producing several files), so an agent can pick it without opening a 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 gives clear routing context: encrypted sources require `password`, output stays unencrypted unless `encrypt` is supplied, and 'Need several documents? Use split_pdf' names an alternative with its selecting condition. It does not explicitly state when NOT to use it relative to merge_pdfs or inspect_pdf, but the positive guidance is strong.

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