# searchPubmed

**Identifier:** `pubmed_searchPubmed`

**Provider:** [PubMed](https://kirha.com/providers/pubmed.md)

Search PubMed for scientific articles. Returns article summaries (title, authors, journal, publication date, DOI) for each result. Use fetchPubmedArticles with the returned pmIds to get full article details (abstract, MeSH terms). Two search modes: (1) query string for most searches — use plain keywords like 'CRISPR gene therapy cancer'; (2) meshTerms array for MeSH-based or MeSH major topic searching; names are mapped to canonical MeSH headings automatically. Supports filters for language/species/age/sex, text availability, date filtering, and pagination. Searches all time by default. Use dateRange or recentDays to filter by date.

## Run it with the CLI

```bash
kirha tools run pubmed_searchPubmed \
  --input '{}'
```

`--input` takes a JSON object that matches the input schema. Pass `--input -` to read it from stdin.

## Call it over HTTP

```bash
curl https://api.kirha.com/tools/v1/execute \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: **********' \
  --data '{
  "tool_name": "pubmed_searchPubmed",
  "input": {}
}'
```

Replace the stars with an API key from https://app.kirha.com/api-keys.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "ageGroup": {
      "description": "Filter by age group using MeSH terms. Use this instead of adding age terms (e.g. 'elderly', 'children') in the query. newborn=birth-1mo, infant=birth-23mo, preschoolChild=2-5y, child=6-12y, adolescent=13-18y, youngAdult=19-24y, adult=19-44y, middleAged=45-64y, aged=65+, aged80AndOver=80+",
      "enum": [
        "newborn",
        "infant",
        "preschoolChild",
        "child",
        "adolescent",
        "youngAdult",
        "adult",
        "middleAged",
        "aged",
        "aged80AndOver"
      ],
      "type": "string"
    },
    "countOnly": {
      "default": false,
      "description": "If true, only return the total count of matching articles without fetching summaries. Useful to estimate result size",
      "type": "boolean"
    },
    "dateRange": {
      "description": "Optional date range filter. If not provided, searches all time. Takes precedence over recentDays",
      "properties": {
        "dateType": {
          "default": "pdat",
          "description": "Date type: pdat=publication, edat=entrez, mdat=modification",
          "enum": [
            "pdat",
            "edat",
            "mdat"
          ],
          "type": "string"
        },
        "maxDate": {
          "description": "End date in YYYY/MM/DD, YYYY/MM, or YYYY format",
          "type": "string"
        },
        "minDate": {
          "description": "Start date in YYYY/MM/DD, YYYY/MM, or YYYY format",
          "type": "string"
        }
      },
      "required": [
        "minDate",
        "maxDate"
      ],
      "type": "object"
    },
    "language": {
      "description": "Filter results by article language",
      "enum": [
        "english",
        "french",
        "german",
        "spanish",
        "chinese",
        "japanese",
        "russian",
        "portuguese",
        "italian",
        "korean"
      ],
      "type": "string"
    },
    "maxResults": {
      "default": 20,
      "maximum": 100,
      "minimum": 1,
      "type": "number"
    },
    "meshFieldType": {
      "default": "meshTerms",
      "description": "How to search meshTerms: meshTerms=[mh] matches any MeSH tag, meshMajorTopic=[majr] matches only major topic tags. Only applies when using the meshTerms array parameter",
      "enum": [
        "meshTerms",
        "meshMajorTopic"
      ],
      "type": "string"
    },
    "meshTerms": {
      "description": "MeSH headings or common names (mapped to canonical headings automatically). Terms are combined with AND. Example: ['Metformin', 'Diabetes Mellitus, Type 2']. Takes precedence over query",
      "items": {
        "type": "string"
      },
      "maxItems": 10,
      "minItems": 1,
      "type": "array"
    },
    "offset": {
      "default": 0,
      "description": "Starting index for pagination (max 9998: PubMed only exposes the first 9,999 matches per search). Use with maxResults to page through results",
      "maximum": 9998,
      "minimum": 0,
      "type": "number"
    },
    "publicationTypes": {
      "items": {
        "enum": [
          "Review",
          "Systematic Review",
          "Meta-Analysis",
          "Randomized Controlled Trial",
          "Clinical Trial",
          "Case Reports",
          "Observational Study",
          "Practice Guideline",
          "Editorial",
          "Letter",
          "Comment"
        ],
        "type": "string"
      },
      "type": "array"
    },
    "query": {
      "description": "Free-text search query for general keyword searches. ONLY use this for casual/exploratory searches where MeSH precision is not needed. Do NOT put MeSH headings from lookupMeshTerms here — use the meshTerms array instead. Do NOT include demographic terms (elderly, women, children) — use species, sex, ageGroup filters. Do NOT include publication type terms (review, trial) — use publicationTypes filter. Either query or meshTerms must be provided. If both are given, meshTerms is used and query is ignored",
      "minLength": 3,
      "type": "string"
    },
    "recentDays": {
      "description": "Return articles from the last N days. Simpler alternative to dateRange. Ignored when dateRange is given",
      "minimum": 1,
      "type": "number"
    },
    "searchField": {
      "default": "all",
      "description": "Restrict the free-text query to a specific PubMed field. Only applies when using the query parameter (not meshTerms). all=all fields, title=title only, titleAbstract=title and abstract, author=author name, journal=journal name",
      "enum": [
        "all",
        "title",
        "titleAbstract",
        "author",
        "journal"
      ],
      "type": "string"
    },
    "sex": {
      "description": "Filter by sex of subjects studied. Maps to MeSH terms Female/Male. Use this instead of adding sex/gender terms (e.g. 'women', 'men') in the query",
      "enum": [
        "male",
        "female"
      ],
      "type": "string"
    },
    "sort": {
      "default": "relevance",
      "enum": [
        "relevance",
        "pubDate",
        "author",
        "journal"
      ],
      "type": "string"
    },
    "species": {
      "description": "Filter by species studied",
      "enum": [
        "humans",
        "animals"
      ],
      "type": "string"
    },
    "textAvailability": {
      "description": "Filter by text availability: hasAbstract, freeFullText (open access), fullText (any full text link)",
      "enum": [
        "hasAbstract",
        "freeFullText",
        "fullText"
      ],
      "type": "string"
    }
  },
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "context": {
      "type": "string"
    },
    "pmids": {
      "description": "PubMed IDs - use with fetchPubmedArticles for full details",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "retrievedCount": {
      "type": "number"
    },
    "summaries": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "authors": {
            "type": "string"
          },
          "doi": {
            "type": "string"
          },
          "pmid": {
            "type": "string"
          },
          "pubDate": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "pmid",
          "title",
          "authors",
          "source",
          "pubDate"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "totalFound": {
      "type": "number"
    }
  },
  "required": [
    "context",
    "totalFound",
    "retrievedCount",
    "summaries",
    "pmids"
  ],
  "type": "object"
}
```

## Related tools

Other PubMed tools that this tool refers to, or that refer to it.

- [`fetchPubmedArticles`](https://kirha.com/providers/pubmed/fetchPubmedArticles.md)
- [`lookupMeshTerms`](https://kirha.com/providers/pubmed/lookupMeshTerms.md)

-----

[All PubMed tools](https://kirha.com/providers/pubmed.md) · [< Back to tools list](https://kirha.com/tools.md)