Skip to main content
Glama
Augmented-Nature

OpenTargets MCP Server

search_diseases

Search for diseases by name, synonym, or description to find relevant medical conditions in the OpenTargets platform for research purposes.

Instructions

Search for diseases by name, synonym, or description

Input Schema

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

Implementation Reference

  • The main handler function for the search_diseases tool. Validates input arguments, executes a GraphQL query against Open Targets API to search for diseases, limits the results, formats the response as JSON, and handles errors.
    private async handleSearchDiseases(args: any) {
      if (!isValidDiseaseSearchArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid disease search arguments');
      }
    
      try {
        const query = `
          query SearchDiseases($queryString: String!) {
            search(queryString: $queryString, entityNames: ["disease"]) {
              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 diseases: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • The input schema and metadata (name, description) for the search_diseases tool, registered in the ListTools response.
    {
      name: 'search_diseases',
      description: 'Search for diseases by name, synonym, or description',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string', description: 'Search query (disease name, synonym, 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:294-295 (registration)
    The switch case in the CallToolRequestHandler that registers and dispatches search_diseases tool calls to the handler function.
    case 'search_diseases':
      return this.handleSearchDiseases(args);
  • Type guard and validation function specifically for validating the input arguments of the search_diseases tool.
    const isValidDiseaseSearchArgs = (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. It mentions search functionality but doesn't disclose behavioral traits such as pagination, rate limits, authentication needs, or what the search returns (e.g., list of IDs, full details). This leaves significant gaps for a search tool.

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 with no wasted words. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

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 search tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the search returns (e.g., partial matches, relevance scoring), behavioral aspects, or how it differs from siblings, leaving the agent with insufficient context.

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 schema already documents all parameters (query, size, format) with details like defaults and constraints. The description adds minimal value by listing search fields (name, synonym, description), but this is largely redundant with the schema's query description.

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 'search' and the resource 'diseases', specifying it can search by name, synonym, or description. However, it doesn't explicitly differentiate from sibling tools like 'search_targets' or 'get_disease_details', which would require a 5.

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_targets' or 'get_disease_details'. It lacks context about use cases, prerequisites, or exclusions, offering only a basic functional statement.

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