Skip to main content
Glama

Extract pages from PDF

pdf_extract_pages
Idempotent

Keep only the listed pages of a PDF, in the order given, and return them as a new PDF. Because order follows the spec, it also reorders pages ("3,1,2") and can duplicate them. Use this to pull a section out of a document; use pdf_delete_pages to remove pages instead, pdf_split for several output files, and pdf_merge to join documents. Returns the result inline as an application/pdf resource; the source is never modified. Fails with invalid_pages if a page is out of range.

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>",
      "pages": "<pages>"
    },
    "name": "pdf_extract_pages"
  }
}

Input Schema

NameRequiredDescriptionDefault
pagesYes1-based page spec, e.g. "1-3,5,8-" (open-ended range runs to the last page)
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: an https:// URL or a data:application/pdf;base64,… URI (this hosted server cannot read local file paths).

Output Schema

NameRequiredDescriptionDefault
bytesYesSize of the produced PDF in bytes
resource_uriNopdfops:// uri of the inline application/pdf resource

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior4/5

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

Annotations declare readOnlyHint=false, destructiveHint=false and idempotentHint=true, and the description is consistent with them while adding real context: the source is never modified, the result is returned inline as an application/pdf resource, and an invalid_pages failure is documented for out-of-range specs. The only missing behavioral detail is any size or rate limit on large page spans, which keeps it off a 5.

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?

Front-loaded with the core action, then the ordering nuance, then sibling routing, then return and error behavior. Four sentences, all load-bearing, though the caveat sentence about ordering could be folded into the first sentence to tighten it slightly.

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?

Complete for a 3-parameter read-and-transform tool: purpose, ordering semantics, password and source-URI constraints (in the schema), inline return type, and a named error condition. An output schema exists, yet the description's extra note about inline PDF resources still helps an agent handle the response.

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, but the description adds meaning the schema does not: page order is honored, so "3,1,2" reorders and duplicates pages. That is a non-obvious semantic of the pages parameter that an agent could otherwise misuse.

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 and resource: "Keep only the listed pages of a PDF ... and return them as a new PDF." It also carves out a distinct niche from siblings by naming pdf_delete_pages, pdf_split and pdf_merge in the same breath, so an agent can classify the tool 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 Guidelines5/5

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

Explicitly says when to use it ("pull a section out of a document") and routes three alternatives by intent: removal, multiple outputs, and joining. That is the full when/when-not/alternative pattern rather than an implied use case.

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.