Skip to main content
Glama
RowanErasmus

DailyMed MCP Server

by RowanErasmus

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
NameRequiredDescriptionDefault
setIdYesThe SET ID of the drug to get media for

Implementation Reference

  • 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"],
      },
    },
  • 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),
          },
        ],
      };

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/RowanErasmus/dailymed-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server