{
  "name": "pdf-merge",
  "summary": "Concatenates 2–8 source PDFs, in order, into one PDF returned base64-encoded. Maximum output PDF size: 25 MiB before base64 encoding.",
  "rationale": "Merging PDFs needs a real PDF library and a hardened fetch over several URLs at once: an agent doing it inline walks every one past the SSRF controls, and the joined output must be byte-reproducible.",
  "family": "documents",
  "price_usd": "0.005",
  "free": false,
  "timeout_ms": 45000,
  "max_timeout_seconds": 66,
  "input_schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "urls": {
        "minItems": 2,
        "maxItems": 8,
        "type": "array",
        "items": {
          "type": "string",
          "maxLength": 2048,
          "format": "uri",
          "description": "Absolute http(s) URL of one source PDF, up to 2048 characters; redirects are followed and the body must start with the %PDF- signature."
        },
        "description": "The source PDFs, 2 to 8 URLs fetched one at a time and concatenated in this order; each is read up to 8 MiB and an encrypted source is refused."
      }
    },
    "required": [
      "urls"
    ],
    "additionalProperties": false
  },
  "input_example": {
    "urls": [
      "https://grist.tools/samples/documents/merge-intro.pdf",
      "https://grist.tools/samples/documents/merge-appendix.pdf"
    ]
  },
  "output_example": {
    "sources": [
      {
        "url": "https://grist.tools/samples/documents/merge-intro.pdf",
        "pages": 1
      },
      {
        "url": "https://grist.tools/samples/documents/merge-appendix.pdf",
        "pages": 2
      }
    ],
    "pages": 3,
    "bytes": 1474,
    "pdf_base64": "JVBERi0xLjcKJYGBgYEKCjQgMCBvYmoKPDwKL0ZpbHRlciAvRmxhdGVEZWNvZGUK..."
  },
  "errors": [
    "invalid_input",
    "blocked_target",
    "unreachable_target",
    "upstream_timeout",
    "unsupported_content_type",
    "too_large",
    "unprocessable",
    "internal"
  ]
}