Skip to main content
Glama
opentargets

Open Targets Platform MCP

Official
by opentargets

query_open_targets_graphql

Read-only

Execute GraphQL queries against the Open Targets Platform API to retrieve target-disease associations, drugs, genes, and variant data.

Instructions

Execute GraphQL queries against the Open Targets Platform API.

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: "BRCA2" -> ENSEMBL ID "ENSG00000139618"
- Diseases: "breast cancer" -> EFO/MONDO ID "MONDO_0007254"
- Drugs: "aspirin" -> ChEMBL ID "CHEMBL1201583"
- Variants: Use "chr_pos_ref_alt" format or rsIDs

Example: search_entity(query_string="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 QUERY Build GraphQL query using: - Standardized IDs from Step 1 (REQUIRED) - Query structure from Step 2 - Follow the "COMMON MISTAKES TO AVOID" guidance in the schema output

Call this tool with query_string and optional variables.

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): GraphQL query string starting with 'query' keyword. variables (UnionType[dict[str, Any], None]): Optional dict or JSON string with query variables.

Returns: (QueryResult): GraphQL response with data field containing targets, diseases, drugs, variants, studies or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
variablesNoOptional dict or JSON string with query variables.
query_stringYesGraphQL query string starting with 'query' keyword.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNoThe data returned by the query. Data could still be available even if the status is not success and it MUST be treated with caution as it may be INCOMPLETE or UNRELIABLE.
statusYesThe status of the query result.
messageNoThe message associated with the query result. This field is typically used to provide additional information about the non-successful query result, such as error details or warnings.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations declare readOnlyHint=true, and the description is consistent with that. It adds useful behavioral context beyond the annotation: required identifier formats, the necessity of building queries from the fetched schema, and the shape of the return value. No contradiction exists.

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?

The description is long but well-structured with numbered workflow steps, clear headers, and a separate section for required identifier formats. It is front-loaded with the core action. Some redundancy exists in the Args/Returns section, which mirrors the schema, but the overall structure earns its length for a complex GraphQL tool.

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

Completeness5/5

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

Given the tool's complexity, the presence of an output schema, and readOnlyHint annotation, the description is very complete. It covers the full workflow, fallback strategies, required ID formats, query construction guidance, and expected return shape. No material information an agent needs to call it correctly is missing.

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 description coverage is 100%, so the baseline is 3, but the description adds real value by requiring standardized IDs, enumerating the exact ID formats per entity type, and mandating that the query string start with 'query'. This goes beyond the schema's terse property descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Execute GraphQL queries against the Open Targets Platform API.' It clearly states what the tool does and includes a detailed workflow, but it does not explicitly distinguish this tool from the sibling batch_query_open_targets_graphql, so the differentiation is left implicit.

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?

The description gives a strong sequential workflow: resolve identifiers with a search tool, learn query structure via get_open_targets_graphql_schema, use get_type_dependencies as fallback, then call this tool. However, it refers to 'search_entity' while the actual sibling is 'search_entities', and it never explains when to choose this tool over batch_query_open_targets_graphql.

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