Skip to main content
Glama
PDF.co MCP Server

PDF.co MCP Server

Official
by pdfdotco

Web page to PDF

webpage_to_pdf

Convert an external webpage URL into a PDF document with customizable headers, footers, margins, and paper size settings.

Instructions

Convert external webpage URL to PDF. Ref: https://developer.pdf.co/api/pdf-from-url.md

The header and footer parameters can contain valid HTML markup with the following classes used to inject printing values into them:

  • date: formatted print date

  • title: document title

  • url: document location

  • pageNumber: current page number

  • totalPages: total pages in the document

  • img: tag is supported in both the header and footer parameter, provided that the src attribute is specified as a base64-encoded string. For example, the following markup will generate Page N of NN page numbering:

<span style='font-size:10px'>Page <span class='pageNumber'></span> of <span class='totalPages'></span>.</span>

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": {
      "url": "<url>"
    },
    "name": "webpage_to_pdf"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesURL to the source file (external webpage URL).
nameNoFile name for the generated output. (Optional)
footerNoUser definable HTML for the footer to be applied on every page footer. (Optional)
headerNoUser definable HTML for the header to be applied on every page header. (Optional)
api_keyNoPDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)
marginsNoSet to CSS style margins like 10px, 5mm, 5in for all sides or 5px 5px 5px 5px (the order of margins is top, right, bottom, left). (Optional)
profilesNoExtra engine options for this endpoint as a JSON object encoded in a string. The options differ per endpoint; see https://developer.pdf.co/api/profiles. (Optional)
mediaTypeNoUses print by default. Set to screen to convert HTML as it appears in a browser or print to convert as it appears for printing or none to set none as mediaType for CSS styles. (Optional)
paperSizeNoA4 is set by default. Can be Letter, Legal, Tabloid, Ledger, A0, A1, A2, A3, A4, A5, A6 or a custom size. Custom size can be set in px (pixels), mm or in (inches) with width and height separated by space like this: 200 300, 200px 300px, 200mm 300mm, 20cm 30cm or 6in 8in. (Optional)
expirationNoLifetime of the output link in minutes; the output file is deleted afterwards. API default is 60; the maximum depends on the plan. (Optional)
orientationNoSet to Portrait or Landscape. Portrait is set by default. (Optional)
httppasswordNoHTTP auth password if required to access source url. (Optional)
httpusernameNoHTTP auth user name if required to access source url. (Optional)
printBackgroundNotrue by default. Set to false to disable printing of background. (Optional)
DoNotWaitFullLoadNofalse by default. Set to true to skip waiting for full load (like full video load etc. that may affect the total conversion time). (Optional)

Output Schema

NameRequiredDescriptionDefault
tipsNo
statusYes
contentYes
credits_usedNo
credits_remainingNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed17 schema fields changedv0.0.12
    • addedInput schema / additionalProperties
      Added value: +false
    • removedInput schema / properties / DoNotWaitFullLoad / title
      Removed value: -"Donotwaitfullload"
    • removedInput schema / properties / api_key / title
      Removed value: -"Api Key"
    • removedInput schema / properties / expiration / title
      Removed value: -"Expiration"
    • removedInput schema / properties / footer / title
      Removed value: -"Footer"
    • removedInput schema / properties / header / title
      Removed value: -"Header"
    • removedInput schema / properties / httppassword / title
      Removed value: -"Httppassword"
    • removedInput schema / properties / httpusername / title
      Removed value: -"Httpusername"
    • removedInput schema / properties / margins / title
      Removed value: -"Margins"
    • removedInput schema / properties / mediaType / title
      Removed value: -"Mediatype"
    • removedInput schema / properties / name / title
      Removed value: -"Name"
    • removedInput schema / properties / orientation / title
      Removed value: -"Orientation"
    • removedInput schema / properties / paperSize / title
      Removed value: -"Papersize"
    • removedInput schema / properties / printBackground / title
      Removed value: -"Printbackground"
    • removedInput schema / properties / profiles / title
      Removed value: -"Profiles"
    • removedInput schema / properties / url / title
      Removed value: -"Url"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "content": {},
      +    "credits_remaining": {
      +      "anyOf": [
      +        {
      +          "type": "integer"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null
      +    },
      +    "credits_used": {
      +      "anyOf": [
      +        {
      +          "type": "integer"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null
      +    },
      +    "status": {
      +      "type": "string"
      +    },
      +    "tips": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null
      +    }
      +  },
      +  "required": [
      +    "status",
      +    "content"
      +  ],
      +  "type": "object"
      +}
  2. Changed2 schema fields changedv0.0.11
    • addedInput schema / properties / expiration
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Lifetime of the output link in minutes; the output file is deleted afterwards. API default is 60; the maximum depends on the plan. (Optional)",
      +  "title": "Expiration"
      +}
    • addedInput schema / properties / profiles
      Added value: +{
      +  "default": "",
      +  "description": "Extra engine options for this endpoint as a JSON object encoded in a string. The options differ per endpoint; see https://developer.pdf.co/api/profiles. (Optional)",
      +  "title": "Profiles",
      +  "type": "string"
      +}
  3. First observed

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false and destructiveHint=false, so safety is largely covered. The description adds real context that the service fetches a remote page (hence the httppassword/httpusername and DoNotWaitFullLoad options) and documents the header/footer templating behavior, but it omits whether the call is synchronous, what happens on unreachable pages, and any rate/plan limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action in one sentence, then the external reference, then a scoped block about header/footer only. The templating detail and example are dense but each line carries information an agent would otherwise have to guess.

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 15-parameter conversion tool with full schema coverage, an output schema, and annotations, the description supplies exactly the missing piece: header/footer templating semantics. Return value shape is covered by the output schema, so nothing essential is absent.

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 goes beyond the schema by explaining the class-based templating syntax (date, title, url, pageNumber, totalPages) and the base64 img restriction for header/footer, none of which the schema states. The worked HTML example makes the header/footer parameters directly actionable.

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 first sentence names a specific verb and resource ('Convert external webpage URL to PDF') and the qualifier 'external webpage URL' implicitly scopes it away from markup-based siblings like html_to_pdf. It never names an alternative explicitly, so an agent must infer the boundary from the word 'external'.

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?

Usage is only implied: the required 'url' plus 'external webpage URL' suggests this is for live pages reachable over HTTP rather than local HTML strings or files. There is no explicit when-not guidance and no routing to siblings such as html_to_pdf or image_to_pdf.

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