Skip to main content
Glama

search-drug-nomenclature

Find standardized drug information using RxNorm database to identify correct medication names, dosages, and formulations for accurate prescribing and record-keeping.

Instructions

Search for drug information using RxNorm (standardized drug nomenclature)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesDrug name to search for in RxNorm database

Implementation Reference

  • Main handler function that performs the actual API call to RxNorm database to search for drugs by name and returns standardized drug nomenclature data.
    export async function searchRxNormDrugs(query: string): Promise<RxNormDrug[]> {
      try {
        const res = await superagent
          .get(`${RXNAV_API_BASE}/drugs.json`)
          .query({ name: query })
          .set("User-Agent", USER_AGENT);
    
        const drugGroup = res.body.drugGroup;
        if (!drugGroup || !drugGroup.conceptGroup) {
          return [];
        }
    
        // Find concept groups that have conceptProperties
        const results: RxNormDrug[] = [];
        for (const conceptGroup of drugGroup.conceptGroup) {
          if (
            conceptGroup.conceptProperties &&
            Array.isArray(conceptGroup.conceptProperties)
          ) {
            for (const concept of conceptGroup.conceptProperties) {
              // Transform the API response to match our RxNormDrug type
              results.push({
                rxcui: concept.rxcui || "",
                name: concept.name || "",
                synonym: concept.synonym
                  ? Array.isArray(concept.synonym)
                    ? concept.synonym
                    : [concept.synonym]
                  : [],
                tty: concept.tty || "",
                language: concept.language || "",
                suppress: concept.suppress || "",
                umlscui: concept.umlscui
                  ? Array.isArray(concept.umlscui)
                    ? concept.umlscui
                    : [concept.umlscui]
                  : [],
              });
            }
          }
        }
    
        return results;
      } catch (error) {
        console.error("Error searching RxNorm drugs:", error);
        return [];
      }
    }
  • src/index.ts:157-171 (registration)
    MCP tool registration including input schema (query string) and handler that delegates to searchRxNormDrugs and formatRxNormDrugs functions.
    server.tool(
      "search-drug-nomenclature",
      "Search for drug information using RxNorm (standardized drug nomenclature)",
      {
        query: z.string().describe("Drug name to search for in RxNorm database"),
      },
      async ({ query }) => {
        try {
          const drugs = await searchRxNormDrugs(query);
          return formatRxNormDrugs(drugs, query);
        } catch (error: any) {
          return createErrorResponse("searching RxNorm", error);
        }
      },
    );
  • Helper function that formats the RxNorm search results into a readable MCP response.
    export function formatRxNormDrugs(drugs: any[], query: string) {
      if (drugs.length === 0) {
        return createMCPResponse(
          `No drugs found in RxNorm database for "${query}". Try a different search term.`,
        );
      }
    
      let result = `**RxNorm Drug Search: "${query}"**\n\n`;
      result += `Found ${drugs.length} drug(s)\n\n`;
    
      drugs.forEach((drug, index) => {
        result += `${index + 1}. **${drug.name}**\n`;
        result += `   RxCUI: ${drug.rxcui}\n`;
        result += `   Term Type: ${drug.tty}\n`;
        result += `   Language: ${drug.language}\n`;
        if (drug.synonym && drug.synonym.length > 0) {
          result += `   Synonyms: ${drug.synonym.slice(0, 3).join(", ")}${drug.synonym.length > 3 ? "..." : ""}\n`;
        }
        result += "\n";
      });
    
      return createMCPResponse(result);
    }
  • TypeScript type definition for RxNormDrug, defining the structure of the output data from the search.
    export type RxNormDrug = {
      rxcui: string;
      name: string;
      synonym: string[];
      tty: string;
      language: string;
      suppress: string;
      umlscui: string[];
    };
  • API base URL constant used by the search handler for RxNorm queries.
    export const RXNAV_API_BASE = "https://rxnav.nlm.nih.gov/REST";
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 is for searching, which implies a read-only operation, but doesn't disclose any behavioral traits such as rate limits, authentication needs, response formats, or potential side effects. For a tool with zero annotation coverage, this is a significant gap in transparency.

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: 'Search for drug information using RxNorm (standardized drug nomenclature)'. It is front-loaded with the core purpose, has no wasted words, and is appropriately sized for the tool's complexity, earning a top score for conciseness and structure.

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?

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on usage guidelines, behavioral traits, and output, which are important for full contextual understanding. Without annotations or an output schema, the description should do more to compensate, but it falls short, resulting in a mediocre score.

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?

The input schema has 100% description coverage, with the single parameter 'query' documented as 'Drug name to search for in RxNorm database'. The description adds no additional meaning beyond this, as it doesn't elaborate on parameter syntax, examples, or constraints. Given the high schema coverage, the baseline score of 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.

Purpose4/5

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

The description clearly states the tool's purpose: 'Search for drug information using RxNorm (standardized drug nomenclature)'. It specifies the verb ('Search'), resource ('drug information'), and method ('using RxNorm'), which is specific and informative. However, it doesn't explicitly distinguish this tool from sibling tools like 'search-drugs' or 'search-medical-databases', which might also involve drug-related searches, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any specific contexts, exclusions, or comparisons to sibling tools such as 'search-drugs' or 'get-drug-details', leaving the agent to infer usage based on the name alone. This lack of explicit guidelines reduces its helpfulness for tool selection.

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