download_pdf
Download a scientific paper PDF from a validated URL to your local directory. Ensures safe, atomic downloads with size caps and correctness verification.
Instructions
Download a PDF to the local PDF directory. Use find_oa_pdf first to obtain a URL. The URL is validated for SSRF safety (private/loopback/metadata IPs are refused) and the bytes are verified to start with the %PDF- magic marker. Downloads are capped at PDF_MAX_BYTES (default 100 MB) and written atomically — a failed download never leaves a partial file at the final path.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doi | No | DOI used to derive the filename (optional). | |
| url | Yes | Direct PDF URL (typically best_oa_location.url_for_pdf from find_oa_pdf). | |
| filename | No | Explicit filename override (sanitized; will be .pdf-suffixed). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doi | No | ||
| url | Yes | ||
| local_path | Yes | ||
| content_type | No | ||
| bytes_written | Yes |