Skip to main content
Glama

get-drug-details

Retrieve comprehensive drug information using National Drug Code (NDC) to access detailed medication data from FDA, WHO, and medical databases.

Instructions

Get detailed information about a specific drug by NDC (National Drug Code)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ndcYesNational Drug Code (NDC) of the drug

Implementation Reference

  • src/index.ts:69-83 (registration)
    Registers the 'get-drug-details' MCP tool, defines input schema (NDC string), and provides inline handler that fetches data via getDrugByNDC and formats it.
    server.tool(
      "get-drug-details",
      "Get detailed information about a specific drug by NDC (National Drug Code)",
      {
        ndc: z.string().describe("National Drug Code (NDC) of the drug"),
      },
      async ({ ndc }) => {
        try {
          const drug = await getDrugByNDC(ndc);
          return formatDrugDetails(drug, ndc);
        } catch (error: any) {
          return createErrorResponse("fetching drug details", error);
        }
      },
    );
  • Core handler function that queries the FDA drug label API by product NDC code to retrieve detailed drug information.
    export async function getDrugByNDC(ndc: string): Promise<DrugLabel | null> {
      try {
        const res = await superagent
          .get(`${FDA_API_BASE}/drug/label.json`)
          .query({
            search: `openfda.product_ndc:${ndc}`,
            limit: 1,
          })
          .set("User-Agent", USER_AGENT);
    
        return res.body.results?.[0] || null;
      } catch (error) {
        return null;
      }
    }
  • Zod input schema defining the required 'ndc' parameter as a string.
    {
      ndc: z.string().describe("National Drug Code (NDC) of the drug"),
    },
  • TypeScript interface defining the structure of FDA DrugLabel data used by the tool.
    export type DrugLabel = {
      openfda: {
        brand_name?: string[];
        generic_name?: string[];
        manufacturer_name?: string[];
        product_ndc?: string[];
        substance_name?: string[];
        route?: string[];
        dosage_form?: string[];
      };
      purpose?: string[];
      warnings?: string[];
      adverse_reactions?: string[];
      drug_interactions?: string[];
      dosage_and_administration?: string[];
      clinical_pharmacology?: string[];
      effective_time: string;
    };
  • Helper function that formats the raw FDA drug data into a user-friendly MCP response with sections for basic info, purpose, warnings, and interactions.
    export function formatDrugDetails(drug: any, ndc: string) {
      if (!drug) {
        return createMCPResponse(`No drug found with NDC: ${ndc}`);
      }
    
      let result = `**Drug Details for NDC: ${ndc}**\n\n`;
      result += `**Basic Information:**\n`;
      result += `- Brand Name: ${drug.openfda.brand_name?.[0] || "Not specified"}\n`;
      result += `- Generic Name: ${drug.openfda.generic_name?.[0] || "Not specified"}\n`;
      result += `- Manufacturer: ${drug.openfda.manufacturer_name?.[0] || "Not specified"}\n`;
      result += `- Route: ${drug.openfda.route?.[0] || "Not specified"}\n`;
      result += `- Dosage Form: ${drug.openfda.dosage_form?.[0] || "Not specified"}\n`;
      result += `- Last Updated: ${drug.effective_time}\n\n`;
    
      if (drug.purpose && drug.purpose.length > 0) {
        result += `**Purpose/Uses:**\n`;
        drug.purpose.forEach((purpose: string, index: number) => {
          result += `${index + 1}. ${purpose}\n`;
        });
        result += "\n";
      }
    
      if (drug.warnings && drug.warnings.length > 0) {
        result += `**Warnings:**\n`;
        drug.warnings.forEach((warning: string, index: number) => {
          result += `${index + 1}. ${warning.substring(0, 300)}${warning.length > 300 ? "..." : ""}\n`;
        });
        result += "\n";
      }
    
      if (drug.drug_interactions && drug.drug_interactions.length > 0) {
        result += `**Drug Interactions:**\n`;
        drug.drug_interactions.forEach((interaction: string, index: number) => {
          result += `${index + 1}. ${interaction.substring(0, 300)}${interaction.length > 300 ? "..." : ""}\n`;
        });
        result += "\n";
      }
    
      return createMCPResponse(result);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool's purpose but doesn't describe behavioral traits such as whether it's read-only (implied by 'Get' but not explicit), rate limits, error handling, or what 'detailed information' includes (e.g., format, depth). This leaves significant gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste—it directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool that presumably returns detailed drug information. It doesn't explain what 'detailed information' entails (e.g., fields, structure) or address potential complexities like error cases or data sources, leaving the agent with insufficient context for reliable use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the schema fully documenting the single 'ndc' parameter. The description adds no additional parameter semantics beyond what the schema provides (e.g., no examples, format details, or constraints). Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get detailed information') and target resource ('about a specific drug by NDC'), distinguishing it from siblings like search-drugs (which searches) or check-drug-interactions (which checks interactions). It precisely communicates the verb+resource combination.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when you have a specific NDC and need detailed drug information, but it doesn't explicitly state when to use this versus alternatives like search-drugs (for searching without a known NDC) or when not to use it. The context is clear but lacks explicit guidance on alternatives or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/JamesANZ/medical-mcp'

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