get_drug_history
Retrieve version history for FDA-approved drugs using their SET ID to track label changes, updates, and regulatory modifications over time.
Instructions
Get version history for a specific drug by its SET ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| setId | Yes | The SET ID of the drug to get history for |
Implementation Reference
- src/clients/spl-client.ts:287-314 (handler)The getSPLHistory method in the SPLClient class fetches the version history of a drug from the DailyMed API using its SET ID.
async getSPLHistory(setId: string): Promise<any[]> { if (!setId || typeof setId !== "string") { throw new Error("Valid SET ID is required"); } try { const response = await this.client.get(`/spls/${setId}/history.json`); if ( response.data && response.data.data && Array.isArray(response.data.data) ) { return response.data.data.map((item: any) => ({ setId: item.setid, splVersion: item.spl_version, effectiveTime: item.effective_time, title: item.title, })); } else { throw new Error("Unexpected response structure for SPL history"); } } catch (error) { throw new Error( `Failed to fetch SPL history: ${error instanceof Error ? error.message : "Unknown error"}`, ); } } - src/index.ts:74-85 (registration)Registration of the get_drug_history tool handler in the main server switch block, which calls the SPLClient's getSPLHistory method.
case "get_drug_history": const history = await this.client.getSPLHistory( args.setId as string, ); return { content: [ { type: "text", text: JSON.stringify(history, null, 2), }, ], }; - src/tools.ts:27-39 (schema)The schema definition for the get_drug_history tool in the dailyMedTools configuration array.
name: "get_drug_history", description: "Get version history for a specific drug by its SET ID", inputSchema: { type: "object", properties: { setId: { type: "string", description: "The SET ID of the drug to get history for", }, }, required: ["setId"], }, },