$npx -y skills add ai4protein/VenusFactory2 --skill pubmedPubMed — NCBI's biomedical literature database (>35M citations). Keyword search inline, or batch-fetch full title + structured abstract + authors + DOI for a known list of PMIDs. Use for medical / biological literature lookup, citation resolution, or building an abstract corpus f
| 1 | # PubMed |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Two complementary tools: existing `query_pubmed_tool` (keyword search, returns small JSON inline) + new `download_pubmed_abstracts_by_pmids` (batch-fetch full abstracts by PMID list, one efetch XML call, saves normalized JSON to disk). |
| 6 | |
| 7 | ## Project Tools (VenusFactory2) |
| 8 | |
| 9 | | Tool | Args | Returns | Description | |
| 10 | |------|------|---------|--------------| |
| 11 | | **query_pubmed** | `query` (text), `max_results` (default 5, max 50), `max_content_length` | JSON list of paper records inline | Keyword search; small payload to agent. | |
| 12 | | **download_pubmed_abstracts_by_pmids** | `pmids` (list of PMID strings, max 200 per call), `out_path` (JSON file path), `timeout` (default 60s) | rich JSON envelope; saved file is `{requested_pmids, articles[]}` where each article has `pmid, title, authors, journal, year, doi, abstract` (structured abstracts join `Label: body` segments with newlines) | Batch-fetch full abstracts + metadata by PMID via efetch. | |
| 13 | |
| 14 | ## When to Use Each |
| 15 | |
| 16 | | Goal | Tool | |
| 17 | |---|---| |
| 18 | | "Find papers about X" | `query_pubmed` | |
| 19 | | "Get me the full abstracts for these 50 PMIDs" | `download_pubmed_abstracts_by_pmids` | |
| 20 | | Build a corpus for fine-tuning a biomedical NLP model | `query_pubmed` → collect PMIDs → batch fetch via `download_pubmed_abstracts_by_pmids` | |
| 21 | | Resolve a citation string to a PMID | (out of scope here — use the search tool with the citation text, parse hits) | |
| 22 | |
| 23 | ## Output Schema for `download_pubmed_abstracts_by_pmids` |
| 24 | |
| 25 | ```json |
| 26 | { |
| 27 | "requested_pmids": ["34265844", "37962427", ...], |
| 28 | "articles": [ |
| 29 | { |
| 30 | "pmid": "34265844", |
| 31 | "title": "Highly accurate protein structure prediction with AlphaFold", |
| 32 | "authors": ["Jumper J", "Evans R", ...], |
| 33 | "journal": "Nature", |
| 34 | "year": "2021", |
| 35 | "doi": "10.1038/s41586-021-03819-2", |
| 36 | "abstract": "Proteins are essential to life..." |
| 37 | }, |
| 38 | ... |
| 39 | ] |
| 40 | } |
| 41 | ``` |
| 42 | |
| 43 | Structured abstracts (with `BACKGROUND:`/`METHODS:`/`RESULTS:`/`CONCLUSIONS:` sections) are joined with `\n` and each section is prefixed by its label. |
| 44 | |
| 45 | ## Rate Limiting |
| 46 | |
| 47 | - Without `NCBI_API_KEY`: 3 req/s. |
| 48 | - With `NCBI_API_KEY` (free; get at https://www.ncbi.nlm.nih.gov/account/settings/): 10 req/s. |
| 49 | - `download_pubmed_abstracts_by_pmids` does ONE efetch for the whole batch — much friendlier than N individual fetches. |
| 50 | - Hard cap: 200 PMIDs per call (split into chunks if you need more). |
| 51 | |
| 52 | ## Common Mistakes |
| 53 | |
| 54 | - **PMID as int**: the tool accepts strings; pass `"34265844"`, not `34265844`. (Int is coerced to str internally but use string defensively.) |
| 55 | - **>200 PMIDs in one call**: returns `ValidationError`. Split into chunks of ≤200. |
| 56 | - **Missing abstract**: not all PubMed records have abstracts (older / non-research / book chapters). The `abstract` field will be `null` for those. |
| 57 | - **Confusing PMID with PMCID**: PMID is a number (e.g. `34265844`); PMCID is `PMC<number>` (e.g. `PMC8371605`). This tool uses PMIDs. |
| 58 | |
| 59 | ## References |
| 60 | |
| 61 | - [PubMed E-utilities](https://www.ncbi.nlm.nih.gov/books/NBK25501/) |
| 62 | - [Get an NCBI API key](https://www.ncbi.nlm.nih.gov/account/settings/) (free) |
| 63 | - [PMID vs PMCID](https://www.nlm.nih.gov/bsd/policy/dla_FAQ.html) |