Skip to main content
Glama

Compress a PDF

compress_pdf
Read-onlyIdempotent

Recompress embedded images in a PDF. Presets are light, medium, and strong. Send base64 or a public URL. Private addresses are refused. An optional target size tries harder. Returns the PDF and the sizes before and after.

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": "compress_pdf"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlNoPublic URL of a PDF. Private and local addresses are refused. Provide data or url.
dataNoPDF bytes as base64 or a data URI. Decoded size is capped at 10 MB. Provide data or url.
presetNomedium
filenameNo
mimeTypeNo
targetBytesNoOptional size ceiling in bytes, such as 102400.

Output Schema

NameRequiredDescriptionDefault
dataYesPDF bytes as base64. The original is returned when compression would grow the file.
noteYes
afterYes
pagesYes
savedYes
beforeYes
imagesYes
percentYes
metTargetYes
keptOriginalYes
recompressedYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / additionalProperties
      Added value: +false
  2. First observed

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true and openWorldHint=true, so safety is covered. The description adds two useful behavioral notes beyond that: private addresses are refused (network restriction) and a target size is best-effort ('tries harder'). It says nothing about quality loss, whether already-small files are left untouched, or failure behavior when the target is unreachable.

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?

Five short sentences, front-loaded with the core action, then inputs, then edge cases, then return value. No filler. Slight density cost from cramming input, constraint, and output information into single unlabeled clauses.

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?

With an output schema present, explaining the return value is optional, and the description does so anyway. For a read-only transform with six mostly-optional parameters, the description covers the key decision inputs and the one surprising constraint (private URLs refused). The remaining gap is guidance on when this tool is preferable to its siblings and what the presets actually trade off.

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 coverage is only 50%, and the description mostly restates what the schema already documents (base64 vs URL, refusal of private addresses). It adds only marginal meaning for `preset` (repeating the enum values without saying what each does) and for `targetBytes` ('tries harder' implies best-effort). `filename` and `mimeType` are left unexplained in both schema and description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource: 'Recompress embedded images in a PDF', which tells an agent exactly what is transformed and what is not (text/structure). The PDF-specific framing also implicitly separates it from the sibling compress_image, but it never names or contrasts an alternative explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'Send base64 or a public URL' and 'Private addresses are refused' describe acceptable inputs rather than when to choose this tool over compress_image, convert_image, or other PDF siblings. Usage is inferable from the resource type, but no when-not conditions or alternatives are stated.

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.