Skip to main content
Glama

Encrypt / re-secure a PDF

encrypt_pdf

Encrypt an existing PDF with AES-128 or AES-256, set owner/user passwords, restrict printing, copying, modifying, and text extraction. Rotate a password by passing the current one.

Instructions

Encrypt an existing PDF with the Standard Security Handler: AES-128 (default) or AES-256; RC4 is never emitted. ownerPassword required; optional userPassword (open password), permissions { print, copy, modify, extractText }. Rotate the password of an already-encrypted source by passing its current password. CAVEAT: the page tree is rebuilt — signatures and AcroForm are DROPPED, only URI links kept; encrypt BEFORE signing. Never cached.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
passwordNoCurrent password of an already-encrypted source (enables password rotation). Omit for an unencrypted source.
algorithmNoaes128 (V4/R4, widest compatibility) or aes256 (V5/R6).aes128
pdfBase64YesBase64-encoded source PDF to encrypt. NOTE: existing signatures and AcroForm are dropped (page-tree rebuild).
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.
permissionsNoPermission flags; each defaults to allowed.
userPasswordNoOpen password; omitted/empty = opens without a prompt.
ownerPasswordYesOwner password (full access).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
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. 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)."
  2. Changed9 schema fields changed
    • changedInput schema / properties / algorithm / description
      Previous value: -"Content cipher: aes128 (V4/R4, widest compatibility) or aes256 (V5/R6, strongest)."New value: +"aes128 (V4/R4, widest compatibility) or aes256 (V5/R6)."
    • addedInput schema / properties / outputMode / description
      Added value: +"'base64' (default) returns the PDF inline; 'file' writes it inside the PDFNATIVE_MCP_OUTPUT_DIR sandbox (SECURITY_VIOLATION when the sandbox is not configured)."
    • changedInput schema / properties / ownerPassword / description
      Previous value: -"Owner password (required, non-empty). Controls permissions and full access."New value: +"Owner password (full access)."
    • changedInput schema / properties / permissions / description
      Previous value: -"Access permission flags (enforced by conforming readers). Each defaults to allowed when omitted."New value: +"Permission flags; each defaults to allowed."
    • changedInput schema / properties / userPassword / description
      Previous value: -"User (open) password. Omitted or empty string means the document opens without a password prompt."New value: +"Open password; omitted/empty = opens without a prompt."
    • changedOutput schema / description
      Previous value: -"Structured result of a PDF-producing tool. In base64 mode the PDF bytes are delivered out-of-band as an embedded `resource` content block (data: URI), NOT duplicated here, to keep responses token-frugal. In file mode `filePath` is the sandboxed absolute path."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`."
    • addedOutput schema / properties / diagnostics
      Added value: +{
      +  "description": "PDF/A diagnostics (when includeDiagnostics=true).",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "code": {
      +        "type": "string"
      +      },
      +      "message": {
      +        "type": "string"
      +      },
      +      "severity": {
      +        "enum": [
      +          "warning"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "code",
      +      "message",
      +      "severity"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / filePath / description
      Previous value: -"Absolute sandboxed file path (when mode='file')."New value: +"Sandboxed absolute path (file mode)."
    • addedOutput schema / properties / summary
      Added value: +{
      +  "additionalProperties": true,
      +  "description": "Tool-specific summary, when produced.",
      +  "type": "object"
      +}
  3. Addedv1.6.0

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond annotations by disclosing the destructive side-effects: signatures and AcroForm are DROPPED, only URI links kept, and results are never cached. These are exactly the consequences an agent must know before invoking, and they are not derivable from the readOnly/destructive/idempotent hints.

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?

Dense and front-loaded with the key outcome and CAVEAT clearly flagged. Semicolon-heavy phrasing packs a lot into two sentences; everything earns its place, though the first sentence is slightly run-on.

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?

Covers algorithm choice, password roles, permissions, output modes, rotation, and the signature/AcroForm drop caveat. With an output schema present, return values need not be described, so nothing an agent needs is missing.

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 baseline is 3, but the description adds meaning beyond the schema by explaining the interplay: ownerPassword is required, userPassword is the open password, permissions map to the four flags (default allowed), and `password` enables rotation of an already-encrypted source.

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?

States a specific verb (Encrypt) applied to a specific resource (an existing PDF) with the exact handler and algorithm set (AES-128/AES-256, RC4 never emitted). An agent can distinguish this from decrypt_pdf and sign_pdf 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?

Gives clear situational guidance: rotate a password by passing the current `password`, and 'encrypt BEFORE signing' due to the page-tree rebuild. It does not explicitly name the alternative (decrypt_pdf) or state when not to use it, so it stops short of full when/when-not routing.

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