Skip to main content
Glama
PancrePal-xiaoyibao

Clinical Trials MCP Server

get_trial_details

Retrieve comprehensive clinical trial information including investigator details, study sites, contact information, eligibility criteria, and outcome measures from ClinicalTrials.gov using NCT ID.

Instructions

获取指定临床试验的详细信息,包括:PI研究者信息、各地医院地点、联系方式(电话/邮箱)、详细研究介绍、入选/排除标准、结果指标等全面信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nctIdYesNCT编号,例如:NCT04852770

Implementation Reference

  • The handler function for the 'get_trial_details' tool in the MCP server's CallToolRequestSchema request handler. It extracts the nctId from arguments, validates it, calls the ClinicalTrialsClient.getTrialDetails method, and returns the details as a JSON-formatted text response.
    case 'get_trial_details': {
      const { nctId } = args;
      if (!nctId) {
        throw new Error('NCT编号是必需的');
      }
      
      const details = await clinicalTrialsClient.getTrialDetails(nctId);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(details, null, 2),
          },
        ],
      };
    }
  • src/index.js:82-95 (registration)
    Registration of the 'get_trial_details' tool in the ListToolsRequestSchema handler, including its name, description, and input schema definition.
    {
      name: 'get_trial_details',
      description: '获取指定临床试验的详细信息,包括:PI研究者信息、各地医院地点、联系方式(电话/邮箱)、详细研究介绍、入选/排除标准、结果指标等全面信息',
      inputSchema: {
        type: 'object',
        properties: {
          nctId: {
            type: 'string',
            description: 'NCT编号,例如:NCT04852770',
          },
        },
        required: ['nctId'],
      },
    },
  • Input schema definition for the 'get_trial_details' tool, specifying the required 'nctId' parameter.
    inputSchema: {
      type: 'object',
      properties: {
        nctId: {
          type: 'string',
          description: 'NCT编号,例如:NCT04852770',
        },
      },
      required: ['nctId'],
    },
  • The core helper method in ClinicalTrialsClient that performs the API call to fetch trial details for a given NCT ID and formats the response using formatTrialDetails.
    async getTrialDetails(nctId) {
      try {
        const response = await this.axios.get(`/studies/${nctId}`);
        return this.formatTrialDetails(response.data);
      } catch (error) {
        throw this.handleError(error);
      }
    }
  • Supporting helper function that formats the raw ClinicalTrials.gov API response into a comprehensive structured object with key details like PI investigators, hospital locations with contacts, eligibility criteria, outcomes, etc.
    formatTrialDetails(data) {
      const protocol = data.protocolSection || {};
      const identification = protocol.identificationModule || {};
      const status = protocol.statusModule || {};
      const description = protocol.descriptionModule || {};
      const conditions = protocol.conditionsModule || {};
      const design = protocol.designModule || {};
      const arms = protocol.armsInterventionsModule || {};
      const outcomes = protocol.outcomesModule || {};
      const eligibility = protocol.eligibilityModule || {};
      const sponsor = protocol.sponsorCollaboratorsModule || {};
      const contacts = protocol.contactsLocationsModule || {};
    
      return {
        // === 基本信息 ===
        nctId: identification.nctId,
        title: identification.briefTitle,
        officialTitle: identification.officialTitle,
        acronym: identification.acronym,
        status: status.overallStatus,
        whyStopped: status.whyStopped,
        
        // === 疾病和关键词 ===
        conditions: conditions.conditions || [],
        keywords: conditions.keywords || [],
        
        // === 干预措施 ===
        interventions: arms.interventions?.map(i => ({
          type: i.type,
          name: i.name,
          description: i.description,
          otherNames: i.otherNames || [],
        })) || [],
        
        // === 研究设计 ===
        studyType: design.studyType,
        phase: design.phases || [],
        designInfo: design.designInfo,
        enrollmentCount: design.enrollmentInfo?.count,
        enrollmentType: design.enrollmentInfo?.type,
        
        // === 时间信息 ===
        startDate: status.startDateStruct?.date,
        primaryCompletionDate: status.primaryCompletionDateStruct?.date,
        completionDate: status.completionDateStruct?.date,
        lastUpdate: status.lastUpdatePostDateStruct?.date,
        studyFirstPostDate: status.studyFirstPostDateStruct?.date,
        
        // === 主办方和研究者 ===
        leadSponsor: {
          name: sponsor.leadSponsor?.name,
          class: sponsor.leadSponsor?.class,
        },
        collaborators: sponsor.collaborators?.map(c => ({
          name: c.name,
          class: c.class,
        })) || [],
        responsibleParty: sponsor.responsibleParty,
        
        // === 研究者信息(PI等) ===
        investigators: protocol.sponsorCollaboratorsModule?.investigators?.map(inv => ({
          name: inv.name,
          role: inv.role,
          affiliation: inv.affiliation,
        })) || [],
        
        // === 描述信息 ===
        briefSummary: description.briefSummary,
        detailedDescription: description.detailedDescription,
        
        // === 结果指标 ===
        primaryOutcomes: outcomes.primaryOutcomes?.map(outcome => ({
          measure: outcome.measure,
          description: outcome.description,
          timeFrame: outcome.timeFrame,
        })) || [],
        secondaryOutcomes: outcomes.secondaryOutcomes?.map(outcome => ({
          measure: outcome.measure,
          description: outcome.description,
          timeFrame: outcome.timeFrame,
        })) || [],
        otherOutcomes: outcomes.otherOutcomes?.map(outcome => ({
          measure: outcome.measure,
          description: outcome.description,
          timeFrame: outcome.timeFrame,
        })) || [],
        
        // === 入选/排除标准(详细) ===
        eligibility: {
          eligibilityCriteria: eligibility.eligibilityCriteria,
          sex: eligibility.sex,
          genderBased: eligibility.genderBased,
          genderDescription: eligibility.genderDescription,
          minimumAge: eligibility.minimumAge,
          maximumAge: eligibility.maximumAge,
          stdAges: eligibility.stdAges || [],
          healthyVolunteers: eligibility.healthyVolunteers,
        },
        
        // === 中心联系人(全局) ===
        centralContacts: contacts.centralContacts?.map(contact => ({
          name: contact.name,
          role: contact.role,
          phone: contact.phone,
          phoneExt: contact.phoneExt,
          email: contact.email,
        })) || [],
        
        overallOfficials: contacts.overallOfficials?.map(official => ({
          name: official.name,
          affiliation: official.affiliation,
          role: official.role,
        })) || [],
        
        // === 研究地点(按城市/医院) ===
        locations: contacts.locations?.map(loc => ({
          facility: loc.facility,
          city: loc.city,
          state: loc.state,
          zip: loc.zip,
          country: loc.country,
          status: loc.status,
          coordinates: loc.geoPoint,
          // 地点联系人(PI、招募协调员等)
          contacts: loc.contacts?.map(contact => ({
            name: contact.name,
            role: contact.role,
            phone: contact.phone,
            phoneExt: contact.phoneExt,
            email: contact.email,
          })) || [],
        })) || [],
        
        // === 研究地点统计 ===
        locationsSummary: {
          totalLocations: contacts.locations?.length || 0,
          countries: [...new Set(contacts.locations?.map(l => l.country).filter(Boolean))] || [],
          cities: [...new Set(contacts.locations?.map(l => l.city).filter(Boolean))] || [],
        },
      };

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/PancrePal-xiaoyibao/xiaoyibao-clinical-trials-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server