Skip to main content
Glama
pubspro

medterms-mcp

lookup_rxnorm

Retrieve RxNorm concept, RxCUI, ingredient relationships, and drug class for any drug by entering its brand or generic name.

Instructions

Look up a drug's RxNorm concept, RxCUI identifier, ingredient relationships, and drug class. RxNorm is the standard for drug interoperability across EHR systems.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
drug_nameYesDrug name (brand or generic, e.g. 'abilify', 'aripiprazole', 'ozempic')

Implementation Reference

  • index.js:258-265 (registration)
    Tool registration for 'lookup_rxnorm' using server.tool() with a description and Zod schema for drug_name input.
    server.tool(
      "lookup_rxnorm",
      "Look up a drug's RxNorm concept, RxCUI identifier, ingredient relationships, and drug class. RxNorm is the standard for drug interoperability across EHR systems.",
      {
        drug_name: z
          .string()
          .describe("Drug name (brand or generic, e.g. 'abilify', 'aripiprazole', 'ozempic')"),
      },
  • Input schema defining drug_name as a Zod string describing the drug name (brand or generic).
    {
      drug_name: z
        .string()
        .describe("Drug name (brand or generic, e.g. 'abilify', 'aripiprazole', 'ozempic')"),
    },
  • Handler function that calls RxNav APIs to look up RxCUI, find approximate matches if needed, fetches properties, ATC class, and related ingredients/brands, then returns formatted markdown text.
    async ({ drug_name }) => {
      // Get RxCUI
      const searchData = await apiFetch(
        `${RXNAV_BASE}/rxcui.json?name=${encodeURIComponent(drug_name)}&search=2`
      );
    
      const rxcui = searchData?.idGroup?.rxnormId?.[0];
    
      if (!rxcui) {
        // Try approximate match
        const approxData = await apiFetch(
          `${RXNAV_BASE}/approximateTerm.json?term=${encodeURIComponent(drug_name)}&maxEntries=5`
        );
        const candidates = approxData?.approximateGroup?.candidate || [];
        if (!candidates.length) {
          return {
            content: [{
              type: "text",
              text: `No RxNorm concept found for "${drug_name}". Check spelling or try generic name.`
            }]
          };
        }
    
        const lines = candidates.slice(0, 5).map(
          c => `- **RxCUI ${c.rxcui}** — Score: ${c.score} (${c.name || "name not available"})`
        );
        return {
          content: [{
            type: "text",
            text: [
              `## RxNorm: Approximate Matches for "${drug_name}"`,
              "",
              ...lines,
              "",
              "Re-run with the exact name for full details."
            ].join("\n")
          }]
        };
      }
    
      // Get properties
      const [propsData, classData, relData] = await Promise.all([
        apiFetch(`${RXNAV_BASE}/rxcui/${rxcui}/properties.json`).catch(() => null),
        apiFetch(`${RXNAV_BASE}/rxclass/class/byRxcui.json?rxcui=${rxcui}&relaSource=ATC`).catch(() => null),
        apiFetch(`${RXNAV_BASE}/rxcui/${rxcui}/related.json?tty=IN+BN+SCD`).catch(() => null),
      ]);
    
      const props = propsData?.properties || {};
      const classes = classData?.rxclassDrugInfoList?.rxclassDrugInfo || [];
      const related = relData?.relatedGroup?.conceptGroup || [];
    
      const ingredients = related
        .find(g => g.tty === "IN")
        ?.conceptProperties?.map(c => c.name) || [];
      const brandNames = related
        .find(g => g.tty === "BN")
        ?.conceptProperties?.map(c => c.name) || [];
      const atcClasses = classes.slice(0, 3).map(
        c => `${c.rxclassMinConceptItem?.className} (${c.rxclassMinConceptItem?.classId})`
      );
    
      const text = [
        `## RxNorm: ${props.name || drug_name}`,
        "",
        `### Identifiers`,
        `- **RxCUI:** ${rxcui}`,
        `- **Name:** ${props.name || "N/A"}`,
        `- **Synonym:** ${props.synonym || "N/A"}`,
        `- **Term Type:** ${props.tty || "N/A"}`,
        `- **Language:** ${props.language || "N/A"}`,
        "",
        `### Drug Relationships`,
        `- **Active Ingredient(s):** ${ingredients.join(", ") || "N/A"}`,
        `- **Brand Names:** ${brandNames.slice(0, 8).join(", ") || "N/A"}`,
        "",
        `### Drug Class (ATC)`,
        atcClasses.length
          ? atcClasses.map(c => `- ${c}`).join("\n")
          : "- ATC classification not available",
        "",
        `### Interoperability`,
        `- RxNorm is the **US standard** for drug naming in EHR/EMR systems`,
        `- RxCUI \`${rxcui}\` can be used to query drug interactions, formulary status, and prescribing data`,
        `- Maps to: **NDF-RT**, **SNOMED CT**, **MeSH**, **DrugBank**, **ATC**`,
        "",
        `_Source: NIH National Library of Medicine RxNav API_`,
      ].join("\n");
    
      return { content: [{ type: "text", text }] };
    }
  • Shared apiFetch utility used by lookup_rxnorm to call NIH NLM RxNav REST APIs.
    async function apiFetch(url) {
      const res = await fetch(url, {
        headers: { "Accept": "application/json" }
      });
      if (!res.ok) throw new Error(`API error ${res.status}: ${url}`);
      return res.json();
    }
Behavior2/5

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

No annotations provided; description does not disclose behavioral traits such as read-only nature, data sources, limitations (e.g., US only), or side effects.

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?

Two concise sentences: first states function and outputs, second provides context. No unnecessary words.

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

Completeness3/5

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

Adequately describes purpose and outputs for a simple lookup, but lacks detail on input format (case sensitivity) and output structure. Without output schema, more description would help.

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 has 100% coverage with examples; description adds minimal value beyond reiterating the parameter context. Baseline score applied.

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?

Clearly states it looks up RxNorm concept, RxCUI, ingredient relationships, and drug class. Distinguishes from siblings which are for other coding systems (ICD-10, MedDRA).

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?

Mentions RxNorm is for drug interoperability, implying use for drug terminology, but lacks explicit when-not or alternative recommendations among siblings.

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/pubspro/medterms-mcp'

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