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,
                },
            },
        },
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.1

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are provided, so the description carries full responsibility for behavioral disclosure. It only states 'detailed timeline and milestone information' without explaining how timelineType affects results, what milestones mean, or any filtering semantics. This is insufficient for a tool with 5 optional parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence and front-loads the main action ('Get detailed timeline...'). It is concise and well-structured, though perhaps too sparse for the tool's complexity. No unnecessary words.

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?

With 5 optional parameters, no output schema, and no annotations, the single-sentence description is incomplete. It fails to mention timeline types, default behavior, return format, or any usage context, making it difficult for an agent to invoke correctly without additional guidance.

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?

The schema description coverage is 100%, with all parameters documented and enums for phase and timelineType. The tool description adds no parameter-specific meaning, so the baseline 3 applies; the schema handles the heavy lifting.

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 a specific resource (studies) and type of information (timeline and milestone). It is more specific than the generic sibling name 'get_study_details', but does not mention the timeline types (current/completed/upcoming) that are part of the schema, so it misses some distinguishing detail.

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 siblings like search_studies or get_study_details. With many study-related tools listed, the absence of context or exclusions leaves the agent to guess the appropriate use case.

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