askill
pubmed-literature-retrieval

pubmed-literature-retrievalSafety 100Repository

Use when searching PubMed for literature references, retrieving article metadata or full text, building citation lists for papers or grant proposals, or conducting systematic literature reviews using NCBI E-utilities API

0 stars
1.2k downloads
Updated 2/13/2026

Package Files

Loading files...
SKILL.md

PubMed Literature Retrieval

Overview

Search and retrieve biomedical literature from PubMed using NCBI E-utilities REST API. Zero local dependencies — all calls are HTTP GET/POST to eutils.ncbi.nlm.nih.gov. Designed for cloud deployment and LLM tool integration.

When to Use

  • Writing papers, grant proposals, or literature reviews that need citation support
  • Searching PubMed by keywords, authors, date ranges, MeSH terms, or publication types
  • Retrieving structured metadata (title, authors, abstract, DOI, etc.) for a set of articles
  • Attempting to fetch full-text articles from PubMed Central (PMC)
  • Building reference lists from search results

Base URL

All E-utility requests use:

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/

API Key & Rate Limits

ConfigRate LimitNotes
No API key3 requests/secDefault, sufficient for small searches
With API key10 requests/secGet key from https://www.ncbi.nlm.nih.gov/account/settings/

Include API key in every request: &api_key=YOUR_KEY

Always include &tool=your_tool_name&email=your@email.com in requests for NCBI compliance.

Core Workflow

digraph pubmed_flow {
    rankdir=TB;
    "Build Query" [shape=box];
    "ESearch" [shape=box, label="ESearch\n(get PMIDs)"];
    "Check Count" [shape=diamond];
    "EFetch Metadata" [shape=box, label="EFetch\n(get XML metadata)"];
    "Parse & Format" [shape=box];
    "Need Full Text?" [shape=diamond];
    "ELink to PMC" [shape=box];
    "EFetch PMC" [shape=box, label="EFetch PMC\n(full text XML)"];
    "Return Results" [shape=doublecircle];

    "Build Query" -> "ESearch";
    "ESearch" -> "Check Count";
    "Check Count" -> "EFetch Metadata" [label="≤200 results"];
    "Check Count" -> "ESearch" [label=">200: paginate\nwith retstart"];
    "EFetch Metadata" -> "Parse & Format";
    "Parse & Format" -> "Need Full Text?";
    "Need Full Text?" -> "ELink to PMC" [label="yes"];
    "Need Full Text?" -> "Return Results" [label="no"];
    "ELink to PMC" -> "EFetch PMC";
    "EFetch PMC" -> "Return Results";
}

Step 1: ESearch — Search PubMed

URL Pattern

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=<QUERY>&retmax=<N>&retstart=<OFFSET>&usehistory=y&sort=relevance

Query Syntax — Field Tags

Field TagMeaningExample
[tiab]Title/Abstractcancer[tiab]
[ti]Title onlyCRISPR[ti]
[au]AuthorZhang Y[au]
[1au]First authorSmith J[1au]
[lastau]Last authorWang L[lastau]
[ta]Journal abbreviationNature[ta]
[dp]Date of publication2023[dp] or 2020:2024[dp]
[pt]Publication typeReview[pt]
[mh]MeSH headingNeoplasms[mh]
[majr]MeSH major topicBreast Neoplasms[majr]
[sh]MeSH subheadingtherapy[sh]
[la]LanguageEnglish[la]
[sb]Subsetfree full text[sb]
[filter]Filterhumans[filter]

Boolean Operators

Use uppercase: AND, OR, NOT

(breast cancer[tiab] OR breast neoplasms[mh]) AND immunotherapy[tiab] AND 2020:2024[dp] AND Review[pt]

Publication Type Filters

TypeTag
ReviewReview[pt]
Systematic ReviewSystematic Review[pt]
Meta-AnalysisMeta-Analysis[pt]
Clinical TrialClinical Trial[pt]
Randomized Controlled TrialRandomized Controlled Trial[pt]
Case ReportsCase Reports[pt]
EditorialEditorial[pt]
LetterLetter[pt]

Sort Options

ValueMeaning
relevanceBest match (default)
pub_dateMost recent first
AuthorBy first author
JournalNameBy journal

ESearch Parameters

ParameterRequiredDescription
dbYesAlways pubmed
termYesSearch query with field tags
retmaxNoMax UIDs returned (default 20, max 10000)
retstartNoIndex offset for pagination (default 0)
usehistoryNoSet y to store results on History Server
sortNoSort order (see above)
datetypeNopdat (pub date), edat (Entrez date)
mindateNoStart date (YYYY/MM/DD or YYYY)
maxdateNoEnd date (YYYY/MM/DD or YYYY)
api_keyNoNCBI API key

Example ESearch Call

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=CRISPR+AND+cancer[tiab]+AND+2023:2024[dp]+AND+Review[pt]&retmax=50&sort=pub_date&usehistory=y

ESearch Response (XML)

Key fields to extract:

  • <Count> — total matching records
  • <IdList><Id> — list of PMIDs
  • <QueryKey> and <WebEnv> — for History Server (when usehistory=y)

Step 2: EFetch — Retrieve Article Metadata

URL Pattern (by PMID list)

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=PMID1,PMID2,PMID3&rettype=xml&retmode=xml

URL Pattern (by History Server)

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&query_key=KEY&WebEnv=WEBENV&rettype=xml&retmode=xml&retstart=0&retmax=100

EFetch Parameters

ParameterRequiredDescription
dbYesAlways pubmed
idYes*Comma-separated PMIDs (*or use query_key+WebEnv)
query_keyYes*From ESearch with usehistory=y
WebEnvYes*From ESearch with usehistory=y
rettypeYesxml for structured data, abstract for text
retmodeYesxml or text
retmaxNoMax records per request (default 20, recommend ≤200)
retstartNoOffset for pagination

Parsing EFetch XML — Key XPaths

Extract these fields from each <PubmedArticle>:

FieldXPath
PMIDMedlineCitation/PMID
TitleMedlineCitation/Article/ArticleTitle
AbstractMedlineCitation/Article/Abstract/AbstractText
AuthorsMedlineCitation/Article/AuthorList/Author (LastName + Initials)
JournalMedlineCitation/Article/Journal/Title
Journal AbbrevMedlineCitation/Article/Journal/ISOAbbreviation
YearMedlineCitation/Article/Journal/JournalIssue/PubDate/Year
MonthMedlineCitation/Article/Journal/JournalIssue/PubDate/Month
VolumeMedlineCitation/Article/Journal/JournalIssue/Volume
IssueMedlineCitation/Article/Journal/JournalIssue/Issue
PagesMedlineCitation/Article/Pagination/MedlinePgn
DOIPubmedData/ArticleIdList/ArticleId[@IdType='doi']
PMC IDPubmedData/ArticleIdList/ArticleId[@IdType='pmc']
MeSH TermsMedlineCitation/MeshHeadingList/MeshHeading/DescriptorName
Pub TypesMedlineCitation/Article/PublicationTypeList/PublicationType
KeywordsMedlineCitation/KeywordList/Keyword

Step 3 (Optional): Full-Text Retrieval via PMC

Tier 1: Check PMC availability from EFetch

If the EFetch XML contains <ArticleId IdType="pmc">PMCxxxxxxx</ArticleId>, the full text is available in PMC.

Tier 2: EFetch from PMC

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pmc&id=PMC_ID&rettype=xml

This returns JATS XML with the complete article body, including sections, figures, tables, and references.

Tier 3: PMC Open Access PDF

https://www.ncbi.nlm.nih.gov/pmc/articles/PMCxxxxxxx/pdf/

Tier 4: Fallback via DOI

If not in PMC, construct: https://doi.org/<DOI> — may lead to publisher paywall.

ELink Alternative (batch PMC lookup)

To find PMC IDs for multiple PMIDs at once:

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?dbfrom=pubmed&db=pmc&id=PMID1&id=PMID2&id=PMID3

LLM-Friendly Output Format

After parsing XML, format results as structured text:

--- Article 1 of N ---
PMID: 12345678
Title: Example Article Title Here
Authors: Smith J, Zhang Y, Wang L, et al.
Journal: Nature Medicine (Nat Med)
Date: 2024 Jan
Volume: 30, Issue: 1, Pages: 45-52
DOI: 10.1038/s41591-024-xxxxx
Abstract: [Full abstract text here...]
MeSH: Neoplasms; Immunotherapy; CRISPR-Cas Systems
Type: Review
PMC: PMC9876543 (full text available)
URL: https://pubmed.ncbi.nlm.nih.gov/12345678/
---

Pagination for Large Result Sets

When <Count> exceeds retmax:

  1. Use usehistory=y in ESearch to get WebEnv and query_key
  2. Loop EFetch with incrementing retstart:
    • Batch 1: retstart=0&retmax=200
    • Batch 2: retstart=200&retmax=200
    • Continue until retstart >= Count
  3. Respect rate limits between requests

Common Search Patterns

Find recent reviews on a topic

<TOPIC>[tiab] AND Review[pt] AND 2020:2024[dp] AND English[la]

Find clinical trials by intervention

<INTERVENTION>[tiab] AND Randomized Controlled Trial[pt] AND humans[filter]

Find articles by specific author in a journal

<AUTHOR>[au] AND <JOURNAL>[ta] AND 2020:2024[dp]

Find free full-text articles

<TOPIC>[tiab] AND free full text[sb]

Find systematic reviews and meta-analyses

<TOPIC>[tiab] AND (Systematic Review[pt] OR Meta-Analysis[pt])

MeSH-based precise search

<MESH_TERM>[majr] AND <SUBHEADING>[sh] AND 2020:2024[dp]

Common Mistakes

MistakeFix
Sending >10000 IDs in URLUse History Server (WebEnv + query_key)
Not URL-encoding special charsEncode spaces as +, " as %22, # as %23
Exceeding rate limitAdd delay: 0.34s without key, 0.1s with key
Using lowercase booleanMust be uppercase: AND, OR, NOT
Missing db=pubmed parameterAlways include db=pubmed
Fetching too many at onceKeep retmax ≤ 200 for EFetch
Not checking <Count> before fetchAlways check total results first

Quick Reference

TaskE-utilityKey Parameters
Search by queryESearchdb=pubmed&term=<query>
Get metadata by PMIDEFetchdb=pubmed&id=<pmids>&rettype=xml
Get metadata from searchEFetchdb=pubmed&query_key=K&WebEnv=W&rettype=xml
Find PMC full textELinkdbfrom=pubmed&db=pmc&id=<pmids>
Get PMC full textEFetchdb=pmc&id=<pmcid>&rettype=xml
Batch upload PMIDsEPostdb=pubmed&id=<pmid_list>
Check spellingESpelldb=pubmed&term=<query>
Citation matchECitMatchdb=pubmed&bdata=<citation_strings>

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

95/100Analyzed 2/23/2026

High-quality technical reference skill for PubMed literature retrieval via NCBI E-utilities API. Comprehensive coverage of ESearch, EFetch, and PMC full-text retrieval with detailed parameters, query syntax, examples, and workflow diagram. Well-structured with excellent clarity and actionability. Includes 'When to Use' section, tags for discoverability, and thorough quick reference materials. No internal-only indicators - designed as a reusable, general-purpose skill for LLM tool integration."

100
95
95
92
95

Metadata

Licenseunknown
Version-
Updated2/13/2026
Publisherchenpg2

Tags

apici-cdgithub-actionsllm