Skip to main content
Glama
BACH-AI-Tools

Clinical Trials MCP Server

get_recruiting_studies

Find currently recruiting clinical trials with contact details by filtering medical condition, location, and age group eligibility.

Instructions

Get currently recruiting clinical trials with contact information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conditionNoMedical condition to filter by
locationNoGeographic location (city, state, country)
ageGroupNoAge group eligibility
pageSizeNoNumber of results to return (default 10, max 50)

Implementation Reference

  • The handleGetRecruitingStudies method implements the logic for the "get_recruiting_studies" tool, querying the ClinicalTrials.gov API for studies with "RECRUITING" status.
    private async handleGetRecruitingStudies(args: any) {
      const params: any = {
        format: "json",
        pageSize: args?.pageSize || 10,
        "filter.overallStatus": "RECRUITING",
      };
    
      if (args?.condition) {
        params["query.cond"] = args.condition;
      }
    
      if (args?.location) {
        params["query.locn"] = args.location;
      }
    
      if (args?.ageGroup) {
        params["filter.stdAge"] = args.ageGroup;
      }
    
      try {
        const response: AxiosResponse<StudySearchResponse> =
          await this.axiosInstance.get("/studies", { params });
    
        const studies = response.data.studies || [];
        const results = studies.map((study) => ({
          ...this.formatStudySummary(study),
          eligibility: {
            sex: study.protocolSection.eligibilityModule?.sex || "Unknown",
            minimumAge:
              study.protocolSection.eligibilityModule?.minimumAge ||
              "Not specified",
            maximumAge:
              study.protocolSection.eligibilityModule?.maximumAge ||
              "Not specified",
            healthyVolunteers:
              study.protocolSection.eligibilityModule?.healthyVolunteers || false,
          },
          locations:
            study.protocolSection.contactsLocationsModule?.locations?.slice(
              0,
              2
            ) || [],
        }));
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  searchCriteria: {
                    recruitmentStatus: "RECRUITING",
                    condition: args?.condition,
                    location: args?.location,
                    ageGroup: args?.ageGroup,
                  },
                  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:368-395 (registration)
    Registration of the "get_recruiting_studies" tool with its input schema definition.
      name: "get_recruiting_studies",
      description:
        "Get currently recruiting clinical trials with contact information",
      inputSchema: {
        type: "object",
        properties: {
          condition: {
            type: "string",
            description: "Medical condition to filter by",
          },
          location: {
            type: "string",
            description: "Geographic location (city, state, country)",
          },
          ageGroup: {
            type: "string",
            description: "Age group eligibility",
            enum: ["CHILD", "ADULT", "OLDER_ADULT"],
          },
          pageSize: {
            type: "number",
            description: "Number of results to return (default 10, max 50)",
            minimum: 1,
            maximum: 50,
          },
        },
      },
    },

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