Skip to main content
Glama
RowanErasmus

DailyMed MCP Server

by RowanErasmus

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

Implementation Reference

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

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