Skip to main content
Glama

rxnorm_classes

Read-onlyIdempotent

Retrieve therapeutic and pharmacologic classes for a drug by inputting its RxCUI. Returns class IDs, names, and classification sources.

Instructions

Get therapeutic and pharmacologic classes for a drug.

Use this tool to:

  • Find the drug class (e.g., "Beta-blockers", "NSAIDs")

  • Identify therapeutic categories

  • Look up mechanism of action classifications

Returns class IDs, names, and classification sources.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rxcuiYesRxCUI of the drug

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
rxcuiYes
classesYes

Implementation Reference

  • The main handler function for rxnorm_classes. Parses the rxcui parameter via RxNormByRxcuiParamsSchema, calls the RxNorm client's getDrugClasses method, maps results to RxNormClassesOutput structure, and returns both a formatted text response and structuredContent.
    async function handleRxNormClasses(args: Record<string, unknown>): Promise<CallToolResult> {
      try {
        const params = RxNormByRxcuiParamsSchema.parse(args);
        const client = getRxNormClient();
        const classes = await client.getDrugClasses(params.rxcui);
    
        const structured: RxNormClassesOutput = {
          rxcui: params.rxcui,
          classes: classes.map((c) => ({
            class_id: c.classId,
            class_name: c.className,
            class_type: c.classType,
            source: c.source,
          })),
        };
    
        return {
          content: [{ type: 'text', text: formatClasses(params.rxcui, classes) }],
          structuredContent: structured,
        };
      } catch (error) {
        return handleToolError(error);
      }
    }
  • RxNormClassesOutputSchema: Zod output schema for rxnorm_classes. Defines the response shape with rxcui and an array of classes (each with class_id, class_name, class_type, source). Also RxNormClassesOutput type (line 356).
    export const RxNormClassesOutputSchema = z.object({
      rxcui: z.string(),
      classes: z.array(
        z.object({
          class_id: z.string(),
          class_name: z.string(),
          class_type: z.string(),
          source: z.string(),
        }),
      ),
    });
  • RxNormByRxcuiParamsSchema: The shared input schema used by rxnorm_classes (and rxnorm_ingredients). Takes a single 'rxcui' numeric string parameter.
    /** Shared shape for rxnorm_ingredients / rxnorm_classes */
    export const RxNormByRxcuiParamsSchema = z.object({
      rxcui: RxCUISchema.describe('RxCUI of the drug'),
    });
  • Tool registration - registers rxnormClassesTool (name: 'rxnorm_classes') with the toolRegistry, binding it to the handleRxNormClasses handler function.
    toolRegistry.register(rxnormClassesTool, handleRxNormClasses);
  • formatClasses: Helper function that formats the drug class results into a human-readable Markdown table for the text response content.
    function formatClasses(rxcui: string, classes: RxNormDrugClass[]): string {
      const lines: string[] = [];
    
      lines.push(`# Drug Classes for RxCUI ${rxcui}`);
      lines.push('');
    
      if (classes.length === 0) {
        lines.push('No drug classes found for this concept.');
      } else {
        lines.push(`Found ${classes.length} class(es):`);
        lines.push('');
        lines.push('| Class ID | Class Name | Type | Source |');
        lines.push('|----------|------------|------|--------|');
    
        for (const cls of classes) {
          lines.push(`| ${cls.classId} | ${cls.className} | ${cls.classType} | ${cls.source || 'N/A'} |`);
        }
      }
    
      return lines.join('\n');
    }
Behavior4/5

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

Annotations already indicate readOnly, non-destructive, idempotent, openWorld. Description adds that it returns class IDs, names, and sources, which is useful behavioral context beyond annotations. No contradictions.

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?

Concise at 5 sentences with a clear title and bullet points. No unnecessary information; every sentence adds value.

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

Completeness5/5

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

Given the simplicity of the tool (one parameter, output schema exists), the description is complete. It explains what the tool does, when to use it, and what it returns.

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 coverage is 100%, so baseline is 3. The description does not add extra meaning to the rxcui parameter beyond the schema's own description.

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?

Description clearly states 'Get therapeutic and pharmacologic classes for a drug.' and lists specific use cases. Distinguishes from sibling tools like rxnorm_concept and rxnorm_ingredients which handle different aspects of drug information.

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

Usage Guidelines4/5

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

Provides explicit use cases ('Use this tool to:') but does not explicitly mention when not to use or alternatives. However, the context and sibling names make the appropriate usage clear.

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

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