Skip to main content
Glama
Aki894
by Aki894

compare_adverse_events

Analyze drug safety by comparing adverse events between treatment and control groups across clinical trials to support evidence-based safety assessments.

Instructions

Compare adverse events between treatment and control groups for a specific drug across clinical trials. Provides baseline reference and evidence for drug safety analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
drug_nameYesName of the drug to analyze for adverse events
control_typeNoType of control comparison: placebo (vs placebo), active_control (vs other drugs), dose_comparison (different doses)placebo
conditionNoMedical condition to focus the search. Example: 'cancer', 'diabetes'
limitNoMaximum number of studies to analyze

Implementation Reference

  • The compareAdverseEvents method fetches clinical trial data based on drug name and condition, filters studies with results modules, extracts adverse event data, and formats a summary comparison.
    private async compareAdverseEvents(params: AdverseEventComparisonParams) {
      // Search for clinical trials with the specified drug
      const searchParams: ClinicalTrialSearchParams = {
        intervention: params.drug_name,
        condition: params.condition,
        pageSize: params.limit,
        countTotal: true
      };
    
      // Only include completed studies with results for adverse event comparison
      if (params.control_type === "placebo") {
        searchParams.status = "COMPLETED";
      }
    
      const data = await this.makeRequest(searchParams);
      
      // Extract studies with results sections for adverse event analysis
      const studiesWithResults = [];
      const adverseEventComparisons = [];
    
      for (const study of data.studies || []) {
        if (study.resultsSection && study.resultsSection.adverseEventsModule) {
          studiesWithResults.push(study);
          
          const adverseEvents = this.extractAdverseEvents(study, params.control_type);
          if (adverseEvents) {
            adverseEventComparisons.push(adverseEvents);
          }
        }
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              drug_name: params.drug_name,
              control_type: params.control_type,
              condition: params.condition,
              total_studies_found: data.totalCount || 0,
              studies_with_results: studiesWithResults.length,
              adverse_event_comparisons: adverseEventComparisons,
              summary: this.generateAdverseEventSummary(adverseEventComparisons, params.control_type)
            }, null, 2)
          }
        ]
      };
    }
  • Zod schema defining the input parameters for compare_adverse_events.
    const AdverseEventComparisonParamsSchema = z.object({
      drug_name: z.string(),
      control_type: z.enum(["placebo", "active_control", "dose_comparison"]).optional().default("placebo"),
      condition: z.string().optional(),
      limit: z.coerce.number().int().min(1).max(50).optional().default(10),
    });
  • src/index.ts:166-185 (registration)
    Tool definition/registration for compare_adverse_events.
    {
      name: "compare_adverse_events",
      description: "Compare adverse events between treatment and control groups for a specific drug across clinical trials. Provides baseline reference and evidence for drug safety analysis.",
      inputSchema: {
        type: "object",
        properties: {
          drug_name: {
            type: "string",
            description: "Name of the drug to analyze for adverse events"
          },
          control_type: {
            type: "string",
            enum: ["placebo", "active_control", "dose_comparison"],
            description: "Type of control comparison: placebo (vs placebo), active_control (vs other drugs), dose_comparison (different doses)",
            default: "placebo"
          },
          condition: {
            type: "string",
            description: "Medical condition to focus the search. Example: 'cancer', 'diabetes'"
          },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the tool 'compares adverse events' and 'provides baseline reference and evidence' but doesn't specify what format the comparison takes, whether it performs statistical analysis, how it aggregates data across trials, or what the output looks like. For a tool with 4 parameters and no annotations, this leaves significant behavioral gaps.

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 appropriately concise with two sentences that directly address purpose and value. The first sentence clearly states what the tool does, and the second explains its utility. There's no wasted verbiage, though it could be slightly more structured with explicit usage guidance.

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?

For a tool with 4 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what the comparison output looks like, how results are presented, whether statistical significance is calculated, or how data from multiple trials is synthesized. The description leaves too many behavioral questions unanswered for effective agent 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%, so the schema already documents all parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema (e.g., it doesn't explain how 'drug_name' relates to 'condition' filtering or what 'limit' controls precisely). Baseline 3 is appropriate when the schema does 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 the tool's purpose: comparing adverse events between treatment and control groups for a specific drug across clinical trials. It specifies the verb ('compare') and resource ('adverse events'), but doesn't explicitly differentiate from sibling tools like 'analyze_safety_profile' or 'search_clinical_trials', which might have overlapping functionality.

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 minimal guidance on when to use this tool, stating it 'provides baseline reference and evidence for drug safety analysis' but offering no explicit when/when-not criteria or alternatives. It doesn't mention how this differs from sibling tools like 'analyze_safety_profile' or when to choose one over the other.

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