Skip to main content
Glama
Augmented-Nature

OpenTargets MCP Server

get_target_disease_associations

Retrieve evidence-based associations between genes and diseases with scoring to identify potential therapeutic targets for research.

Instructions

Get target-disease associations with evidence scores

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetIdNoTarget Ensembl gene ID
diseaseIdNoDisease EFO ID
minScoreNoMinimum association score (0-1)
sizeNoNumber of results to return (1-500, default: 25)

Implementation Reference

  • The main execution logic for the 'get_target_disease_associations' tool. Validates arguments, constructs and executes GraphQL queries to fetch target-disease associations from Open Targets API based on targetId or diseaseId, handles specific pair lookup (not implemented), and returns JSON results or errors.
    private async handleGetTargetDiseaseAssociations(args: any) {
      if (!isValidAssociationArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid association arguments');
      }
    
      try {
        // If only targetId provided, get associations for that target
        if (args.targetId && !args.diseaseId) {
          const query = `query GetTargetAssociations($ensemblId: String!) { target(ensemblId: $ensemblId) { id approvedSymbol associatedDiseases { rows { disease { id name } score } } } }`;
    
          const response = await this.graphqlClient.post('', {
            query,
            variables: {
              ensemblId: args.targetId,
              size: args.size || 25
            }
          });
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(response.data, null, 2),
              },
            ],
          };
        }
    
        // If only diseaseId provided, get associations for that disease
        else if (args.diseaseId && !args.targetId) {
          const query = `query GetDiseaseAssociations($efoId: String!) { disease(efoId: $efoId) { id name associatedTargets { rows { target { id approvedSymbol approvedName } score } } } }`;
    
          const response = await this.graphqlClient.post('', {
            query,
            variables: {
              efoId: args.diseaseId,
              size: args.size || 25
            }
          });
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(response.data, null, 2),
              },
            ],
          };
        }
    
        // If both provided, return the association between them
        else {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  message: "Specific target-disease pair association lookup not yet implemented",
                  suggestion: "Use targetId OR diseaseId to get associations for that entity"
                }, null, 2),
              },
            ],
          };
        }
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error getting associations: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • JSON Schema defining the input parameters for the tool: targetId, diseaseId, minScore, size. No required fields, allowing queries by target or disease.
    inputSchema: {
      type: 'object',
      properties: {
        targetId: { type: 'string', description: 'Target Ensembl gene ID' },
        diseaseId: { type: 'string', description: 'Disease EFO ID' },
        minScore: { type: 'number', description: 'Minimum association score (0-1)', minimum: 0, maximum: 1 },
        size: { type: 'number', description: 'Number of results to return (1-500, default: 25)', minimum: 1, maximum: 500 },
      },
      required: [],
    },
  • src/index.ts:236-249 (registration)
    Registration of the tool in the ListTools handler response array, including name, description, and input schema.
    {
      name: 'get_target_disease_associations',
      description: 'Get target-disease associations with evidence scores',
      inputSchema: {
        type: 'object',
        properties: {
          targetId: { type: 'string', description: 'Target Ensembl gene ID' },
          diseaseId: { type: 'string', description: 'Disease EFO ID' },
          minScore: { type: 'number', description: 'Minimum association score (0-1)', minimum: 0, maximum: 1 },
          size: { type: 'number', description: 'Number of results to return (1-500, default: 25)', minimum: 1, maximum: 500 },
        },
        required: [],
      },
    },
  • Type guard and validation function for association tool arguments, ensuring valid types and at least one ID provided.
    const isValidAssociationArgs = (args: any): args is { targetId?: string; diseaseId?: string; minScore?: number; size?: number } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        (args.targetId === undefined || typeof args.targetId === 'string') &&
        (args.diseaseId === undefined || typeof args.diseaseId === 'string') &&
        (args.minScore === undefined || (typeof args.minScore === 'number' && args.minScore >= 0 && args.minScore <= 1)) &&
        (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 500)) &&
        (args.targetId !== undefined || args.diseaseId !== undefined)
      );
    };
  • src/index.ts:296-297 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes the tool call to the specific handler method.
    case 'get_target_disease_associations':
      return this.handleGetTargetDiseaseAssociations(args);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'evidence scores' but doesn't explain what these scores represent, how they are calculated, or any limitations like rate limits, permissions, or data freshness. For a tool with 4 parameters and no annotations, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without any unnecessary words. It is front-loaded with the core action and resource, making it easy to parse and understand quickly.

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

Completeness2/5

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

Given the complexity of a tool with 4 parameters, no annotations, and no output schema, the description is insufficient. It doesn't cover behavioral aspects like what the evidence scores mean, how results are structured, or any error conditions. This leaves critical gaps for an AI agent to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with each parameter well-documented in the input schema (e.g., 'Target Ensembl gene ID', 'Minimum association score (0-1)'). The description adds no additional meaning beyond the schema, such as explaining relationships between parameters or typical use cases, so it meets the baseline score of 3.

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 clearly states the verb 'Get' and the resource 'target-disease associations with evidence scores', making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_disease_targets_summary' or 'search_targets', which might also retrieve similar data, so it misses the top score for sibling differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'get_disease_targets_summary' or 'search_targets'. It lacks any context about prerequisites, such as needing specific IDs, or exclusions, leaving the agent to infer usage based on parameter names alone.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Augmented-Nature/OpenTargets-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server