Skip to main content
Glama
pdfdotco

PDF.co MCP Server

Official
by pdfdotco

pdf_split

Divide a PDF document into separate files by specifying page indexes or ranges. Easily extract specific pages or split every page into individual files for better organization and management.

Instructions

Split a PDF into multiple PDF files using page indexes or page ranges. Ref: https://developer.pdf.co/api-reference/pdf-split/by-pages.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyNoPDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)
httppasswordNoHTTP auth password if required to access source url. (Optional)
httpusernameNoHTTP auth user name if required to access source url. (Optional)
nameNoBase file name for the generated output files. (Optional)
pagesYesComma-separated indices of pages (or page ranges) that you want to use. The first-page index is 1. For example: '1,3,5-7' or '1-2,4-'. Use '*' to split every page into separate files.
passwordNoPassword of the PDF file. (Optional)
urlYesURL to the source PDF file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files.

Implementation Reference

  • Primary handler and registration for the 'pdf_split' MCP tool. Defines the tool schema via function parameters and Pydantic Field descriptions. Constructs ConversionParams and delegates to the split_pdf helper service.
    @mcp.tool() async def pdf_split( url: str = Field( description="URL to the source PDF file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files." ), pages: str = Field( description="Comma-separated indices of pages (or page ranges) that you want to use. The first-page index is 1. For example: '1,3,5-7' or '1-2,4-'. Use '*' to split every page into separate files." ), httpusername: str = Field( description="HTTP auth user name if required to access source url. (Optional)", default="", ), httppassword: str = Field( description="HTTP auth password if required to access source url. (Optional)", default="", ), password: str = Field( description="Password of the PDF file. (Optional)", default="" ), name: str = Field( description="Base file name for the generated output files. (Optional)", default="", ), api_key: str = Field( description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)", default="", ), ) -> BaseResponse: """ Split a PDF into multiple PDF files using page indexes or page ranges. Ref: https://developer.pdf.co/api-reference/pdf-split/by-pages.md """ params = ConversionParams( url=url, pages=pages, httpusername=httpusername, httppassword=httppassword, password=password, name=name, ) return await split_pdf(params, api_key=api_key)
  • Helper service function that executes the core logic by making an asynchronous POST request to the PDF.co API endpoint '/v1/pdf/split'.
    async def split_pdf(params: ConversionParams, api_key: str | None = None) -> BaseResponse: return await request("pdf/split", params, api_key=api_key)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pdfdotco/pdfco-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server