Skip to main content
Glama
litMcp

litMcp

by L1nze

Download Pdf

download_pdf

Downloads 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

NameRequiredDescriptionDefault
work_idsYesComma-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_projectNoSet to ``True`` only after the user explicitly requests saving PDFs in the project directory.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so: it discloses the source waterfall and its order, the $0.01 paid OpenAlex Content cost, the 25-work per-call cap, the CNKI 5-per-call limit with a 4-minute verification window, that already-downloaded files are skipped to avoid charges, and that CAPTCHA sites fail rather than being solved.

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?

Content is front-loaded: purpose, then trigger, then source order, then the hard rules. It is long and the source-waterfall sentence is dense, but nearly every clause conveys operational information an agent needs; minor trimming of the ordering rationale is possible.

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?

An output schema exists, so return values need not be described, yet the description still explains that CNKI batches yield a job_id after verification or 20 seconds and that reported cost counts paid downloads only. For a tool with network fallbacks, paid calls and async jobs, nothing essential is missing.

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; the description still adds real meaning by constraining save_to_project far beyond the schema text — it must stay false unless explicitly requested, and even then only maps to the fixed <project>/pdfs/ path. work_ids syntax is largely restated from the schema, which keeps this below 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first sentence gives a precise verb and resource: 'Download paper PDFs by OpenAlex work ID or by native id,' and names both accepted identifier forms. It is clearly distinguishable from the sibling search_* tools (which find IDs) and from cnki_job (which resumes a pending batch).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

An explicit TRIGGER clause states the user utterances that should select this tool, and the CNKI paragraph routes the agent to cnki_job(job_id) to resume or action='cancel' to abort. The save_to_project rule tells the agent exactly when not to enable the flag ('Never infer this from context, an Agent preference').

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