Skip to main content
Glama
BACH-AI-Tools

Clinical Trials MCP Server

get_study_timeline

Retrieve detailed timeline and milestone information for clinical trials, filtering by condition, sponsor, phase, and timeline type to track study progress.

Instructions

Get detailed timeline and milestone information for studies

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conditionNoCondition to filter studies
sponsorNoSponsor to filter studies
phaseNoStudy phase filter
timelineTypeNoType of timeline analysisCURRENT
pageSizeNoNumber of results to return (default 10, max 50)

Implementation Reference

  • Handler function for 'get_study_timeline' tool.
    async handleGetStudyTimeline(args) {
        const params = {
            format: "json",
            pageSize: args?.pageSize || 10,
        };
        if (args?.condition) {
            params["query.cond"] = args.condition;
        }
        if (args?.sponsor) {
            params["query.spons"] = args.sponsor;
        }
        if (args?.phase) {
            params["filter.phase"] = args.phase;
        }
        // Apply timeline type filtering
        const timelineType = args?.timelineType || "CURRENT";
        switch (timelineType) {
            case "CURRENT":
                params["filter.overallStatus"] =
                    "RECRUITING,NOT_YET_RECRUITING,ACTIVE_NOT_RECRUITING";
                break;
            case "COMPLETED":
                params["filter.overallStatus"] = "COMPLETED";
                break;
            case "UPCOMING":
                params["filter.overallStatus"] = "NOT_YET_RECRUITING";
                const futureDate = new Date();
                futureDate.setDate(futureDate.getDate() + 30);
                params["filter.studyStartDateFrom"] = futureDate
                    .toISOString()
                    .split("T")[0];
                break;
        }
        try {
            const response = await this.axiosInstance.get("/studies", { params });
            const studies = response.data.studies || [];
            const results = studies.map((study) => ({
                ...this.formatStudySummary(study),
                timeline: {
                    startDate: study.protocolSection.statusModule.startDateStruct?.date,
                    primaryCompletionDate: study.protocolSection.statusModule.primaryCompletionDateStruct
                        ?.date,
                    status: study.protocolSection.statusModule.overallStatus,
                    daysFromStart: study.protocolSection.statusModule.startDateStruct
                        ?.date
                        ? Math.floor((new Date().getTime() -
                            new Date(study.protocolSection.statusModule.startDateStruct.date).getTime()) /
                            (1000 * 60 * 60 * 24))
                        : null,
                },
            }));
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify({
                            searchCriteria: {
                                condition: args?.condition,
                                sponsor: args?.sponsor,
                                phase: args?.phase,
                                timelineType,
                            },
                            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:536-568 (registration)
    Registration of 'get_study_timeline' tool in ListTools request handler.
        name: "get_study_timeline",
        description: "Get detailed timeline and milestone information for studies",
        inputSchema: {
            type: "object",
            properties: {
                condition: {
                    type: "string",
                    description: "Condition to filter studies",
                },
                sponsor: {
                    type: "string",
                    description: "Sponsor to filter studies",
                },
                phase: {
                    type: "string",
                    description: "Study phase filter",
                    enum: ["PHASE1", "PHASE2", "PHASE3", "PHASE4", "NA"],
                },
                timelineType: {
                    type: "string",
                    description: "Type of timeline analysis",
                    enum: ["CURRENT", "COMPLETED", "UPCOMING"],
                    default: "CURRENT",
                },
                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