entrez_search
Search NCBI databases like PubMed, Gene, and Nucleotide using Entrez query syntax to retrieve biological data with customizable filters and sorting.
Instructions
Search any NCBI Entrez database using query syntax.
Args: database: Database to search (e.g., 'pubmed', 'nucleotide', 'gene', 'clinvar') query: Search query using Entrez syntax (see module docstring for examples) max_results: Maximum number of results to return (default: 20, max: 10000) sort: Sort order - 'relevance', 'pub_date', 'Author', etc. (default: 'relevance') use_cache: Whether to use cached results (default: True, TTL: 1 hour)
Returns: Dictionary containing: - ids: List of matching record IDs - count: Number of IDs returned - total_found: Total number of matches in database - query: Original query string - database: Database searched - cached: Whether result was from cache (if use_cache=True)
Examples: >>> entrez_search("pubmed", "BRCA1 AND breast cancer", max_results=10) >>> entrez_search("gene", "BRCA1[Gene Name] AND Homo sapiens[Organism]") >>> entrez_search("nucleotide", "Homo sapiens[Organism]", max_results=5) >>> entrez_search("clinvar", "BRCA1[Gene] AND Pathogenic[Clinical Significance]")
Notes: - Uses NCBI Entrez query syntax with field tags and Boolean operators - Rate limited to 3 req/sec (or 10 req/sec with API key) - See module docstring for comprehensive query syntax examples - Cached results have 1 hour TTL to balance freshness and API usage
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | Yes | ||
| query | Yes | ||
| max_results | No | ||
| sort | No | relevance | |
| use_cache | No |