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
| Name | Required | Description | Default |
|---|---|---|---|
| drug_name | Yes | Name of the drug to analyze for adverse events | |
| control_type | No | Type of control comparison: placebo (vs placebo), active_control (vs other drugs), dose_comparison (different doses) | placebo |
| condition | No | Medical condition to focus the search. Example: 'cancer', 'diabetes' | |
| limit | No | Maximum number of studies to analyze |
Implementation Reference
- src/index.ts:445-492 (handler)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) } ] }; } - src/index.ts:37-42 (schema)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'" },