Download Pdf
download_pdfDownloads paper PDFs by OpenAlex work ID or native ID from sources like arXiv, Elsevier, Unpaywall, DOI pages, and Semantic Scholar, saving valid PDFs locally and skipping existing files.
Instructions
Download paper PDFs by OpenAlex work ID or by native id.
TRIGGER when the user asks to 下载论文/PDF/全文, download or save paper PDF files.
Sources are tried in this order and the first one that returns a
real PDF wins: pdf_url links recorded on the work, arXiv, the
Elsevier Article Retrieval API (needs ELSEVIER_API_KEY plus the
campus subscription; works for paywalled Elsevier articles). Only
when all of those fail: Unpaywall, the DOI landing page's
citation_pdf_url tag, Semantic Scholar, and last the paid
OpenAlex Content API (content.openalex.org, $0.01 per PDF;
the reported cost counts paid downloads only). CNKI records are
downloaded one page at a time in the local browser under the
machine's institutional access: at most 5 per call, because CNKI
restricts batch downloads. Some theses offer CAJ only. Batches with
CNKI entries return a job_id on verification or after 20 seconds.
Ordinary PDFs in that batch continue. Ask the user to verify in the
original window and say “继续” within 4 minutes. Resume the batch
with cnki_job(job_id) or cancel with action='cancel'.
STRICT RULE: PDFs must be saved to
~/.AI-CACHE/openalex/pdfs/ by default. Leave
save_to_project=false unless the user explicitly asks to save
PDFs in the project directory. Never infer this from context, an
Agent preference, or a requested arbitrary path. When explicitly
requested, save_to_project=true saves only to the fixed
<project>/pdfs/ directory; arbitrary output paths are impossible.
Already-downloaded files are skipped to avoid unnecessary charges.
Limits: at most 25 works per call (split larger batches); remote URLs are fetched only over validated public http(s) hosts, must prove to be PDFs, and are size-capped. Sites that answer with a CAPTCHA or bot check are reported as failures, never solved.
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": {
"work_ids": "<work_ids>"
},
"name": "download_pdf"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| work_ids | Yes | Comma-separated OpenAlex work IDs (``"W2741809807"``) or native ids already in the library from ``search_multi`` and ``search_cnki`` (``arxiv:2401.12345``, ``cnki:CJFQ.JXKF202617019``). | |
| save_to_project | No | Set to ``True`` only after the user explicitly requests saving PDFs in the project directory. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |