Skip to main content
Glama

drug_rxnorm

Look up a drug in NIH RxNorm to get its RxCUI and check clinical drug-drug interactions with severity ratings.

Instructions

Look up a drug in NIH RxNorm for normalized terminology (RxCUI) and optionally check clinical drug-drug interactions with severity ratings. Source: NIH RxNorm (public domain).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
drugNameYesDrug name to look up (min 2 chars)
checkInteractionsNoOther drug names to check for clinical interactions against the primary drug

Implementation Reference

  • Schema/definition for the drug_rxnorm tool. Defines its name, description, endpoint (/agent/v1/drugs/rxnorm), price ($0.02), and input schema (drugName required, checkInteractions optional array of strings).
    {
      name: 'drug_rxnorm',
      description: 'Look up a drug in NIH RxNorm for normalized terminology (RxCUI) and optionally check clinical drug-drug interactions with severity ratings. Source: NIH RxNorm (public domain).',
      price: '$0.02',
      endpoint: '/agent/v1/drugs/rxnorm',
      schema: {
        drugName: z.string().describe('Drug name to look up (min 2 chars)'),
        checkInteractions: z.array(z.string()).optional().describe('Other drug names to check for clinical interactions against the primary drug'),
      },
    },
  • src/index.js:19-61 (registration)
    Generic registration of all MCP tools via s.tool(). drug_rxnorm is registered here at runtime along with all other tools from the MCP_TOOLS array.
    for (const tool of MCP_TOOLS) {
      s.tool(tool.name, tool.description, tool.schema, async (params) => {
        const toolDef = getToolByName(tool.name);
        if (!toolDef) {
          return { content: [{ type: 'text', text: `Unknown tool: ${tool.name}` }], isError: true };
        }
        try {
          const response = await fetch(`${API_BASE_URL}${toolDef.endpoint}`, {
            method: 'POST',
            headers: {
              'Content-Type': 'application/json',
              ...(API_KEY && { 'X-API-Key': API_KEY }),
              'X-Agent-ID': 'mcp-client',
              'User-Agent': '@mymedi-ai/mcp-server/1.2.1',
            },
            body: JSON.stringify(params),
          });
          if (response.status === 402) {
            const paymentInfo = await response.json();
            return {
              content: [{ type: 'text', text: JSON.stringify({
                error: 'payment_required',
                message: `This tool costs ${toolDef.price} per call. Register at ${API_BASE_URL}/bot-marketplace/register for an API key with 10 free starter credits, or pay per call with on-chain USDC (no signup) via the x402 protocol.`,
                price: toolDef.price, register: `${API_BASE_URL}/bot-marketplace/register`, ...paymentInfo,
              }, null, 2) }], isError: true,
            };
          }
          if (!response.ok) {
            const error = await response.json().catch(() => ({ message: response.statusText }));
            return { content: [{ type: 'text', text: JSON.stringify({ error: true, status: response.status, ...error }, null, 2) }], isError: true };
          }
          const data = await response.json();
          const creditsSpent = response.headers.get('X-Credits-Spent');
          const creditsRemaining = response.headers.get('X-Credits-Remaining');
          if (creditsSpent) {
            data._billing = { creditsSpent: parseInt(creditsSpent, 10), creditsRemaining: creditsRemaining ? parseInt(creditsRemaining, 10) : undefined, priceUSD: toolDef.price };
          }
          return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
        } catch (err) {
          return { content: [{ type: 'text', text: JSON.stringify({ error: true, message: err.message, hint: 'Ensure MCP_API_BASE_URL and MCP_API_KEY environment variables are set.' }, null, 2) }], isError: true };
        }
      });
    }
  • Generic handler for all tools including drug_rxnorm. Forwards params as POST body to API_BASE_URL + toolDef.endpoint (/agent/v1/drugs/rxnorm). Handles 402 payment responses, errors, and passes through the API response.
    s.tool(tool.name, tool.description, tool.schema, async (params) => {
      const toolDef = getToolByName(tool.name);
      if (!toolDef) {
        return { content: [{ type: 'text', text: `Unknown tool: ${tool.name}` }], isError: true };
      }
      try {
        const response = await fetch(`${API_BASE_URL}${toolDef.endpoint}`, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            ...(API_KEY && { 'X-API-Key': API_KEY }),
            'X-Agent-ID': 'mcp-client',
            'User-Agent': '@mymedi-ai/mcp-server/1.2.1',
          },
          body: JSON.stringify(params),
        });
        if (response.status === 402) {
          const paymentInfo = await response.json();
          return {
            content: [{ type: 'text', text: JSON.stringify({
              error: 'payment_required',
              message: `This tool costs ${toolDef.price} per call. Register at ${API_BASE_URL}/bot-marketplace/register for an API key with 10 free starter credits, or pay per call with on-chain USDC (no signup) via the x402 protocol.`,
              price: toolDef.price, register: `${API_BASE_URL}/bot-marketplace/register`, ...paymentInfo,
            }, null, 2) }], isError: true,
          };
        }
        if (!response.ok) {
          const error = await response.json().catch(() => ({ message: response.statusText }));
          return { content: [{ type: 'text', text: JSON.stringify({ error: true, status: response.status, ...error }, null, 2) }], isError: true };
        }
        const data = await response.json();
        const creditsSpent = response.headers.get('X-Credits-Spent');
        const creditsRemaining = response.headers.get('X-Credits-Remaining');
        if (creditsSpent) {
          data._billing = { creditsSpent: parseInt(creditsSpent, 10), creditsRemaining: creditsRemaining ? parseInt(creditsRemaining, 10) : undefined, priceUSD: toolDef.price };
        }
        return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
      } catch (err) {
        return { content: [{ type: 'text', text: JSON.stringify({ error: true, message: err.message, hint: 'Ensure MCP_API_BASE_URL and MCP_API_KEY environment variables are set.' }, null, 2) }], isError: true };
      }
    });
Behavior4/5

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

No annotations exist, so the description carries full burden. It discloses that the tool returns RxCUI and optionally checks interactions with severity ratings, and cites the public domain source. No destructive behavior or auth needs are mentioned, but this is acceptable for a read-only lookup tool.

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 two concise sentences. The first sentence states the primary purpose, the second adds an optional feature and source. No fluff or redundancy.

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

Completeness4/5

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

With no output schema, the description covers the key return value (RxCUI) and interaction output (severity ratings). It lacks details on output format or a usage example, but is sufficient for an agent to understand the tool's capability given the rich sibling context.

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

Parameters4/5

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

Schema coverage is 100% and both parameters have clear descriptions. The description adds value by mentioning that interaction checks include 'severity ratings', which is not in the schema. This provides meaningful context beyond the parameter descriptions.

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 verb 'look up' and resource 'drug in NIH RxNorm', and mentions the optional interaction check. It distinguishes from siblings like drug_lookup and drug_interactions by combining both functions.

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 for normalized terminology and interaction checks, but does not explicitly state when to use this tool vs alternatives among the many sibling tools. No exclusion criteria or comparative guidance is provided.

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/MyMedi-AI/mymedi-ai-mcp-server'

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