Skip to main content
Glama
BACH-AI-Tools

Clinical Trials MCP Server

get_study_details

Retrieve comprehensive clinical trial information using the NCT ID to access study details, eligibility criteria, and outcomes from ClinicalTrials.gov.

Instructions

Get detailed information about a specific clinical trial

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nctIdYesNCT ID of the study (e.g., NCT00000419)

Implementation Reference

  • The handler function for 'get_study_details' tool, which fetches study details from the ClinicalTrials.gov API using an NCT ID.
    async handleGetStudyDetails(args) {
        if (!args?.nctId || !/^NCT\d{8}$/.test(args.nctId)) {
            throw new McpError(ErrorCode.InvalidParams, "Valid NCT ID is required (format: NCT########)");
        }
        try {
            // Use the same endpoint as search but filter by NCT ID
            const response = await this.axiosInstance.get("/studies", {
                params: {
                    format: "json",
                    "query.term": args.nctId,
                    "filter.ids": args.nctId,
                    pageSize: 1,
                },
            });
            if (!response.data.studies || response.data.studies.length === 0) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `No study found with NCT ID: ${args.nctId}`,
                        },
                    ],
                    isError: true,
                };
            }
            const study = response.data.studies[0];
            const detailedInfo = this.formatDetailedStudy(study);
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(detailedInfo, null, 2),
                    },
                ],
            };
        }
        catch (error) {
            if (axios.isAxiosError(error)) {
                if (error.response?.status === 404) {
                    return {
                        content: [
                            {
                                type: "text",
                                text: `Study not found: ${args.nctId}`,
                            },
                        ],
                        isError: true,
                    };
                }
                return {
                    content: [
                        {
                            type: "text",
                            text: `Clinical Trials API error: ${error.response?.data?.message || error.message}`,
                        },
                    ],
                    isError: true,
                };
            }
            throw error;
        }
    }
  • build/index.js:106-120 (registration)
    The registration of the 'get_study_details' tool in the MCP server tool list.
    {
        name: "get_study_details",
        description: "Get detailed information about a specific clinical trial",
        inputSchema: {
            type: "object",
            properties: {
                nctId: {
                    type: "string",
                    description: "NCT ID of the study (e.g., NCT00000419)",
                    pattern: "^NCT\\d{8}$",
                },
            },
            required: ["nctId"],
        },
    },
  • build/index.js:615-616 (registration)
    Tool routing logic to call 'handleGetStudyDetails' when 'get_study_details' is requested.
    case "get_study_details":
        return await this.handleGetStudyDetails(request.params.arguments);

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