Skip to main content
Glama

Password-protect PDF

pdf_protect
Destructive

Encrypt a PDF with an open password and optional owner password to control printing, copying, editing, and form filling. Write the protected file to a path or return it inline.

Instructions

Encrypt a PDF with a password. user_password is required to open the result; owner_password lifts the permission restrictions. Give at least one (each 1 to 32 Latin-1 chars). permissions lists what stays ALLOWED from print, copy, modify, annotate, fill-forms (default all, except modify when an owner password is set; an empty list allows none). Restrictions only bind viewers when an owner password is set. Not byte-deterministic (random salts). 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": {
      "pdf_path": "<pdf_path>"
    },
    "name": "pdf_protect"
  }
}

Input Schema

NameRequiredDescriptionDefault
passwordNoPassword to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it).
pdf_pathYesPDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. Use a URL or data URI when this server runs remotely (Smithery, hosted gateways) where local paths do not exist.
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.
permissionsNoActions to ALLOW; omit for the default, [] for none
user_passwordNoPassword required to open the output
owner_passwordNoPassword that lifts the restrictions

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
Behavior5/5

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

Beyond the annotations it explains why the call is not idempotent (random salts make output non-byte-deterministic), why it is destructive (an existing file at output_path is overwritten), and the reassuring scope limit that the source file is never modified. It also discloses a hard 7 MB inline ceiling and that restrictions bind viewers only when an owner password is set — real behavioral context the annotations cannot express.

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?

It front-loads the core action and every sentence carries information — defaults, limits, return behavior, overwrite risk. The density of parentheticals makes it slightly heavy to parse, but nothing is padding.

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 6-parameter mutation with output schema present, this covers what an agent still needs: password roles, permission defaults, overwrite semantics, return channel and size limit, and determinism. The only gap is the password-length inconsistency, which is a correctness issue rather than a missing topic.

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?

With 100% schema coverage the baseline is 3, but the description earns more by spelling out the permissions default (all except modify when an owner password is set; empty list allows none) and the interaction between owner_password and enforcement. One flaw: it claims passwords are "1 to 32 Latin-1 chars" while the schema declares maxLength 128, leaving an agent unsure which limit to honor.

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?

"Encrypt a PDF with a password" states a specific verb and resource, and the surrounding detail (open password vs. owner password, permissions) makes it unmistakably the inverse of pdf_unlock. An agent can identify the operation 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 gives concrete conditional guidance: at least one password must be supplied, pass output_path when the result exceeds 7 MB, and omit output_path when running remotely so the PDF comes back inline. It stops short of naming alternatives or stating when-not-to-use (e.g., pointing at pdf_unlock for removal), so it falls just under a 5.

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