Skip to main content
Glama

Search NCBI databases (ESearch)

ncbi_esearch
Read-only

Search NCBI Entrez databases with field-tagged queries to retrieve matching record IDs for summary, fetch, or SPARQL anchoring.

Instructions

Search NCBI Entrez databases with E-utilities ESearch (https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi) and return the matching record IDs, for use with ncbi_esummary / ncbi_efetch or as SPARQL anchors.

Recall depends heavily on NCBI field tags for Gene, ClinVar and similar databases: an untagged query is matched loosely and misses most relevant records. Gene field tags: • [Organism] - taxonomic filter (e.g. "Homo sapiens[Organism]", "Archaea[Organism]") • [Gene Name] - gene symbol (e.g. "TP53[Gene Name]", "nifH[Gene Name]") • [All Fields] - broad keyword (e.g. "nitrogenase[All Fields]")

Measured on Gene for archaeal nitrogenase genes: • query="Archaea[Organism] AND (nifH[Gene Name] OR nitrogenase[All Fields])" → ~1,300 records (full recall) • query="archaea AND nifH" → ~300 records (~23% recall)

RETURNS formatted text results carrying the database-specific IDs. On a missing/invalid database or query it returns a single text item whose message begins with "Error:" — check for that prefix before using the IDs.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "ncbi_esearch"
  }
}

Input Schema

NameRequiredDescriptionDefault
dbNoAlias for `database`.
termNoAlias for `query`.
queryNoSearch query with NCBI field tags and boolean operators (alias: `term`)
retmaxNoAlias for `max_results` (the E-utilities name).
sort_byNoOptional sort order (e.g., "relevance", "pub_date" for PubMed)
databaseNoNCBI database name (alias: `db`). Supported values: - "gene" or "ncbigene": NCBI Gene database ⚠️ FIELD TAGS CRITICAL - "taxonomy": NCBI Taxonomy (organism information) - "clinvar": ClinVar (genetic variants) ⚠️ FIELD TAGS CRITICAL - "medgen": MedGen (medical genetics concepts) - "mesh": MeSH (Medical Subject Headings) - "pubmed": PubMed (biomedical literature) - "pccompound": PubChem Compound - "pcsubstance": PubChem Substance - "pcassay": PubChem BioAssay
retstartNoAlias for `start_index` (the E-utilities name).
max_resultsNoMaximum number of results to return (default: 20; alias: `retmax`)
start_indexNoStarting index for pagination (default: 0; alias: `retstart`)
search_fieldNoOptional specific field to search in

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv2.34.1
    • changedInput schema / properties / max_results / description
      Previous value: -"Maximum number of results to return (default: 20)"New value: +"Maximum number of results to return (default: 20; alias: `retmax`)"
    • addedInput schema / properties / retmax
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Alias for `max_results` (the E-utilities name)."
      +}
    • addedInput schema / properties / retstart
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Alias for `start_index` (the E-utilities name)."
      +}
    • changedInput schema / properties / start_index / description
      Previous value: -"Starting index for pagination (default: 0)"New value: +"Starting index for pagination (default: 0; alias: `retstart`)"
  2. Changed8 schema fields changedv2.0.0
    • addedInput schema / properties / database / description
      Added value: +"NCBI database name (alias: `db`). Supported values:\n- \"gene\" or \"ncbigene\": NCBI Gene database ⚠️ FIELD TAGS CRITICAL\n- \"taxonomy\": NCBI Taxonomy (organism information)\n- \"clinvar\": ClinVar (genetic variants) ⚠️ FIELD TAGS CRITICAL\n- \"medgen\": MedGen (medical genetics concepts)\n- \"mesh\": MeSH (Medical Subject Headings)\n- \"pubmed\": PubMed (biomedical literature)\n- \"pccompound\": PubChem Compound\n- \"pcsubstance\": PubChem Substance\n- \"pcassay\": PubChem BioAssay"
    • addedInput schema / properties / db / description
      Added value: +"Alias for `database`."
    • addedInput schema / properties / max_results / description
      Added value: +"Maximum number of results to return (default: 20)"
    • addedInput schema / properties / query / description
      Added value: +"Search query with NCBI field tags and boolean operators (alias: `term`)"
    • addedInput schema / properties / search_field / description
      Added value: +"Optional specific field to search in"
    • addedInput schema / properties / sort_by / description
      Added value: +"Optional sort order (e.g., \"relevance\", \"pub_date\" for PubMed)"
    • addedInput schema / properties / start_index / description
      Added value: +"Starting index for pagination (default: 0)"
    • addedInput schema / properties / term / description
      Added value: +"Alias for `query`."
  3. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Beyond readOnlyHint/openWorldHint it discloses the return format (formatted text carrying database-specific IDs) and a specific failure contract: a single text item beginning with "Error:" on a missing/invalid database or query, with an explicit instruction to check that prefix before consuming IDs. The recall measurements are an unusual and genuinely valuable behavioral trait that annotations cannot express.

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?

Front-loaded with purpose, then query-construction guidance in short bullets, then the return/error contract — a sensible order with no filler. It runs long for a search tool, and the recall statistics, while persuasive, occupy a large share of the text for a single argument.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description correctly takes on responsibility for describing return values and error signaling, and it covers the field-tag subtleties that dominate result quality. Remaining gaps are minor: it does not explain whether a total hit count is available or how start_index/max_results interact for paging through large result sets.

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 parameter documentation is largely already present, including the alias pairs and the per-database list. The description still adds real meaning by showing how the query term should be structured with field tags and quantified recall loss without them — something the schema only hints at with "FIELD TAGS CRITICAL". It stops short of giving field-tag examples for ClinVar despite flagging that database as critical.

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?

States a specific verb and resource ("Search NCBI Entrez databases with E-utilities ESearch") and names what it returns (matching record IDs), with the upstream service URL. It also distinguishes itself from siblings by naming the downstream consumers (ncbi_esummary / ncbi_efetch) and the SPARQL-anchor use, so an agent can place it in a pipeline without opening another schema.

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

Usage Guidelines4/5

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

Gives concrete, actionable when-to-use context: this is the ID-producing step feeding esummary/efetch or SPARQL anchors, and it explains that untagged queries lose recall, backed by a measured comparison (~1,300 vs ~300 records). The gap is sibling selection against the many other search_* tools in the catalog (e.g. togovar_search_gene, search_mesh_descriptor), which the description never addresses.

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