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"]
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'extracting and comparing adverse events data' and 'provides risk assessment and dose-response relationships', which gives some insight into what the tool does. However, it lacks details on permissions, rate limits, data sources, whether it's read-only or mutative, response format, or error handling—critical for a tool with potential complexity.

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 concise and front-loaded, stating the core purpose in the first sentence. The second sentence adds value by specifying outputs (risk assessment, dose-response relationships). Both sentences earn their place, with no wasted words, though it could be slightly more structured for clarity.

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?

Given the complexity (analyzing drug safety across trials), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like data sources, permissions, or response format, and while it mentions outputs, it doesn't detail them. For a tool with 4 parameters and potential for rich analysis, more context is needed to guide effective use.

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?

Schema description coverage is 100%, meaning all parameters are documented in the schema. The description adds no specific parameter semantics beyond what's in the schema (e.g., it doesn't explain 'drug_name' or 'condition' further). However, it implies the scope of analysis (across clinical trials), which loosely relates to parameters but doesn't provide additional value. Baseline 3 is appropriate given high schema coverage.

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 the tool's purpose: 'Analyze safety profile of a drug by extracting and comparing adverse events data across multiple clinical trials.' It specifies the verb (analyze), resource (safety profile of a drug), and method (extracting/comparing adverse events data). However, it doesn't explicitly differentiate from sibling tools like 'compare_adverse_events' or 'search_clinical_trials', which appear related to similar domains.

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 alternatives. It doesn't mention sibling tools like 'compare_adverse_events' or 'search_clinical_trials', nor does it specify prerequisites, contexts where it's preferred, or exclusions. Usage is implied through the description but not explicitly stated.

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

Install Server

Other Tools

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