Skip to main content
Glama
Augmented-Nature

OpenTargets MCP Server

search_targets

Search for therapeutic targets using gene symbols, names, or descriptions to identify potential drug targets for disease research.

Instructions

Search for therapeutic targets by gene symbol, name, or description

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (gene symbol, name, description)
sizeNoNumber of results to return (1-500, default: 25)
formatNoOutput format (default: json)

Implementation Reference

  • The handler function that implements the core logic of the 'search_targets' tool: validates input, executes a GraphQL query to the Open Targets API to search for targets, limits results based on size parameter, and returns formatted JSON response.
    private async handleSearchTargets(args: any) {
      if (!isValidTargetSearchArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid target search arguments');
      }
    
      try {
        const query = `
          query SearchTargets($queryString: String!) {
            search(queryString: $queryString, entityNames: ["target"]) {
              hits {
                id
                name
                description
                entity
              }
            }
          }
        `;
    
        const response = await this.graphqlClient.post('', {
          query,
          variables: {
            queryString: args.query
          }
        });
    
        // Limit results on client side
        const hits = response.data.data?.search?.hits || [];
        const limitedHits = hits.slice(0, args.size || 25);
        const result = {
          ...response.data,
          data: {
            search: {
              hits: limitedHits,
              total: hits.length
            }
          }
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error searching targets: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • JSON Schema defining the input parameters for the 'search_targets' tool, including required 'query' string and optional 'size' and 'format'.
    inputSchema: {
      type: 'object',
      properties: {
        query: { type: 'string', description: 'Search query (gene symbol, name, description)' },
        size: { type: 'number', description: 'Number of results to return (1-500, default: 25)', minimum: 1, maximum: 500 },
        format: { type: 'string', enum: ['json', 'tsv'], description: 'Output format (default: json)' },
      },
      required: ['query'],
    },
  • src/index.ts:210-222 (registration)
    Registration of the 'search_targets' tool in the ListTools response, specifying name, description, and input schema.
    {
      name: 'search_targets',
      description: 'Search for therapeutic targets by gene symbol, name, or description',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string', description: 'Search query (gene symbol, name, description)' },
          size: { type: 'number', description: 'Number of results to return (1-500, default: 25)', minimum: 1, maximum: 500 },
          format: { type: 'string', enum: ['json', 'tsv'], description: 'Output format (default: json)' },
        },
        required: ['query'],
      },
    },
  • src/index.ts:292-293 (registration)
    Switch case in CallToolRequest handler that dispatches calls to 'search_targets' to the handleSearchTargets method.
    case 'search_targets':
      return this.handleSearchTargets(args);
  • Type guard and validation helper function used by the handler to validate input arguments for 'search_targets'.
    const isValidTargetSearchArgs = (args: any): args is { query: string; size?: number; format?: string } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.query === 'string' &&
        args.query.length > 0 &&
        (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 500)) &&
        (args.format === undefined || ['json', 'tsv'].includes(args.format))
      );
    };
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 states the search functionality but lacks critical details: whether this is a read-only operation, if it requires authentication, rate limits, pagination behavior, or what the response structure looks like. For a search tool with zero annotation coverage, this is inadequate.

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 purpose without unnecessary words. It's appropriately sized and front-loaded, with every element contributing value.

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 lack of annotations and output schema, the description is insufficient for a search tool with three parameters. It doesn't explain return values, error conditions, or behavioral constraints, leaving significant gaps in understanding how 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%, so the input schema fully documents all three parameters. The description mentions the searchable fields (gene symbol, name, description) which aligns with the 'query' parameter but doesn't add meaningful semantics beyond what the schema already provides. Baseline 3 is appropriate when the schema does the heavy lifting.

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 tool's purpose: searching for therapeutic targets using specific search criteria (gene symbol, name, or description). It uses a specific verb ('search') and resource ('therapeutic targets'), but doesn't explicitly differentiate from sibling tools like 'search_diseases' or 'get_target_details', which prevents a perfect score.

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 'search_diseases' or 'get_target_details'. It doesn't mention prerequisites, context, or exclusions, leaving the agent to infer usage based solely on the tool name and parameters.

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