Skip to main content
Glama

atc_classify

Read-onlyIdempotent

Retrieve WHO ATC classification for any drug by name. Identifies therapeutic, pharmacological, and chemical hierarchy codes.

Instructions

Look up the WHO ATC (Anatomical Therapeutic Chemical) classification(s) for a drug by name.

Use this tool to:

  • Find the ATC code for a medication (e.g., "metformin" → A10BA02)

  • Identify the therapeutic and pharmacological class hierarchy

  • Cross-reference drugs with their international ATC codes

Returns one entry per ATC code the drug belongs to. A single-ingredient drug typically maps to one substance-level code; combination products map to multiple. ATC codes are international (WHO Collaborating Centre); this tool retrieves them via NLM RxClass.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
drug_nameYesDrug name to classify (brand or generic, e.g., "metformin")

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
drug_nameYes
matchesYes

Implementation Reference

  • The main handler function for the atc_classify tool. Parses input via ATCClassifyParamsSchema, calls getRxNormClient().getATCByDrugName(params.drug_name) to query the NLM RxClass API, and formats the results as a markdown table with structured content.
    async function handleATCClassify(args: Record<string, unknown>): Promise<CallToolResult> {
      try {
        const params = ATCClassifyParamsSchema.parse(args);
        const client = getRxNormClient();
        const matches = await client.getATCByDrugName(params.drug_name);
    
        const structured: ATCClassifyOutput = {
          drug_name: params.drug_name,
          matches,
        };
    
        if (matches.length === 0) {
          return {
            content: [
              {
                type: 'text',
                text: `No ATC classification found for "${params.drug_name}". The drug may be unknown to RxNorm or have no ATC mapping.`,
              },
            ],
            structuredContent: structured,
          };
        }
    
        const lines: string[] = [];
        lines.push(`# ATC classification for "${params.drug_name}"`);
        lines.push('');
        lines.push(`Found ${matches.length} ATC code${matches.length === 1 ? '' : 's'}:`);
        lines.push('');
        lines.push('| ATC code | Class name | Drug (RxNorm) | TTY |');
        lines.push('|----------|------------|---------------|-----|');
        for (const m of matches) {
          lines.push(
            `| ${m.atc_code} | ${m.atc_name} | ${m.drug_name} | ${m.tty} |`,
          );
        }
    
        return {
          content: [{ type: 'text', text: lines.join('\n') }],
          structuredContent: structured,
        };
      } catch (error) {
        return handleToolError(error);
      }
    }
  • Input schema for atc_classify: defines the drug_name parameter (string, min length 1).
    export const ATCClassifyParamsSchema = z.object({
      drug_name: z
        .string()
        .min(1)
        .describe('Drug name to classify (brand or generic, e.g., "metformin")'),
    });
  • Output schema for atc_classify: specifies the structure including drug_name and matches array (each with rxcui, drug_name, tty, atc_code, atc_name, atc_level_type).
    export const ATCClassifyOutputSchema = z.object({
      drug_name: z.string(),
      matches: z.array(
        z.object({
          rxcui: z.string(),
          drug_name: z.string(),
          tty: z.string(),
          atc_code: z.string(),
          atc_name: z.string(),
          atc_level_type: z.string(),
        }),
      ),
    });
  • Registration of the atc_classify tool in the toolRegistry with its handler function handleATCClassify.
    toolRegistry.register(atcClassifyTool, handleATCClassify);
  • The RxNormClient.getATCByDrugName method that actually calls the RxClass API endpoint /rxclass/class/byDrugName.json with the drug name and 'ATC' as the source, then maps the response to RxNormATCMatch objects.
    async getATCByDrugName(drugName: string): Promise<RxNormATCMatch[]> {
      const cacheKey = `atc:bydrug:${drugName.toLowerCase()}`;
    
      return cache.getOrSet(
        CACHE_PREFIX.RXNORM,
        cacheKey,
        async () => {
          const response = await this.request<RxClassResponse>(
            '/rxclass/class/byDrugName.json',
            { drugName, relaSource: 'ATC' },
          );
    
          const list = response.rxclassDrugInfoList?.rxclassDrugInfo ?? [];
          return list.map((info) => ({
            rxcui: info.minConcept?.rxcui ?? '',
            drug_name: info.minConcept?.name ?? '',
            tty: info.minConcept?.tty ?? '',
            atc_code: info.rxclassMinConceptItem.classId,
            atc_name: info.rxclassMinConceptItem.className,
            atc_level_type: info.rxclassMinConceptItem.classType,
          }));
        },
        DEFAULT_TTL.LOOKUP,
      );
    }
Behavior4/5

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

Annotations already declare readOnly, idempotent, openWorld, and non-destructive. Description adds behavioral details: retrieval via NLM RxClass, one entry per ATC code, and differentiation between single-ingredient and combination products. 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?

Three concise paragraphs, front-loaded with verb and examples. Each sentence serves a purpose (purpose, usage, behavior). No redundancy or fluff.

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 tool's complexity (ATC hierarchy, multiple codes per drug) and the presence of an output schema (not shown but acknowledged), the description provides sufficient context on input, behavior, and source. Comprehensive enough for correct invocation.

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% with a clear description for drug_name. Description adds 'brand or generic' and an example, but this adds only marginal value beyond the schema's existing description. Baseline score for high coverage.

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 the tool looks up WHO ATC classifications by drug name, gives concrete examples (metformin → A10BA02), and explains behavior for single vs combination products. It differentiates from siblings like atc_lookup (by code) and atc_members (by class) through the use of 'classify' name and description context.

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?

Description lists explicit use cases: find ATC code, identify hierarchy, cross-reference. It doesn't explicitly state when to avoid or mention sibling alternatives, but the examples and scope provide clear guidance for typical usage.

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