get_drug_media
Retrieve media files like images and documents for FDA-approved drugs using their unique SET ID from the DailyMed database.
Instructions
Get media links (images, documents) 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 media for |
Implementation Reference
- src/clients/spl-client.ts:364-390 (handler)Implementation of the `getSPLMedia` method in `SPLClient` which fetches media links for a drug from DailyMed.
async getSPLMedia(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}/media.json`); if ( response.data && response.data.data && Array.isArray(response.data.data) ) { return response.data.data.map((item: any) => ({ url: item.url, type: item.type, name: item.name, })); } else { throw new Error("Unexpected response structure for SPL media"); } } catch (error) { throw new Error( `Failed to fetch SPL media: ${error instanceof Error ? error.message : "Unknown error"}`, ); } } - src/tools.ts:68-82 (registration)Tool definition for `get_drug_media` in `dailyMedTools`.
{ name: "get_drug_media", description: "Get media links (images, documents) for a specific drug by its SET ID", inputSchema: { type: "object", properties: { setId: { type: "string", description: "The SET ID of the drug to get media for", }, }, required: ["setId"], }, }, - src/index.ts:111-120 (handler)Tool request handler for `get_drug_media` that invokes `this.client.getSPLMedia`.
case "get_drug_media": const media = await this.client.getSPLMedia(args.setId as string); return { content: [ { type: "text", text: JSON.stringify(media, null, 2), }, ], };