Skip to main content
Glama
BACH-AI-Tools

Clinical Trials MCP Server

search_rare_diseases

Search clinical trials for rare diseases and orphan conditions to find relevant studies and recruitment opportunities.

Instructions

Search clinical trials for rare diseases and orphan conditions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rareDiseaseYesRare disease or orphan condition name
recruitmentStatusNoFilter by recruitment status
pageSizeNoNumber of results to return (default 10, max 100)

Implementation Reference

  • The handler implementation for the 'search_rare_diseases' tool, which searches for rare diseases using the ClinicalTrials.gov API.
    private async handleSearchRareDiseases(args: any) {
      if (!args?.rareDisease) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Rare disease parameter is required"
        );
      }
    
      const params: any = {
        format: "json",
        pageSize: args?.pageSize || 10,
        "query.cond": args.rareDisease,
      };
    
      if (args?.recruitmentStatus) {
        params["filter.overallStatus"] = args.recruitmentStatus;
      }
    
      // Add terms commonly associated with rare diseases
      params["query.term"] = `${args.rareDisease} OR orphan OR rare`;
    
      try {
        const response: AxiosResponse<StudySearchResponse> =
          await this.axiosInstance.get("/studies", { params });
    
        const studies = response.data.studies || [];
        const results = studies.map((study) => ({
          ...this.formatStudySummary(study),
          conditions: study.protocolSection.conditionsModule?.conditions || [],
          eligibility: {
            sex: study.protocolSection.eligibilityModule?.sex || "Unknown",
            minimumAge:
              study.protocolSection.eligibilityModule?.minimumAge ||
              "Not specified",
            maximumAge:
              study.protocolSection.eligibilityModule?.maximumAge ||
              "Not specified",
          },
        }));
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  searchCriteria: {
                    rareDisease: args.rareDisease,
                    recruitmentStatus: args?.recruitmentStatus,
                    searchNote: "Includes orphan and rare disease designations",
                  },
                  totalCount: response.data.totalCount || 0,
                  resultsShown: results.length,
                  studies: results,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          return {
            content: [
              {
                type: "text",
                text: `Clinical Trials API error: ${
                  error.response?.data?.message || error.message
                }`,
              },
            ],
            isError: true,
          };
        }
        throw error;
      }
    }
  • src/index.ts:469-495 (registration)
    Tool registration for 'search_rare_diseases' in the list of available tools.
      name: "search_rare_diseases",
      description:
        "Search clinical trials for rare diseases and orphan conditions",
      inputSchema: {
        type: "object",
        properties: {
          rareDisease: {
            type: "string",
            description: "Rare disease or orphan condition name",
            minLength: 2,
          },
          recruitmentStatus: {
            type: "string",
            description: "Filter by recruitment status",
            enum: ["RECRUITING", "NOT_YET_RECRUITING", "COMPLETED"],
          },
          pageSize: {
            type: "number",
            description:
              "Number of results to return (default 10, max 100)",
            minimum: 1,
            maximum: 100,
          },
        },
        required: ["rareDisease"],
      },
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.1

TDQS

A3.8/5.0
Behavior3/5

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

No annotations are provided, so the description carries the burden. The verb 'search' implies a read-only operation, but the description does not disclose details such as pagination behavior, permissions, or return format. For a non-destructive search tool, this is minimal but acceptable.

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, front-loaded sentence that directly states the action and scope with no redundant words. Every word earns its place.

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

Completeness4/5

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

For a simple search tool, the description is adequate: purpose is clear, and the schema covers parameters. However, given the large number of sibling search tools, a brief note about this tool's unique focus on rare diseases (as opposed to general conditions) would improve completeness.

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%: all three parameters (pageSize, rareDisease, recruitmentStatus) have descriptions in the schema. The tool description adds no parameter-specific information beyond what the schema already provides, so baseline 3 is appropriate.

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

Purpose5/5

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

The description clearly states the tool searches clinical trials specifically for rare diseases and orphan conditions, which distinguishes it from general search tools like search_studies or search_by_condition. The verb 'search' and resource 'clinical trials' are specific, and the scope is explicitly limited to rare diseases.

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

Usage Guidelines3/5

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

The description implies the tool is intended for rare disease queries, but it does not explicitly mention when to use this tool instead of alternatives like search_by_condition or search_studies, nor does it state exclusions. Usage context is clear from the name and description, but no alternatives are named.

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