Skip to main content
Glama
Aki894
by Aki894

analyze_safety_profile

Analyze drug safety by extracting and comparing adverse events data across clinical trials to assess risks and dose-response relationships.

Instructions

Analyze safety profile of a drug by extracting and comparing adverse events data across multiple clinical trials. Provides risk assessment and dose-response relationships.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
drug_nameYesName of the drug to analyze
conditionNoMedical condition context
include_completed_onlyNoOnly include completed studies with results
limitNoMaximum number of studies to analyze

Implementation Reference

  • The handler method 'analyzeSafetyProfile' processes the safety analysis of a drug, integrating trial data and performing risk assessment.
    private async analyzeSafetyProfile(params: {
      drug_name: string;
      condition?: string;
      include_completed_only: boolean;
      limit: number;
    }) {
      // Search for clinical trials with the specified drug
      const searchParams: ClinicalTrialSearchParams = {
        intervention: params.drug_name,
        condition: params.condition,
        pageSize: params.limit,
        countTotal: true
      };
    
      if (params.include_completed_only) {
        searchParams.status = "COMPLETED";
      }
    
      const data = await this.makeRequest(searchParams);
      
      // Analyze safety data across studies
      const safetyAnalysis = {
        drug_name: params.drug_name,
        condition: params.condition,
        total_studies: data.totalCount || 0,
        analyzed_studies: 0,
        adverse_events_summary: {} as any,
        dose_response_analysis: [] as any[],
        risk_assessment: {} as any
      };
    
      const allAdverseEvents: any[] = [];
      const doseGroups: any[] = [];
    
      for (const study of data.studies || []) {
        if (study.resultsSection) {
          safetyAnalysis.analyzed_studies++;
          
          // Extract adverse events
          if (study.resultsSection.adverseEventsModule) {
            const studyAEs = this.extractStudyAdverseEvents(study);
            allAdverseEvents.push(...studyAEs);
          }
          
          // Extract dose information
          if (study.protocolSection?.armsInterventionsModule) {
            const doseInfo = this.extractDoseInformation(study, params.drug_name);
            if (doseInfo) {
              doseGroups.push(doseInfo);
            }
          }
        }
      }
    
      // Aggregate and analyze adverse events
      safetyAnalysis.adverse_events_summary = this.aggregateAdverseEvents(allAdverseEvents);
      safetyAnalysis.dose_response_analysis = this.analyzeDoseResponse(doseGroups, allAdverseEvents);
      safetyAnalysis.risk_assessment = this.assessRisk(safetyAnalysis.adverse_events_summary);
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(safetyAnalysis, null, 2)
          }
        ]
      };
    }
    
    // Helper methods for adverse event analysis
    private extractAdverseEvents(study: any, controlType: string) {
      const adverseEventsModule = study.resultsSection?.adverseEventsModule;
      if (!adverseEventsModule) return null;
    
      const nctId = study.protocolSection?.identificationModule?.nctId;
      const title = study.protocolSection?.identificationModule?.briefTitle;
      
      return {
        nct_id: nctId,
        title: title,
        control_type: controlType,
        event_groups: adverseEventsModule.eventGroups || [],
        serious_events: adverseEventsModule.seriousEvents || [],
        other_events: adverseEventsModule.otherEvents || []
      };
    }
    
    private extractStudyAdverseEvents(study: any) {
      const adverseEventsModule = study.resultsSection?.adverseEventsModule;
      if (!adverseEventsModule) return [];
    
      const events = [];
  • src/index.ts:248-277 (registration)
    The MCP tool 'analyze_safety_profile' is defined and registered in the server's list of tools.
    {
      name: "analyze_safety_profile",
      description: "Analyze safety profile of a drug by extracting and comparing adverse events data across multiple clinical trials. Provides risk assessment and dose-response relationships.",
      inputSchema: {
        type: "object",
        properties: {
          drug_name: {
            type: "string",
            description: "Name of the drug to analyze"
          },
          condition: {
            type: "string",
            description: "Medical condition context"
          },
          include_completed_only: {
            type: "boolean",
            description: "Only include completed studies with results",
            default: true
          },
          limit: {
            type: "number",
            description: "Maximum number of studies to analyze",
            default: 20,
            minimum: 1,
            maximum: 100
          }
        },
        required: ["drug_name"]
      }
    }

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/Aki894/mcp-ClinicalTrial'

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