Query NIAID Data Ecosystem
niaid_data_querySearch the NIAID Data Ecosystem for datasets, clinical studies, and publications. Use Elasticsearch queries to find, filter, and aggregate biomedical research resources.
Instructions
Search the NIAID Data Ecosystem for biomedical research resources.
Queries the NIAID Data Ecosystem API (https://data.niaid.nih.gov), which indexes datasets, clinical studies, publications, and other research resources related to infectious and immune-mediated diseases funded or supported by NIAID.
Supports Elasticsearch query string syntax for powerful full-text and field-specific searches. Results include datasets, clinical trials, repositories, computational tools, and more.
Args: params (QueryInput): Validated input parameters containing: - q (str): Elasticsearch query string. Use '' for all records. Supports field-specific syntax: 'name:COVID', 'author.name:Smith', '@type:Dataset', 'conditionsOfAccess:Open'. Default: ''. - size (Optional[int]): Number of results per page (1-1000). Default: 10. - offset (Optional[int]): Results to skip for pagination. Default: 0. - sort (Optional[str]): Sort field; prefix with '-' for descending (e.g., '-date'). Default: relevance score. - fields (Optional[str]): Comma-separated fields to return (e.g., 'name,description,@type,date'). Returns all fields if omitted. - aggs (Optional[List[str]]): Fields to aggregate/facet by (e.g., ['@type', 'conditionsOfAccess']). Useful for summarizing result distributions without reading each record. - facet_size (Optional[int]): Max aggregation buckets per field. Default: 10. - explain (Optional[bool]): Include relevance score explanation. - response_format (ResponseFormat): 'markdown' (default) for readable summaries or 'json' for complete structured data.
Returns: str: Formatted search results.
Markdown response includes:
- Total result count and pagination info
- For each hit: name, type, ID, score, description (truncated), URL, date
- Aggregation summaries (if aggs requested)
JSON response schema:
{
"total": int, # Total matching records
"count": int, # Records in this response
"offset": int, # Current pagination offset
"has_more": bool, # Whether more results are available
"next_offset": int | null, # Offset for next page
"took_ms": int, # Query time in milliseconds
"hits": [...], # Full record objects from the API
"aggregations": {...} # Aggregation buckets (if requested)
}
Error response: "Error: <message with suggested fix>"Examples: - Use when: "Find open-access COVID-19 datasets" -> params with q='COVID-19 AND @type:Dataset AND conditionsOfAccess:Open' - Use when: "What types of resources are available?" -> params with q='*', aggs=['@type'], size=0 - Use when: "Find datasets with access conditions distribution" -> params with q='@type:Dataset', aggs=['conditionsOfAccess'], size=5 - Use when: "Search for malaria resources sorted by date" -> params with q='malaria', sort='-date', size=20 - Use when: "Page through results" (after first call with offset=0, size=10) -> params with same q, offset=10, size=10
Error Handling: - Returns "Error: Invalid query (HTTP 400)..." if query syntax is invalid - Returns "Error: Rate limit exceeded (HTTP 429)..." if too many requests - Returns "Error: Request timed out..." if query is too broad/slow
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes | Input model for the NIAID Data query operation. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |