Skip to main content
Glama
RowanErasmus

DailyMed MCP Server

by RowanErasmus

search_drug_classes

Find pharmacologic drug classes by code, name, or classification type to identify medication mechanisms and categories within the FDA DailyMed database.

Instructions

Search for pharmacologic drug classes using various parameters with pagination support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
drug_class_codeNoCode representing a pharmacologic drug class
drug_class_coding_systemNoCoding system (default: National Drug File Reference Terminology)
class_code_typeNoType of pharmacologic drug class
class_nameNoName of the drug class
unii_codeNoUnique Ingredient Identifier code
pageNoPage number for pagination (1-based, default: 1)
pageSizeNoNumber of results per page (default: 100, max: 100)

Implementation Reference

  • The MCP tool handler in src/index.ts for 'search_drug_classes', which orchestrates the call to the client.
    case "search_drug_classes":
      const drugClassParams: any = {};
      if (args.drug_class_code)
        drugClassParams.drug_class_code = args.drug_class_code as string;
      if (args.drug_class_coding_system)
        drugClassParams.drug_class_coding_system =
          args.drug_class_coding_system as string;
      if (args.class_code_type)
        drugClassParams.class_code_type = args.class_code_type as string;
      if (args.class_name)
        drugClassParams.class_name = args.class_name as string;
      if (args.unii_code)
        drugClassParams.unii_code = args.unii_code as string;
    
      // Add pagination parameters
      if (args.page) drugClassParams.page = args.page as number;
      if (args.pageSize) drugClassParams.pageSize = args.pageSize as number;
    
      const drugClassResults = await this.client.searchDrugClassesAdvanced(drugClassParams);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(drugClassResults, null, 2),
          },
        ],
      };
  • The actual implementation of the drug class search logic in DrugClassClient.searchDrugClassesAdvanced.
    async searchDrugClassesAdvanced(params: DrugClassSearchParams = {}): Promise<PaginatedDrugClassResponse> {
      const { page = 1, pageSize = 100, ...searchParams } = params;
      
      validatePaginationParams(page, pageSize, 100);
    
      try {
        const queryParams: any = {
          page,
          pagesize: Math.min(pageSize, 100), // API max is 100
        };
    
        // Add search filters
        if (searchParams.drug_class_code) queryParams.drug_class_code = searchParams.drug_class_code;
        if (searchParams.drug_class_coding_system) queryParams.drug_class_coding_system = searchParams.drug_class_coding_system;
        if (searchParams.class_code_type) queryParams.class_code_type = searchParams.class_code_type;
        if (searchParams.class_name) queryParams.class_name = searchParams.class_name;
        if (searchParams.unii_code) queryParams.unii_code = searchParams.unii_code;
    
        const response = await this.client.get("/drugclasses.json", {
          params: queryParams,
        });
    
        if (
          response.data &&
          response.data.data &&
          Array.isArray(response.data.data)
        ) {
          const drugClasses = response.data.data.map((item: any) => ({
            drugClassName: item.name,
            drugClassCode: item.code,
            drugClassCodingSystem: item.codingSystem,
            classCodeType: item.type,
            uniiCode: item.unii_code,
          }));
    
          // Extract pagination metadata from API response
          const totalResults = response.data.metadata?.total_elements || drugClasses.length;
          const totalPages = Math.ceil(totalResults / pageSize);
    
          return {
            data: drugClasses,
            pagination: {
              page,
              pageSize,
              totalResults,
              totalPages,
              hasNextPage: page < totalPages,
              hasPreviousPage: page > 1,
            },
          };
        } else {
          throw new Error("Unexpected response structure for drug class search");
        }
      } catch (error) {
        throw new Error(
          `Failed to search drug classes: ${error instanceof Error ? error.message : "Unknown error"}`,
        );
      }
    }
  • src/tools.ts:454-454 (registration)
    The registration of the 'search_drug_classes' tool in the tool definition list.
    name: "search_drug_classes",
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 mentions 'pagination support' which is useful, but doesn't describe other important traits: whether this is a read-only operation, what the response format looks like, potential rate limits, authentication requirements, or error conditions. For a search tool with 7 parameters and no annotation coverage, this leaves significant gaps.

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 that front-loads the core purpose ('Search for pharmacologic drug classes') and adds two key qualifiers ('using various parameters' and 'with pagination support'). There's zero waste—every phrase contributes meaningful information without redundancy or fluff.

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 complexity (7 parameters, no annotations, no output schema), the description is minimally adequate but incomplete. It covers the basic purpose and hints at pagination, but lacks guidance on usage versus siblings, detailed behavioral context, or output expectations. For a search tool in a crowded namespace, more contextual information would be helpful for an agent to use it effectively.

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 description coverage is 100%, meaning all parameters are documented in the input schema. The description adds minimal value beyond the schema—it mentions 'various parameters' and 'pagination support' (hinting at 'page' and 'pageSize'), but doesn't provide additional semantic context about how parameters interact or search behavior. With high schema coverage, the baseline score of 3 is appropriate.

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 pharmacologic drug classes using various parameters with pagination support.' It specifies the verb ('search') and resource ('pharmacologic drug classes'), and mentions key capabilities ('various parameters', 'pagination support'). However, it doesn't explicitly differentiate this tool from sibling tools like 'get_all_drug_classes' or 'search_drugs_by_pharmacologic_class', which would require a 5.

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. With many sibling tools available (like 'get_all_drug_classes' for retrieving all classes without filtering, or 'search_drugs_by_pharmacologic_class' for a different search focus), the description lacks any 'when-to-use' context, prerequisites, or comparisons to help an agent choose appropriately.

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/RowanErasmus/dailymed-mcp-server'

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