Skip to main content
Glama
BACH-AI-Tools

Clinical Trials MCP Server

search_studies

Find clinical trials by condition, intervention, location, phase, status, and eligibility criteria to identify relevant research studies.

Instructions

Search for clinical trials with various filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoGeneral search term (condition, intervention, etc.)
conditionNoMedical condition or disease
interventionNoTreatment, drug, or intervention
locationNoGeographic location (city, state, country)
phaseNoStudy phase (PHASE1, PHASE2, PHASE3, PHASE4, NA)
statusNoRecruitment status
sexNoSex eligibility
ageNoAge group
pageSizeNoNumber of results to return (default 10, max 100)

Implementation Reference

  • Implementation of the search_studies tool handler.
    async handleSearchStudies(args) {
        const params = {
            format: "json",
            pageSize: args?.pageSize || 10,
        };
        // Build query parameters based on arguments
        if (args?.query) {
            params["query.term"] = args.query;
        }
        if (args?.condition) {
            params["query.cond"] = args.condition;
        }
        if (args?.intervention) {
            params["query.intr"] = args.intervention;
        }
        if (args?.location) {
            params["query.locn"] = args.location;
        }
        if (args?.phase) {
            params["filter.phase"] = args.phase;
        }
        if (args?.status) {
            params["filter.overallStatus"] = args.status;
        }
        if (args?.sex) {
            params["filter.sex"] = args.sex;
        }
        if (args?.age) {
            params["filter.stdAge"] = args.age;
        }
        try {
            const response = 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({
                            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;
        }
    }
  • build/index.js:48-105 (registration)
    Definition and registration of the search_studies tool in the ListToolsRequest handler.
    {
        name: "search_studies",
        description: "Search for clinical trials with various filters",
        inputSchema: {
            type: "object",
            properties: {
                query: {
                    type: "string",
                    description: "General search term (condition, intervention, etc.)",
                },
                condition: {
                    type: "string",
                    description: "Medical condition or disease",
                },
                intervention: {
                    type: "string",
                    description: "Treatment, drug, or intervention",
                },
                location: {
                    type: "string",
                    description: "Geographic location (city, state, country)",
                },
                phase: {
                    type: "string",
                    description: "Study phase (PHASE1, PHASE2, PHASE3, PHASE4, NA)",
                    enum: ["PHASE1", "PHASE2", "PHASE3", "PHASE4", "NA"],
                },
                status: {
                    type: "string",
                    description: "Recruitment status",
                    enum: [
                        "RECRUITING",
                        "NOT_YET_RECRUITING",
                        "COMPLETED",
                        "TERMINATED",
                        "SUSPENDED",
                        "WITHDRAWN",
                    ],
                },
                sex: {
                    type: "string",
                    description: "Sex eligibility",
                    enum: ["ALL", "FEMALE", "MALE"],
                },
                age: {
                    type: "string",
                    description: "Age group",
                    enum: ["CHILD", "ADULT", "OLDER_ADULT"],
                },
                pageSize: {
                    type: "number",
                    description: "Number of results to return (default 10, max 100)",
                    minimum: 1,
                    maximum: 100,
                },
            },
        },
    },

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