Skip to main content
Glama
pdfdotco

PDF.co MCP Server

Official
by pdfdotco

pdf_merge

Merge multiple files including PDFs, documents, spreadsheets, and images into a single PDF document using the PDF.co MCP Server tool.

Instructions

Merge PDF from two or more PDF, DOC, XLS, images, even ZIP with documents and images into a new PDF.
Ref: https://developer.pdf.co/api-reference/merge/various-files.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURLs to the source files as a comma-separated list. Supports PDF, DOC, DOCX, RTF, TXT, XLS, XLSX, CSV, images, and more. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files.
httpusernameNoHTTP auth user name if required to access source url. (Optional)
httppasswordNoHTTP auth password if required to access source url. (Optional)
nameNoFile name for the generated output. (Optional)
api_keyNoPDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)

Implementation Reference

  • The pdf_merge tool handler, registered with @mcp.tool(), defines the input schema using Pydantic Field descriptions, and implements the core logic by constructing ConversionParams and delegating to the merge_pdf helper.
    @mcp.tool()
    async def pdf_merge(
        url: str = Field(
            description="URLs to the source files as a comma-separated list. Supports PDF, DOC, DOCX, RTF, TXT, XLS, XLSX, CSV, images, and more. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local 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="",
        ),
        name: str = Field(
            description="File name for the generated output. (Optional)", default=""
        ),
        api_key: str = Field(
            description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
            default="",
        ),
    ) -> BaseResponse:
        """
        Merge PDF from two or more PDF, DOC, XLS, images, even ZIP with documents and images into a new PDF.
        Ref: https://developer.pdf.co/api-reference/merge/various-files.md
        """
        return await merge_pdf(
            ConversionParams(
                url=url, httpusername=httpusername, httppassword=httppassword, name=name
            ),
            api_key=api_key,
        )
  • Supporting helper function that makes the API request to PDF.co's pdf/merge2 endpoint for merging PDFs.
    async def merge_pdf(params: ConversionParams, api_key: str | None = None) -> BaseResponse:
        return await request("pdf/merge2", params, api_key=api_key)
  • The @mcp.tool() decorator registers the pdf_merge function as an MCP tool.
    @mcp.tool()
  • Pydantic Field definitions providing the input schema, descriptions, and defaults for the pdf_merge tool.
        url: str = Field(
            description="URLs to the source files as a comma-separated list. Supports PDF, DOC, DOCX, RTF, TXT, XLS, XLSX, CSV, images, and more. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local 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="",
        ),
        name: str = Field(
            description="File name for the generated output. (Optional)", default=""
        ),
        api_key: str = Field(
            description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)",
            default="",
        ),
    ) -> BaseResponse:
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions merging files into a new PDF and references an external API link, but fails to disclose critical traits: whether this is a read/write operation, potential rate limits, authentication needs beyond the optional api_key, error handling, or output behavior (e.g., file generation details). The description adds minimal context beyond the basic action.

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?

The description is appropriately sized with two sentences: the first states the core functionality and supported inputs, the second provides a reference link. It's front-loaded with the key action ('Merge PDF'), but the reference link adds minor clutter without inline explanation. Overall, it's efficient with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (merging multiple file types into PDF), lack of annotations, and no output schema, the description is incomplete. It doesn't explain the merging order (e.g., by URL list sequence), output format details, error cases, or dependencies like the upload_file tool. For a tool with 5 parameters and significant functionality, more behavioral and contextual information is needed to guide effective use.

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 description coverage is 100%, so the schema already documents all 5 parameters thoroughly (e.g., url supports various file types and sources, httpusername/httppassword for auth, name for output, api_key for authentication). The description adds no additional parameter semantics beyond what the schema provides, such as explaining URL format specifics or interaction between parameters. Baseline 3 is appropriate given high schema coverage.

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?

The description clearly states the tool's purpose: merging multiple files into a new PDF, specifying supported input formats (PDF, DOC, XLS, images, ZIP). It distinguishes itself from sibling tools like pdf_split or pdf_to_csv by focusing on merging rather than splitting or conversion. However, it doesn't explicitly differentiate from tools like document_to_pdf that might handle similar input types but for single-file conversion.

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?

The description implies usage context by listing supported file types and referencing the 'upload_file' tool for local files, which suggests when to use this tool (for merging multiple files into PDF). However, it lacks explicit guidance on when to choose this over alternatives like combining pdf_split with pdf_merge for reordering, or when to use document_to_pdf for single files. No exclusions or clear alternatives are named.

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

Install Server

Other Tools

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