batch_query_open_targets_graphql
Execute the same GraphQL query with multiple variable sets to retrieve Open Targets data for many drugs, targets, or diseases in a single batch.
Instructions
Execute the same GraphQL query multiple times with different variable sets.
Use this tool instead of the regular query tool when you need to run the same query repeatedly with different arguments (e.g., querying multiple drugs, targets, or diseases).
WORKFLOW - Follow these steps in order:
Step 1: RESOLVE IDENTIFIERS
If user provides common names (gene symbols, disease names, drug names),
use search_entity tool FIRST to convert them to standardized IDs:
- Targets/Genes: "BRCA1", "BRCA2" -> ENSEMBL IDs "ENSG00000012048", "ENSG00000139618"
- Diseases: "breast cancer" -> EFO/MONDO ID "MONDO_0007254"
- Drugs: "aspirin", "ibuprofen" -> ChEMBL IDs "CHEMBL1201583", "CHEMBL521"
- Variants: Use "chr_pos_ref_alt" format or rsIDs
Example: search_entity(query_string="BRCA1 BRCA2", entity_names=["target"])Step 2: LEARN QUERY STRUCTURE
Call get_open_targets_graphql_schema with relevant categories to retrieve
the schema subset needed for your query. Select categories that cover the
data domains you need - BE INCLUSIVE (it's better to include extra categories
than to miss required types).
Example: For a query about drug mechanisms and safety:
get_open_targets_graphql_schema(categories=["drug-mechanisms", "drug-safety"])
Study the returned schema to understand available types, fields, and their
relationships, then construct a GraphQL query that fetches the information
the user needs.
FALLBACK: If you encounter errors or need detailed information about specific
types, use `get_type_dependencies` sparingly to explore type relationships.
This tool provides exhaustive type dependency information but should only be
used when category-based retrieval is insufficient.Step 3: CONSTRUCT AND EXECUTE BATCH QUERY Build GraphQL query and variables_list using: - Standardized IDs from Step 1 (REQUIRED) - Query patterns from Step 2 - Follow the "COMMON MISTAKES TO AVOID" guidance in the schema output
Call this tool with query_string, variables_list, and key_field.REQUIRED IDENTIFIER FORMATS:
Targets/Genes: ENSEMBL IDs (e.g., "ENSG00000139618")
Diseases: EFO IDs (e.g., "EFO_0000305") or MONDO IDs (e.g., "MONDO_0007254")
Drugs: ChEMBL IDs (e.g., "CHEMBL1201583")
Variants: "chr_pos_ref_alt" format (e.g., "19_44908822_C_T") or rsIDs (e.g., "rs7412")
Studies: Study IDs (e.g., "GCST90002357")
Credible Sets: Study Locus IDs (e.g., "7d68cc9c70351c9dbd2a2c0c145e555d")
Args: query_string (str): The GraphQL query string to execute for all variable sets. variables_list (list[dict[str, Any]]): List of variable dictionaries, one per query execution. key_field (str): Variable field name to use as key in results mapping.
Returns: (BatchQueryResult): Results keyed by the specified field value, with execution summary.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key_field | Yes | Variable field name to use as key in results mapping. | |
| query_string | Yes | The GraphQL query string to execute for all variable sets. | |
| variables_list | Yes | List of variable dictionaries, one per query execution. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| results | Yes | ||
| status_counts | Yes |