Skip to main content
Glama
BACH-AI-Tools

Clinical Trials MCP Server

search_by_intervention

Find clinical trials by specifying a treatment, drug, device, or intervention type. Filter results by study phase to identify relevant research studies.

Instructions

Search clinical trials by intervention or treatment type

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
interventionYesIntervention, drug, device, or treatment name
interventionTypeNoType of intervention
phaseNoStudy phase filter
pageSizeNoNumber of results to return (default 10, max 100)

Implementation Reference

  • The handler function `handleSearchByIntervention` executes the logic to fetch clinical trials by intervention using the ClinicalTrials.gov API.
    private async handleSearchByIntervention(args: any) {
      if (!args?.intervention) {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Intervention parameter is required"
        );
      }
    
      const params: any = {
        format: "json",
        pageSize: args?.pageSize || 10,
        "query.intr": args.intervention,
      };
    
      if (args?.interventionType) {
        params["filter.interventionType"] = args.interventionType;
      }
    
      if (args?.phase) {
        params["filter.phase"] = args.phase;
      }
    
      try {
        const response: AxiosResponse<StudySearchResponse> =
          await this.axiosInstance.get("/studies", { params });
    
        const studies = response.data.studies || [];
        const results = studies.map((study) => this.formatStudySummary(study));
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  searchCriteria: {
                    intervention: args.intervention,
                    interventionType: args.interventionType,
                    phase: args.phase,
                  },
                  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:328-366 (registration)
    The tool `search_by_intervention` is registered in the list of tools with its schema definition.
      name: "search_by_intervention",
      description:
        "Search clinical trials by intervention or treatment type",
      inputSchema: {
        type: "object",
        properties: {
          intervention: {
            type: "string",
            description: "Intervention, drug, device, or treatment name",
            minLength: 2,
          },
          interventionType: {
            type: "string",
            description: "Type of intervention",
            enum: [
              "DRUG",
              "DEVICE",
              "BIOLOGICAL",
              "PROCEDURE",
              "BEHAVIORAL",
              "OTHER",
            ],
          },
          phase: {
            type: "string",
            description: "Study phase filter",
            enum: ["PHASE1", "PHASE2", "PHASE3", "PHASE4", "NA"],
          },
          pageSize: {
            type: "number",
            description:
              "Number of results to return (default 10, max 100)",
            minimum: 1,
            maximum: 100,
          },
        },
        required: ["intervention"],
      },
    },
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. While 'search' implies a read-only operation, the description doesn't mention any behavioral traits such as pagination behavior (implied by pageSize parameter but not explained), rate limits, authentication requirements, or what happens when no results are found. 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 that directly states the tool's purpose without any unnecessary words. It's appropriately sized and front-loaded with the essential information.

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?

For a search tool with 4 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what the search returns (trial names, IDs, details?), how results are structured, or any limitations beyond what's implied by parameters. The context signals indicate this tool needs more comprehensive documentation.

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%, meaning all parameters are well-documented in the schema itself. The description adds no additional parameter information beyond what's already in the schema (e.g., it doesn't explain how intervention matching works or provide examples). This meets the baseline expectation when schema coverage is complete.

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 as searching clinical trials by intervention or treatment type, which includes a specific verb ('search') and resource ('clinical trials'). However, it doesn't explicitly differentiate from sibling tools like 'search_by_condition' or 'search_by_sponsor', which also search clinical trials but by different criteria.

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. With multiple sibling search tools available (e.g., search_by_condition, search_by_location), there's no indication of when intervention-based searching is appropriate or when other search methods might be better suited.

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/BACH-AI-Tools/ClinicalTrials-MCP-Server'

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